hash-function

Why are the hash codes generated by this function not unique?

I'm testing the VB function below that I got from a Google search. I plan to use it to generate hash codes for quick string comparison. However, there are occasions in which two different strings have the same hash code. For example, these strings "122Gen 1 heap size (.NET CLR Memory w3wp):mccsmtpteweb025.20833333333333E-02" "122Gen 2...

Hash function for a pair of long long?

I need to map a pair of long long to a double, but I'm not sure what hash function to use. Each pair may consist of any two numbers, although in practice they will usually be numbers between 0 and about 100 (but again, that's not guaranteed). Here is the tr1::unordered_map documentation. I started like this: typedef long long Int; type...

Help me better understand cryptographic hash functions

I was reading this question on MD5 hash values and the accepted answer confuses me. One of the main properties, as I understand it, of a cryptopgraphic hash function is that it is infeasible to find two different messages (inputs) with the same hash value. Yet the consensus answer to the question "why aren't MD5 hash values reversibl...

Dynamic perfect hashing and universal hash functions - explanation please?

So I'm reading up about hash tables, hash functions etc. I was intrigued to read on wikipedia about how "dynamic perfect hashing" involves using a second hash table as the data structure to store multiple values within a particular bucket. Where I get lost however, is when it comes to how a universal hash function is selected to perfor...

Best hash function for mixed numeric and literal identifiers

For performance reasons I have a need to split a set of objects identified by a string into groups. Objects may be either identified by a number or by a string in prefixed (qualified) form with dots separating parts of the identifier: 12 323 12343 2345233 123123131 ns1:my.label.one ns1:my.label.two ns1:my.label.three ns1:system.text.one...

How can I map URLs to filenames with perl?

In a simple webapp I need to map URLs to filenames or filepaths. This app has a requirement that it can depend only on modules in the core Perl ditribution (5.6.0 and later). The problem is that filename length on most filesystems is limited to 255. Another limit is about 32k subdirectories in a single folder. My solution: my $filena...

How to write a hash function in C?

Hash Tables are said to be the fastest/best way of Storing/Retrieving data. My understanding of a hash table, hashing is as follows (Please correct me if I am wrong or Please add If there is anything more): A Hash Table is nothing but an array (single or multi-dimensional) to store values. Hashing is the process to find the index/loca...

Collision free hash function for a specific data structure

Is it possible to create collision free hash function for a data structure with specific properties. The datastructure is int[][][] It contains no duplicates The range of integers that are contained in it is defined. Let's say it's 0..1000, the maximal integer is definitely not greater than 10000. Big problem is that this hash functi...

SSL encrpytion, SHA1 and SHA2

Hello, I am trying to implement SHA2 encryption instead SHA1. For this, I know that bit number between these two hash algorithms are different and it confuses me. How can this be achieved and at what parts do I need to make required changes. I can use any open source library from Java, Python and any other major programming language....

Constructing a hash table/hash function.

Hi, I would like to construct a hash table that looks up keys in sequences (strings) of bytes ranging from 1 to 15 bytes. I would like to store an integer value, so I imagine an array for hashing would suffice. I'm having difficulty conceptualizing how to construct a hash function such that given the key would give an index into the ar...

What is a hash function in java?

I have check out this Wikipedia page on it, but I still don't understand it. Can someone please help my dim-witted mind to understand the concepts of hashing, hashtable/hashmap, and hash functions? Some examples would really help. ...

What is the diff between the hashing methods of php?

What is the difference between the hashing methods available in php md2 md4 md5 sha1 sha224 sha256 sha384 sha512 ripemd128 ripemd160 ripemd256 ripemd320 whirlpool tiger128,3 tiger160,3 tiger192,3 tiger128,4 tiger160, 4 tiger192,4 snefru snefru256 gost adler32 crc32 crc32b salsa10 salsa20 haval128,3 haval160,3 haval192,3 haval224,3 hav...

Collate Hash Function

In the local object there is a collate facet. The collate facet has a hash method that returns a long. http://www.cplusplus.com/reference/std/locale/collate/hash/ Two questions: Does anybody know what hashing method is used. I need a 32bit value. If my long is longer than 32 bits, does anybody know about techniques for folding the ha...