blowfish fixes - 10

This commit is contained in:
erana 2012-01-20 18:45:06 +09:00
parent c454f93410
commit 1ed85e4f95
2 changed files with 9 additions and 11 deletions

View File

@ -1213,11 +1213,9 @@
(define (blowfish-set-key bc keyvec keylen) ;; NOTE key is a table (define (blowfish-set-key bc keyvec keylen) ;; NOTE key is a table
(let ((data (make-dictionary 256))) (let ((data (make-dictionary 256)))
(do ((i 0 (+ i 1))) (do ((i 0 (+ i 1)))
((>= i (+ blowfish-rounds 2))0) ((>= i (+ blowfish-rounds 2))0)
(dictionary-set! (blowfish-p bc) i (dictionary-ref blowfish-ps i))) (dictionary-set-with-index! (blowfish-p bc) i (dictionary-ref-with-index blowfish-ps i)))
(do ((i 0 (+ i 1))) (do ((i 0 (+ i 1)))
((>= i 256)0) ((>= i 256)0)
(dictionary-set-with-index! (blowfish-s0 bc) i (dictionary-ref-with-index blowfish-ks0 i)) (dictionary-set-with-index! (blowfish-s0 bc) i (dictionary-ref-with-index blowfish-ks0 i))
@ -1225,7 +1223,6 @@
(dictionary-set-with-index! (blowfish-s2 bc) i (dictionary-ref-with-index blowfish-ks2 i)) (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)) (dictionary-set-with-index! (blowfish-s3 bc) i (dictionary-ref-with-index blowfish-ks3 i))
) )
(do ((i 0 (+ i 1)) (do ((i 0 (+ i 1))
(j 0 (+ j 1))) (j 0 (+ j 1)))
((>= i (+ blowfish-rounds 2))0) ((>= i (+ blowfish-rounds 2))0)
@ -1250,7 +1247,7 @@
(dictionary-ref-with-index data 2) (dictionary-ref-with-index data 2)
(dictionary-ref-with-index data 3)))) (dictionary-ref-with-index data 3))))
) )
(display "BAR!")
(let ((datal 0) (let ((datal 0)
(datar 0)) (datar 0))

View File

@ -50,12 +50,13 @@
(if (>= i (length *dict)) (if (>= i (length *dict))
(begin (display "dictionary - set - index out of range") (begin (display "dictionary - set - index out of range")
0) 0)
(do ((j 0 (+ j 1)) (let ((lf '()))
(l *dict (cdr l))) (do ((j 0 (+ j 1))
((= j i) (l *dict (cdr l)))
(display "FOO!") ((= j i)
(set-car! l value));;sets value FIXME (set! *dict (append lf (list value) (cdr l))));;sets value FIXME
))) (set! lf (append lf (list (car l))))
))))
(define (get-substring key) ;; get key (define (get-substring key) ;; get key
(do ((l *dict (cdr l))) (do ((l *dict (cdr l)))