source: project/release/4/modular-crypt/trunk/implementations/blowfish/gensalt.scm @ 22216

Last change on this file since 22216 was 22216, checked in by sjamaan, 9 years ago

Add initial code for crypt egg

File size: 618 bytes
Line 
1(foreign-declare "#include \"implementations/blowfish/gensalt_blowfish.c\"")
2
3(define crypt-blowfish-default-logrounds (make-parameter 12))
4
5(define (crypt-blowfish-gensalt random #!key rounds)
6  (let ((output (make-string 29)))
7    (if ((foreign-lambda c-pointer "_crypt_gensalt_blowfish_rn"
8                         unsigned-long u8vector int scheme-pointer int)
9         (or rounds (crypt-blowfish-default-logrounds))
10         (get-random-u8vector 'crypt-blowfish-gensalt random 16 16) 16 output 29)
11        output
12        ;; TODO: implement proper error handling
13        (error "Error generating blowfish salt"))))
Note: See TracBrowser for help on using the repository browser.