public InitCipher ( string passphrase ) : void | ||
passphrase | string | /// The passphrase for encrypting or decrypting with this cipher. /// |
return | void |
Step 1 - Initializing the encryption keys ----------------------------------------- Start with these keys: Key(0) := 305419896 (0x12345678) Key(1) := 591751049 (0x23456789) Key(2) := 878082192 (0x34567890) Then, initialize the keys with a password: loop for i from 0 to length(password)-1 update_keys(password(i)) end loop Where update_keys() is defined as: update_keys(char): Key(0) := crc32(key(0),char) Key(1) := Key(1) + (Key(0) bitwiseAND 000000ffH) Key(1) := Key(1) * 134775813 + 1 Key(2) := crc32(key(2),key(1) rightshift 24) end update_keys Where crc32(old_crc,char) is a routine that given a CRC value and a character, returns an updated CRC value after applying the CRC-32 algorithm described elsewhere in this document.
After the keys are initialized, then you can use the cipher to encrypt the plaintext.
Essentially we encrypt the password with the keys, then discard the ciphertext for the password. This initializes the keys for later use.
public InitCipher ( string passphrase ) : void | ||
passphrase | string | /// The passphrase for encrypting or decrypting with this cipher. /// |
return | void |