Monitor's Secret Key Crypto - KARN, encrypt
512 bit Secret
Monitor's Secret Key Crypto - KARN, encrypt
512 bit Secret
Left key Right key
Monitor's Secret Key Crypto - KARN, encrypt
512 bit Secret
Left key Right key
42
First: send out "guard byte" - the number 42 (00101010)
Monitor's Secret Key Crypto - KARN, encrypt
512 bit Secret
Left key Right key
Split plaintext block into two halves
320 bit (Padded) Plaintext Block
Left block Right block
Monitor's Secret Key Crypto - KARN, encrypt
512 bit Secret
Left key Right key
Reset a SHA message digest
320 bit (Padded) Plaintext Block
Left block Right block
Reset Hash
Monitor's Secret Key Crypto - KARN, encrypt
512 bit Secret
Left key Right key
Update hash with plaintext left block
320 bit (Padded) Plaintext Block
Left block Right block
Update Hash
update
Monitor's Secret Key Crypto - KARN, encrypt
512 bit Secret
Left key Right key
Update hash with left key
320 bit (Padded) Plaintext Block
Left block Right block
Update Hash
update
Monitor's Secret Key Crypto - KARN, encrypt
512 bit Secret
Left key Right key
Create right cipher block
320 bit (Padded) Plaintext Block
Left block Right block
Hash Output
Right Cipher Block
Monitor's Secret Key Crypto - KARN, encrypt
512 bit Secret
Left key Right key
Reset Hash
320 bit (Padded) Plaintext Block
Left block Right block
Reset Hash
Right Cipher Block
Monitor's Secret Key Crypto - KARN, encrypt
512 bit Secret
Left key Right key
Update Hash with right cipher block
320 bit (Padded) Plaintext Block
Left block Right block
Update Hash
Right Cipher Blockupdate
Monitor's Secret Key Crypto - KARN, encrypt
512 bit Secret
Left key Right key
Update Hash with right key
320 bit (Padded) Plaintext Block
Left block Right block
Update Hash
Right Cipher Blockupdate
Monitor's Secret Key Crypto - KARN, encrypt
512 bit Secret
Left key Right key
Create left cipher block - XOR digest with left plaintext block
320 bit (Padded) Plaintext Block
Left block Right block
Hash Output
Right Cipher Block
Left Cipher Block
Monitor's Secret Key Crypto - KARN, encrypt
512 bit Secret
Left key Right key
Output left cipher block
320 bit (Padded) Plaintext Block
Left block Right block
Hash Output
Right Cipher Block
Left Cipher Block
Monitor's Secret Key Crypto - KARN, encrypt
512 bit Secret
Left key Right key
Output right cipher block
320 bit (Padded) Plaintext Block
Left block Right block
Hash Output
Right Cipher Block
Left Cipher Block
Monitor's Secret Key Crypto - KARN, padding
Pad to last block, or pad a whole block
< 320 bit Last Plaintext Block
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
String input = "The plaintext message to pad";byte scratch[] = input.getBytes();int len = input.length();buffer.write(scratch, 0, len);
Monitor's Secret Key Crypto - KARN, padding
Stick a 0 byte on the end
< 320 bit Last Plaintext Block
< 320 bit Last Plaintext Block 0
buffer.write(0);
Monitor's Secret Key Crypto - KARN, padding
Remaining bytes are derived from random #
< 320 bit Last Plaintext Block
< 320 bit Last Plaintext Block 0
< 320 bit Last Plaintext Block 0 Random #
int padlen = PADSIZE - ((len + 1) % PADSIZE);scratch[] = new byte[padlen];SecureRandom sr = new SecureRandom();sr.nextBytes(scratch);buffer.write(scratch, 0, padlen);