Changeset 36634 in project


Ignore:
Timestamp:
09/17/18 15:38:22 (2 months ago)
Author:
kon
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/5/sha1

    r35962 r36634  
    1212See [[message-digest-primitive]] for more information.
    1313
     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
    1469==== sha1-primitive
    1570
     
    1873Returns the SHA1 checksum digest primitive object.
    1974
     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
    2084
    2185== Usage
     
    2387<enscript language=scheme>
    2488(use sha1)
    25 </enscript>
    26 
    27 
    28 == Examples
    29 
    30 <enscript highlight="scheme">
    31 (use sha1 message-digest-byte-vector)
    32 
    33 (message-digest-string (sha1-primitive) "abc")
    34  ;=> "a9993e364706816aba3e25717850c26c9cd0d89d"
    3589</enscript>
    3690
     
    53107== Version history
    54108
     109; 4.1.0 : Split into appi & primitive modules.
    55110; 4.0.0 : CHICKEN 5 release.
    56111; 3.2.0 : Add raw-update. [[/users/kon-lovett|Kon Lovett]]
Note: See TracChangeset for help on using the changeset viewer.