Module 7 : Factorization

Lecture 4 : Quadratic-Sieve Factoring

 

The pseudo code for the MD5 algorithm is as follows:

// Note: All variables are unsigned 32 bits and wrap modulo 2^32 when calculating

var int [64] r, k

// r specifies the per-round shift amounts

// Use binary integer part of the sines of integers as constants:
for
i from 0 to 63
   k[i] := floor(abs(sin(i + 1)) × (2 pow 32))
// Initialize variables:

h0 := 0x67452301
h1 := 0xEFCDAB89
h2 := 0x98BADCFE
h3 := 0x10325476
// Pre-processing:
append "1" bit to message
append
"0" bits until message length in bits = 448 (mod 512)
append
bit (bit, not byte) length of unpadded message as 64-bit little-endian integer to message

// Process the message in successive 512-bit chunks:

for each 512-bit chunk of message

break chunk into sixteen 32-bit little-endian words w[i], 0 = i = 15  

// Initialize hash value for this chunk:

var int a := h0
var int b := h1
var
int c := h2
var
int d := h3  

// Main loop:

for i from 0 to 63
     if 0 ≤ i ≤ 15 then
         f := (b and c) or (( not b) and d)
         g := i
     else if 16 ≤ i ≤ 31
         f := (d and b) or (( not d) and c)
         g := (5×i + 1) mod 16
else if
32 ≤ i ≤ 47
         f := b xor c xor d
         g := (3×i + 5) mod 16
else if 48 ≤ i ≤ 63
         f := c xor (b or ( not d))
         g := (7×i) mod 16