diff --git a/scsh/encryption/blowfish.scm b/scsh/encryption/blowfish.scm index 349b011..d784b8d 100644 --- a/scsh/encryption/blowfish.scm +++ b/scsh/encryption/blowfish.scm @@ -1242,12 +1242,13 @@ (dictionary-set! data 1 (vector-ref keyvec (remainder (+ j 2) keylen))) (dictionary-set! data 0 (vector-ref keyvec (remainder (+ j 3) keylen))) )) - (dictionary-set! (blowfish-p bc) i (bitwise-xor - (dictionary-ref-with-index (blowfish-p bc) i) - (+ (dictionary-ref-with-index data 0) - (dictionary-ref-with-index data 1) - (dictionary-ref-with-index data 2) - (dictionary-ref-with-index data 3)))) + (dictionary-set-with-index! (blowfish-p bc) i + (bitwise-xor + (dictionary-ref-with-index (blowfish-p bc) i) + (+ (dictionary-ref-with-index data 0) + (dictionary-ref-with-index data 1) + (dictionary-ref-with-index data 2) + (dictionary-ref-with-index data 3)))) ) (let ((datal 0) @@ -1256,31 +1257,35 @@ (do ((i 0 (+ 2))) ((>= i (+ blowfish-rounds 2))0) (blowfish-encrypt bc datal datar) - (vector-set! (blowfish-p bc) i datal) - (vector-set! (blowfish-p bc) (+ i 1) datar) + (dictionary-set-with-index! (blowfish-p bc) i datal) + (dictionary-set-with-index! (blowfish-p bc) (+ i 1) datar) ) (do ((i 0 (+ 2))) ((>= i 256)0) - (vector-set! (blowfish-s0 bc) i datal) - (vector-set! (blowfish-s0 bc) (+ i 1) datar)) + (blowfish-encrypt bc datal datar) + (dictionary-set-with-index! (blowfish-s0 bc) i datal) + (dictionary-set-with-index! (blowfish-s0 bc) (+ i 1) datar)) (do ((i 0 (+ 2))) ((>= i 256)0) - (vector-set! (blowfish-s1 bc) i datal) - (vector-set! (blowfish-s1 bc) (+ i 1) datar)) + (blowfish-encrypt bc datal datar) + (dictionary-set-with-index! (blowfish-s1 bc) i datal) + (dictionary-set-with-index! (blowfish-s1 bc) (+ i 1) datar)) (do ((i 0 (+ 2))) ((>= i 256)0) - (vector-set! (blowfish-s2 bc) i datal) - (vector-set! (blowfish-s2 bc) (+ i 1) datar)) + (blowfish-encrypt bc datal datar) + (dictionary-set-with-index! (blowfish-s2 bc) i datal) + (dictionary-set-with-index! (blowfish-s2 bc) (+ i 1) datar)) (do ((i 0 (+ 2))) ((>= i 256)0) - (vector-set! (blowfish-s3 bc) i datal) - (vector-set! (blowfish-s3 bc) (+ i 1) datar)) + (blowfish-encrypt bc datal datar) + (dictionary-set-with-index! (blowfish-s3 bc) i datal) + (dictionary-set-with-index! (blowfish-s3 bc) (+ i 1) datar)) (do ((i 0 (+ i 1))) ((>= i 255)0);; (do ((j (+ i 1) (+ j 1))) - (if (or (= (vector-ref (blowfish-s0 bc) i) - (vector-ref (blowfish-s0 bc) j)) + (if (or (= (dictionary-ref-with-index (blowfish-s0 bc) i) + (dictionary-ref-with-index (blowfish-s0 bc) j)) (= (vector-ref (blowfish-s1 bc) i) (vector-ref (blowfish-s1 bc) j)) (= (vector-ref (blowfish-s2 bc) i)