source: project/wiki/eggref/5/sha1 @ 36634

Last change on this file since 36634 was 36634, checked in by kon, 2 months ago

doc the api module (late - 4.1 in jul '18)

File size: 2.8 KB
Line 
1[[tags: egg]]
2
3== sha1
4
5[[toc:]]
6
7
8== Documentation
9
10Computes SHA1 (FIPS-180-1) checksums
11
12See [[message-digest-primitive]] for more information.
13
14=== SHA1 API
15
16Component export
17
18== Usage
19
20<enscript language=scheme>
21(use sha1-api)
22</enscript>
23
24==== Constants
25
26; name : algorithm name ; {{symbol}}
27; version : algorithm version ; {{string}}
28; context-size : context byte length ; {{fixnum}}
29; digest-length : final byte length ; {{fixnum}}
30; block-length : buffer byte length ; {{fixnum}}
31
32Note that {{block-length}} is informational only.
33
34==== init
35
36<procedure>(init CTX)</procedure>
37
38Initializes a SHA1 {{CTX}}, with at least {{context-size}} byte size.
39
40==== update
41
42<procedure>(update CTX OBJ LEN)</procedure>
43
44Accumulate {{LEN}} bytes from the Scheme {{OBJ}} into {{CTX}}.
45
46==== raw-update
47
48<procedure>(raw-update CTX PTR LEN)</procedure>
49
50Accumulate {{LEN}} bytes from the byte {{PTR}} into {{CTX}}.
51
52==== final
53
54<procedure>(final CTX OBJ)</procedure>
55
56Finalize the {{CTX}} into a Scheme {{OBJ}} with at least {{digest-length}}
57byte size. The target is usually a {{blob}}, {{u8vector}}, or {{string}}.
58
59=== SHA1 Primitive
60
61Packaged export
62
63== Usage
64
65<enscript language=scheme>
66(use sha1-primitive)
67</enscript>
68
69==== sha1-primitive
70
71<procedure>(sha1-primitive) -> message-digest-primitive</procedure>
72
73Returns the SHA1 checksum digest primitive object.
74
75== Example
76
77<enscript highlight="scheme">
78(use sha1-primitive message-digest-byte-vector)
79
80(message-digest-string (sha1-primitive) "abc")
81 ;=> "a9993e364706816aba3e25717850c26c9cd0d89d"
82</enscript>
83
84
85== Usage
86
87<enscript language=scheme>
88(use sha1)
89</enscript>
90
91
92== Requirements
93
94[[message-digest-primitive|message-digest-primitive]]
95
96
97== Notes
98
99* For use with the [[message-digest|message-digest]] extensions.
100
101
102== Author
103
104Steve Reid, packaged for Chicken by Peter Bex, C5 by [[kon lovett]]
105
106
107== Version history
108
109; 4.1.0 : Split into appi & primitive modules.
110; 4.0.0 : CHICKEN 5 release.
111; 3.2.0 : Add raw-update. [[/users/kon-lovett|Kon Lovett]]
112; 3.1.0 : Add block-length. [[/users/kon-lovett|Kon Lovett]]
113; 3.0.0 : Remove deprecated procedures. [[/users/kon-lovett|Kon Lovett]]
114; 2.3 : Make function declarations {{static}} in order to avoid conflicts with those from libc if the OS supplies them. This makes SHA-1 work on OpenBSD (thanks to Alan Post and Christian Kellermann)
115; 2.2.2 : Change deprecated {{pointer}} foreign type specifier to {{scheme-pointer}} to make it work under chickens newer than 4.6.0.
116; 2.2.1 : Fix for test, wrong context allocation size. [[/users/kon-lovett|Kon Lovett]]
117; 2.2 : a {{message-digest-primitive}} has no "state". [[/users/kon-lovett|Kon Lovett]]
118; 2.1 : Replaced GPL code with common public domain code.
119; 2.0.0 : Initial Chicken 4 release [[/users/kon-lovett|Kon Lovett]]
120
121
122== License
123
124  SHA-1 in C
125  By Steve Reid <steve@edmweb.com>
126  100% Public Domain
Note: See TracBrowser for help on using the repository browser.