Lecture 4 Hash Functions
Lecture 4 Hash Functions
Hash functions are extremely useful and appear in almost all information security applications.
A hash function is a mathematical function that converts a numerical input value into another
compressed numerical value. The input to the hash function is of arbitrary length but output is always of
fixed length.
Values returned by a hash function are called message digest or simply hash values. The following
picture illustrated hash function
Hashing algorithm involves rounds of above hash function like a block cipher. Each round takes an input
of a fixed size, typically a combination of the most recent message block and the output of the last
round.
This process is repeated for as many rounds as are required to hash the entire message. Schematic of
hashing algorithm is depicted in the following illustration −
Since, the hash value of first message block becomes an input to the second hash operation, output of
which alters the result of the third operation, and so on. This effect, known as an avalanche effect of
hashing.
Avalanche effect results in substantially different hash values for two messages that differ by even a
single bit of data.
Understand the difference between hash function and algorithm correctly. The hash function generates a
hash code by operating on two blocks of fixed-length binary data.
Hashing algorithm is a process for using the hash function, specifying how the message will be broken
up and how the results from previous message blocks are chained together.
An intruder can only see the hashes of passwords, even if he accessed the password. He can
neither logon using hash nor can he derive the password from hash value since hash function
possesses the property of pre-image resistance.
The receiver after receiving the encrypted data and signature on it, first verifies the signature
using sender’s public key. After ensuring the validity of the signature, he then retrieves the data
through decryption using his private key.
Operational description
The actual operation of PGP consists of five services: authentication, confidentiality,
compression, e-mail compatibility and segmentation.
1. Authentication
The sequence for authentication is as follows:
The sender creates the message
SHA-1 is used to generate a 160-bit hash code of the message
The hash code is encrypted with RSA using the sender’s private key and the result is
prepended to the message
The receiver uses RSA with the sender’s public key to decrypt and recover the hash code.
The receiver generates a new hash code for the message and compares it with the decrypted
hash code. If the two match, the message is accepted as authentic.
2. Confidentiality
Confidentiality is provided by encrypting messages to be transmitted or to be stored locally as
files. In both cases, the conventional encryption algorithm CAST-128 may be used. The 64-bit
cipher feedback (CFB) mode is used.
In PGP, each conventional key is used only once. That is, a new key is generated as a random
128- bit number for each message. Thus although this is referred to as a session key, it is in
reality a one time key. To protect the key, it is encrypted with the receiver’s public key.
The sequence for confidentiality is as follows:
The sender generates a message and a random 128-bit number to be used as a session key for
this message only.
The message is encrypted using CAST-128 with the session key.
The session key is encrypted with RSA, using the receiver’s public key and is prepended to
the message.
The receiver uses RSA with its private key to decrypt and recover the session key.
The session key is used to decrypt the message.
3. Compression
As a default, PGP compresses the message after applying the signature but before encryption.
This has the benefit of saving space for both e-mail transmission and for file storage.
The signature is generated before compression for two reasons:
It is preferable to sign an uncompressed message so that one can store only the uncompressed
message together with the signature for future verification. If one signed a compressed
document, then it would be necessary either to store a compressed version of the message for
later verification or to recompress the message when verification is required.
Even if one were willing to generate dynamically a recompressed message from verification,
PGP’s compression algorithm presents a difficulty. The algorithm is not deterministic;
various implementations of the algorithm achieve different tradeoffs in running speed versus
compression ratio and as a result, produce different compression forms.
Message encryption is applied after compression to strengthen cryptographic security. Because
the compressed message has less redundancy than the original plaintext, cryptanalysis is more
difficult.
The compression algorithm used is ZIP.
4. e-mail compatibility
Many electronic mail systems only permit the use of blocks consisting of ASCII texts. To
accommodate this restriction, PGP provides the service of converting the raw 8-bit binary stream
to a stream of printable ASCII characters. The scheme used for this purpose is radix-64
conversion. Each group of three octets of binary data is mapped into four ASCII characters. e.g.,
consider the 24-bit (3 octets) raw text sequence 00100011 01011100 10010001, we can express
this input in block of 6-bits to produce 4 ASCII characters.
001000 110101 110010 010001
I L Y R => corresponding ASCII characters
PGP – Issues
There were questions of legality, but PGP may now be legally used by anyone in the world:
noncommercial use in US/Canada with licenced MIT version
commercial use in US/Canada with Viacrypt version
noncommercial use outside the US is probably legal with (non US sourced) international
version
commercial use outside the US requires an IDEA licence for the international version
User Authentication
user authentication (identity verification)
o convince system of your identity
o before it can act on your behalf
sometimes also require that the computer verify its identity with the user
user authentication is based on three methods
o what you know
o what you have
o what you are
All then involve some validation of information supplied against a table of possible values based
on users claimed identity
S/MIME
S/MIME (Secure/Multipurpose Internet Mail Extension) is a security enhancement to the MIME
Internet e-mail format standard, based on technology from RSA Data Security. S/MIME is
defined in a number of documents, most importantly RFCs 3369, 3370, 3850 and 3851.