blowfish fixes - 24

This commit is contained in:
erana 2012-01-20 20:58:15 +09:00
parent 86977f6804
commit d3766ea810
1 changed files with 3 additions and 8 deletions

View File

@ -1152,7 +1152,6 @@
(+ (vector-ref (blowfish-s2 blowfish-context) 2) (+ (vector-ref (blowfish-s2 blowfish-context) 2)
(vector-ref (blowfish-s3 blowfish-context) 3)))) (vector-ref (blowfish-s3 blowfish-context) 3))))
(define (blowfish-F-le x) (define (blowfish-F-le x)
(display "F!")
(bitwise-xor (+ (dictionary-ref-with-index (blowfish-s0 blowfish-context) 3) (bitwise-xor (+ (dictionary-ref-with-index (blowfish-s0 blowfish-context) 3)
(dictionary-ref-with-index (blowfish-s1 blowfish-context) 2)) (dictionary-ref-with-index (blowfish-s1 blowfish-context) 2))
(+ (dictionary-ref-with-index (blowfish-s2 blowfish-context) 1) (+ (dictionary-ref-with-index (blowfish-s2 blowfish-context) 1)
@ -1173,7 +1172,6 @@
;;(s2 (blowfish-s2 bc)) ;;(s2 (blowfish-s2 bc))
;;(s3 (blowfish-s3 bc)) ;;(s3 (blowfish-s3 bc))
) )
(display "almost...")
(blowfish-R bc xl xr 0) (blowfish-R bc xl xr 0)
(blowfish-R bc xr xl 1) (blowfish-R bc xr xl 1)
(blowfish-R bc xl xr 2) (blowfish-R bc xl xr 2)
@ -1190,13 +1188,11 @@
(blowfish-R bc xr xl 13) (blowfish-R bc xr xl 13)
(blowfish-R bc xl xr 14) (blowfish-R bc xl xr 14)
(blowfish-R bc xr xl 15) (blowfish-R bc xr xl 15)
(display "almost...")
(let ((xl (bitwise-xor xl (dictionary-ref-with-index (blowfish-p bc) blowfish-rounds))) (let ((xl (bitwise-xor xl (dictionary-ref-with-index (blowfish-p bc) blowfish-rounds)))
(xr (bitwise-xor xr (dictionary-ref-with-index (blowfish-p bc) (+ blowfish-rounds 1))))) (xr (bitwise-xor xr (dictionary-ref-with-index (blowfish-p bc) (+ blowfish-rounds 1)))))
(set! ret_xl xr) (set! ret_xl xr)
(set! ret_xr xl) (set! ret_xr xl)
(display "ENCRYPT done!")
))) )))
@ -1261,7 +1257,6 @@
(dictionary-set-with-index! data 1 (vector-ref keyvec (remainder (+ j 2) 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))) (dictionary-set-with-index! data 0 (vector-ref keyvec (remainder (+ j 3) keylen)))
)) ))
;;(display "FOO")
(dictionary-set-with-index! (blowfish-p bc) i (dictionary-set-with-index! (blowfish-p bc) i
(bitwise-xor (bitwise-xor
(dictionary-ref-with-index (blowfish-p bc) i) (dictionary-ref-with-index (blowfish-p bc) i)
@ -1271,7 +1266,7 @@
(dictionary-ref-with-index data 3)))) (dictionary-ref-with-index data 3))))
(set! j (remainder (+ j 4) keylen)) (set! j (remainder (+ j 4) keylen))
) )
(display "FOO2!")
(let ((datal 0) (let ((datal 0)
(datar 0)) (datar 0))
@ -1281,7 +1276,7 @@
(dictionary-set-with-index! (blowfish-p bc) i datal) (dictionary-set-with-index! (blowfish-p bc) i datal)
(dictionary-set-with-index! (blowfish-p bc) (+ i 1) datar) (dictionary-set-with-index! (blowfish-p bc) (+ i 1) datar)
) )
(display "FOO3!")
(do ((i 0 (+ 2))) (do ((i 0 (+ 2)))
((>= i 256)0) ((>= i 256)0)
(blowfish-encrypt bc datal datar) (blowfish-encrypt bc datal datar)
@ -1302,7 +1297,7 @@
(blowfish-encrypt bc datal datar) (blowfish-encrypt bc datal datar)
(dictionary-set-with-index! (blowfish-s3 bc) i datal) (dictionary-set-with-index! (blowfish-s3 bc) i datal)
(dictionary-set-with-index! (blowfish-s3 bc) (+ i 1) datar)) (dictionary-set-with-index! (blowfish-s3 bc) (+ i 1) datar))
(display "BAR!")
(do ((i 0 (+ i 1))) (do ((i 0 (+ i 1)))
((>= i 255)0);; ((>= i 255)0);;
(do ((j (+ i 1) (+ j 1))) (do ((j (+ i 1) (+ j 1)))