The hash code for a String object is computed as − Looking for feedback on my java hash table implementation. What hashing function does Java use to map the keys to slots? But it doesn't answer the question, and I think the marked answer for that question is wrong. Java - String hashCode() Method - This method returns a hash code for this string. GitHub Gist: instantly share code, notes, and snippets. For example, getHash("carina") = -8. I have seen there is a question here Hashing function used in Java Language. Hash functions are a foundational topic in computer science and have many practical applications in many areas of software engineering. It may return negative values. The implementation of hashCode() for an object must be consistent with equals.That is, if a.equals(b) is true, then a.hashCode() must have the same numerical value as b.hashCode(). I am wondering if there is a relatively strong and fast hash function for this case which is implemented in Java. I added the implementation below - please tell me what you think about it - I mostly care about correctness and efficiency. It says that hashCode() let you do your own hashing function for Hashtable, but I think it is wrong. HashTable implementation in Java. Java conventions. ... Pay attention to the hash function. Table should resize above a certain load %. Java helps us address the basic problem that every type of data needs a hash function by requiring that every data type must implement a method called hashCode() (which returns a 32-bit integer). I want a function to get a string as an argument and return the hash as the result. Code uses an array of lists of entries as a sort of separate-chaining; not sure how much I prefer this approach in practice, and am considering using linear / quadratic probing instead. Sign up for free to join this conversation on GitHub. Also, pay attention to the call to Thread.sleep(0,1) - the reason I'm calling it is beacuase isAfter method of ZonedDateTime smallest unit compare is nano-seconds (and I want to make sure that at least one nano-seconds passes between to calls to ZonedDateTime.now() ). Thak you. I am almost tempted to convert the 6 ints to a String (as if each int is a unicode character or something like that, not by representing each int as an actual number) and use "hashcode", but it sounds very inefficient to me, I think want something faster. Java-Hash algorithms-Fastest implementations (4) I want to know what is the best and fastest implementation of hash algorithms for Java especially MD5 and SHA-2 512 (SHA512) or 256. HashTable implementation in Java. Cryptographic hashes due to their unique properties are used in cryptography and also play a key role in the implementation of cryptocurrencies, blockchains and other distributed ledger technologies.