11.4. HASHING
The primary purpose of hashing is to help ensure that electronic information being transmitted to a receiver has not been altered, other information has not been added to the transmission, and information has not been deleted from the transmission. This kind of message integrity can be achieved through the deployment of one-way hash functions. A one-way hash function is a mathematical formula that uses an electronic message as its input and creates a block of data called a message digest. When both an electronic message and a cryptographic key are processed through a one-way hash function, the resulting block of data is called a message authentication code (MAC).
Two common one-way hashing functions are Message Digest 5 (MD-5) and Secure Hash Algorithm 1 (SHA-1). MD-5 is not considered to be as secure as SHA-1. SHA-1 is currently a United States government Federal Information Processing Standard (FIPS) as well as a standard of the American National Standards Institute (ANSI).
One-way hash functions should be designed so that they can be used only to calculate message digests or MACs in a single direction. In other words, someone should not be able to determine the original information from the corresponding message digest or MAC.
Another desirable characteristic of one-way hash functions is that they should not generate the same message digest or MAC for different sets of data. Such assurance is achieved by designing hash functions that create lengthy message digests ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access