diff --git a/scsh/encryption/blowfish.scm b/scsh/encryption/blowfish.scm index b015709..7a2f246 100644 --- a/scsh/encryption/blowfish.scm +++ b/scsh/encryption/blowfish.scm @@ -1158,9 +1158,9 @@ (vector-ref (blowfish-s3 blowfish-context) 0)))) (define blowfish-F (if BIG-ENDIAN-HOST blowfish-F-be blowfish-F-le)) ;; FIXME default is big endian -(define (blowfish-R l r i) - (set! l (bitwise-xor l (dictionary-ref (blowfish-p blowfish-context) i))) - (set! r (bitwise-xor r ((dictionary-ref (blowfish-p blowfish-context) blowfish-F l))))) +(define (blowfish-R bc l r i) + (set! l (bitwise-xor l (dictionary-ref (blowfish-p bc) i))) + (set! r (bitwise-xor r ((dictionary-ref (blowfish-p bc) blowfish-F l))))) ;; blowfish-rounds == 16 -> (define (blowfish-encrypt bc ret_xl ret_xr) ;; NOTE bc = blowfish-context @@ -1173,22 +1173,22 @@ ;;(s3 (blowfish-s3 bc)) ) - (blowfish-R xl xr 0) - (blowfish-R xr xl 1) - (blowfish-R xl xr 2) - (blowfish-R xr xl 3) - (blowfish-R xl xr 4) - (blowfish-R xr xl 5) - (blowfish-R xl xr 6) - (blowfish-R xr xl 7) - (blowfish-R xl xr 8) - (blowfish-R xr xl 9) - (blowfish-R xl xr 10) - (blowfish-R xr xl 11) - (blowfish-R xl xr 12) - (blowfish-R xr xl 13) - (blowfish-R xl xr 14) - (blowfish-R xr xl 15) + (blowfish-R bc xl xr 0) + (blowfish-R bc xr xl 1) + (blowfish-R bc xl xr 2) + (blowfish-R bc xr xl 3) + (blowfish-R bc xl xr 4) + (blowfish-R bc xr xl 5) + (blowfish-R bc xl xr 6) + (blowfish-R bc xr xl 7) + (blowfish-R bc xl xr 8) + (blowfish-R bc xr xl 9) + (blowfish-R bc xl xr 10) + (blowfish-R bc xr xl 11) + (blowfish-R bc xl xr 12) + (blowfish-R bc xr xl 13) + (blowfish-R bc xl xr 14) + (blowfish-R bc xr xl 15) (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))))) @@ -1209,22 +1209,22 @@ ;; (s3 (blowfish-s3 bc)) ) - (blowfish-R xl xr 17) - (blowfish-R xr xl 16) - (blowfish-R xl xr 15) - (blowfish-R xr xl 14) - (blowfish-R xl xr 13) - (blowfish-R xr xl 12) - (blowfish-R xl xr 11) - (blowfish-R xr xl 10) - (blowfish-R xl xr 9) - (blowfish-R xr xl 8) - (blowfish-R xl xr 7) - (blowfish-R xr xl 6) - (blowfish-R xl xr 5) - (blowfish-R xr xl 4) - (blowfish-R xl xr 3) - (blowfish-R xr xl 2) + (blowfish-R bc xl xr 17) + (blowfish-R bc xr xl 16) + (blowfish-R bc xl xr 15) + (blowfish-R bc xr xl 14) + (blowfish-R bc xl xr 13) + (blowfish-R bc xr xl 12) + (blowfish-R bc xl xr 11) + (blowfish-R bc xr xl 10) + (blowfish-R bc xl xr 9) + (blowfish-R bc xr xl 8) + (blowfish-R bc xl xr 7) + (blowfish-R bc xr xl 6) + (blowfish-R bc xl xr 5) + (blowfish-R bc xr xl 4) + (blowfish-R bc xl xr 3) + (blowfish-R bc xr xl 2) (let ((xl (bitwise-xor xl (vector-ref (blowfish-p bc) 1))) (xr (bitwise-xor xr (vector-ref (blowfish-p bc) 0)))) @@ -1260,7 +1260,7 @@ (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 "FOO!") + ;;(display "FOO") (dictionary-set-with-index! (blowfish-p bc) i (bitwise-xor (dictionary-ref-with-index (blowfish-p bc) i)