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
(let ((data (make-dictionary 256)))
(do ((i 0 (+ i 1)))
((>= 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)))
((>= i 256)0)
(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-s3 bc) i (dictionary-ref-with-index blowfish-ks3 i))
)
(do ((i 0 (+ i 1))
(j 0 (+ j 1)))
((>= i (+ blowfish-rounds 2))0)
@ -1250,7 +1247,7 @@
(dictionary-ref-with-index data 2)
(dictionary-ref-with-index data 3))))
)
(display "BAR!")
(let ((datal 0)
(datar 0))

View File

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