From 9a837da112323590a8d096abdbfc80bf0ac824c9 Mon Sep 17 00:00:00 2001 From: erana Date: Fri, 20 Jan 2012 18:49:06 +0900 Subject: [PATCH] blowfish fixes - 11 --- scsh/encryption/blowfish.scm | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/scsh/encryption/blowfish.scm b/scsh/encryption/blowfish.scm index 4d4825a..c648736 100644 --- a/scsh/encryption/blowfish.scm +++ b/scsh/encryption/blowfish.scm @@ -1216,6 +1216,7 @@ (do ((i 0 (+ i 1))) ((>= i (+ blowfish-rounds 2))0) (dictionary-set-with-index! (blowfish-p bc) i (dictionary-ref-with-index blowfish-ps i))) + (display "FOO") (do ((i 0 (+ i 1))) ((>= i 256)0) (dictionary-set-with-index! (blowfish-s0 bc) i (dictionary-ref-with-index blowfish-ks0 i)) @@ -1223,22 +1224,24 @@ (dictionary-set-with-index! (blowfish-s2 bc) i (dictionary-ref-with-index blowfish-ks2 i)) (dictionary-set-with-index! (blowfish-s3 bc) i (dictionary-ref-with-index blowfish-ks3 i)) ) + (display "FOO2") (do ((i 0 (+ i 1)) (j 0 (+ j 1))) ((>= i (+ blowfish-rounds 2))0) (if BIG-ENDIAN-HOST (begin - (dictionary-set! data 0 (vector-ref keyvec j)) - (dictionary-set! data 1 (vector-ref keyvec (remainder (+ j 1) keylen))) - (dictionary-set! data 2 (vector-ref keyvec (remainder (+ j 2) keylen))) - (dictionary-set! data 3 (vector-ref keyvec (remainder (+ j 3) keylen))) + (dictionary-set-with-index! data 0 (vector-ref keyvec j)) + (dictionary-set-with-index! data 1 (vector-ref keyvec (remainder (+ j 1) keylen))) + (dictionary-set-with-index! data 2 (vector-ref keyvec (remainder (+ j 2) keylen))) + (dictionary-set-with-index! data 3 (vector-ref keyvec (remainder (+ j 3) keylen))) ) (begin - (dictionary-set! data 3 (vector-ref keyvec j)) - (dictionary-set! data 2 (vector-ref keyvec (remainder (+ j 1) keylen))) - (dictionary-set! data 1 (vector-ref keyvec (remainder (+ j 2) keylen))) - (dictionary-set! data 0 (vector-ref keyvec (remainder (+ j 3) keylen))) + (dictionary-set-with-index! data 3 (vector-ref keyvec j)) + (dictionary-set-with-index! data 2 (vector-ref keyvec (remainder (+ j 1) keylen))) + (dictionary-set-with-index! data 1 (vector-ref keyvec (remainder (+ j 2) keylen))) + (dictionary-set-with-index! data 0 (vector-ref keyvec (remainder (+ j 3) keylen))) )) + (display "FOO3") (dictionary-set-with-index! (blowfish-p bc) i (bitwise-xor (dictionary-ref-with-index (blowfish-p bc) i) @@ -1247,7 +1250,7 @@ (dictionary-ref-with-index data 2) (dictionary-ref-with-index data 3)))) ) -(display "BAR!") + (display "BAR!") (let ((datal 0) (datar 0))