Hash functions in other contexts
-
A hash function for a hash table takes a key, and returns an index into the table
-
the set of possible keys is large, but the set of hash function values is just the size of the table
-
Other uses for hash functions include password systems, message digest systems, digital signature systems
-
For these applications to work as intended, the probability of collisions must be very low, and so you need a hash function with a very large set of possible values
-
Password system: Given a user password, the operating system computes its hash, and compares it to the hash for that user stored in a file. (Don’t want it to be easy to guess a password that hashes to that same value)
-
Message digest system: Given an important message, compute its hash, and publish it separately from the message itself. A reader who wants to check the validity of the message also computes its hash using the same algorithm, and compares to the published hash. (Don’t want it to be easy to forge a message and still get the same hash)
-
Examples of popular hash function algorithms for these applications:
-
md5
: 128 bit values (2
128
possible values: try
2
64
keys before finding a collision)
-
sha-1
: 160 bit values (2
160
possible values: try
2
80
keys before finding a collision)
CONTENTS PREVIOUS NEXT