source: project/release/4/sha1/trunk/sha1.scm @ 15609

Last change on this file since 15609 was 15609, checked in by Kon Lovett, 11 years ago

Initial save.

  • Property svn:executable set to *
File size: 971 bytes
Line 
1;;;; sha1.scm
2
3(declare
4  (fixnum)
5  (no-procedure-checks) )
6
7(module sha1 (;export
8  binary-digest
9  digest
10  primitive)
11
12  (import scheme chicken foreign)
13  (require-extension message-digest)
14
15#>
16#include "sha1-base.c"
17<#
18
19;;
20
21(define-foreign-variable context-size int "sizeof(sha1_context)")
22
23(define starts (foreign-lambda void "sha1_starts" c-pointer))
24(define update (foreign-lambda void "sha1_update" c-pointer pointer int))
25(define finish (foreign-lambda void "sha1_finish" c-pointer pointer))
26
27(define-constant digest-length 20)
28
29;;
30
31(define (binary-digest obj)
32  (make-binary-message-digest obj
33    context-size digest-length
34    starts update finish
35    'sha1#binary-digest) )
36
37(define (digest obj)
38  (make-message-digest obj
39    context-size digest-length
40    starts update finish
41    'sha1#digest) )
42
43(define (primitive)
44  (make-message-digest-primitive
45    context-size digest-length
46    starts update finish
47    (gensym 'sha1#primitive)) )
48
49) ;module sha1
Note: See TracBrowser for help on using the repository browser.