source: project/release/4/modular-crypt/trunk/implementations/SHA-2/gensalt-sha256.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: 526 bytes
Line 
1(define crypt-sha256-default-rounds (make-parameter 5000))
2
3(define (crypt-sha256-gensalt random #!key rounds)
4  (let ((output (make-string 29)))
5    (if ((foreign-lambda c-pointer "_crypt_gensalt_sha256_rn"
6                         unsigned-long u8vector int scheme-pointer int)
7         (or rounds (crypt-sha256-default-rounds))
8         (get-random-u8vector 'crypt-sha256-gensalt random 16 16) 16 output 29)
9        output
10        ;; TODO: implement proper error handling
11        (error "Error generating SHA-256 salt"))))
Note: See TracBrowser for help on using the repository browser.