Professional Documents
Culture Documents
Divisional Engineer(C-III)
Computer Faculty
BRBRAITT, Jabalpur
ABCDEFGHIJKLMNOPQRSTUVWXYZ
rotate 13 positions
NOPQRSTUVWXYZABCDEFGHIJKLM
0 1 2 3 4 5 6 7 8 9 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
0 1 2 3 4 5 6 7 8 9 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
Plain-text C A P T U R E T B E E B N
Covert to number
2 0 15 19 20 17 4 19 1 4 4 2 13
0 1 2 3 4 5 6 7 8 9 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
0 1 2 3 4 5 6 7 8 9 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
cipher-text L J Y C D A N C K N N K W
Covert to number
11 9 24 2 3 0 13 2 10 13 13 10 22
Add 26 if < 0
2 0 15 19 20 17 4 19 1 4 4 1 13
Re-convert to
letters
Cipher-text C A P T U R E T B E E B N
Input bits
Output bits
Initial F: (x∧y)∨(~x ∧ z)
128-bit vector G:(x ∧ z) ∨(y ∧~ z)
H:x⊕y⊕ z
I: y⊕(x ∧ ~z)
+: binary sum
x↵y: x left rotate y bits
128-bit result
BRBRAITT/Basics of Cryptography & Hash Functions/ Sept 2006 96
MD5 Blocks
512: B1
512: B2
MD5
Initial Vector
512: B3
(128 bits) MD5
512: BL
MD5
MD5
Message 100…0
L X 512 bits
MD MD MD
MD
buffer0 buffern bufferL-1
buffer1
128-bit
digest
Note: HMD5 = 4-round compression function
Round 2
Round 3
Round 4
+ + + +
Buffer q +1 128
Round 3 (H)
g(b,c,d)
= b XOR c XOR d
k = (5 + 3j)mod 16 where j = 1…16
i = 33…48
Round 4 (I)
g(b,c,d) = c XOR (b OR NOT d)
k = 7j mod 16 where j = 1…16
i = 49…64
+ g
X[k] +
T[i] +
CLSs
A B C D
Round 2
Round 3
Round 4
+ + + + +
Buffer q +1 160
BRBRAITT/Basics of Cryptography & Hash Functions/ Sept 2006 113
SHA-1 Compression Function
Each round has 20 steps which
replaces the 5 buffer words thus:
(A,B,C,D,E) <-
(E+f(t,B,C,D)+(A<<5)+Wt+Kt),A,(B<<30),C,D)
A B C D E
ft +
S5 +
+ Wt
S30 + Kt
A B C D A
Round Function
ft(B,C,D)
0 <=t<= 19 (B∧C)∨(~B ∧D)
20<=t<=39 B⊕C⊕D
40<=t<=59 (B∧C)∨(B∧D)∨(C∧D)
60<=t<=79 B⊕C⊕D
BRBRAITT/Basics of Cryptography & Hash Functions/ Sept 2006 119
Mixing of Wt’s
Additional mixing used with input
message 512-bit block
For 15 < t <80:
Wt = Wt-16 ⊕Wt-14 ⊕Wt-8 ⊕Wt-3
XOR is a very efficient operation
(with multilevel shifting it
produces very extensive and
random mixing)
BRBRAITT/Basics of Cryptography & Hash Functions/ Sept 2006 120
MD5 (Actual Sample)
The MD4, MD5 and SHA-1 algorithms are secure hash functions.
They take a string input, and produce a fixed size number - 128
bits for MD4 and MD5; 160 bits for SHA-1. This number is a hash
of the input - a small change in the input results in a substantial
change in the output. The functions are thought to be secure, in
the sense that it would require an enormous amount of
computing power to find a string which hashes to a chosen value.
In others words, there's no way to decrypt a secure hash. The
uses of secure hashes include digital signatures and challenge
Input hash authentication
MD5 Box
c530bc8598173467fafa354dce9048bb
Output
SHA-1 Box
b4078946a42c9cabf175ebc2d41d9171a804c91b
Output