message-digest-primitive
Documentation
The Message Digest Primitive Type; reification of a message digest algorithm.
Usage
(import message-digest-primitive)
Common Argument Definitions
PRIM is a message-digest-primitive
message-digest-primitive?
[procedure] (message-digest-primitive? OBJ) --> boolean[procedure] (check-message-digest-primitive LOC OBJ [NAM])
[procedure] (error-message-digest-primitive LOC OBJ [NAM])
message-digest-primitive Accessors
[procedure] (message-digest-primitive-context-info PRIM) --> *[procedure] (message-digest-primitive-digest-length PRIM) --> fixnum
[procedure] (message-digest-primitive-init PRIM) --> procedure
[procedure] (message-digest-primitive-update PRIM) --> procedure
[procedure] (message-digest-primitive-raw-update PRIM) --> (or #f procedure)
[procedure] (message-digest-primitive-final PRIM) --> procedure
[procedure] (message-digest-primitive-block-length PRIM) --> fixnum
[procedure] (message-digest-primitive-name PRIM) --> symbol
make-message-digest-primitive
[procedure] (make-message-digest-primitive CONTEXT-INFO DIGEST-SIZE INIT UPDATE FINAL [block-length 4] [name 'mdp] [raw-update #f]) -> message-digest-primitiveCreate a message-digest-primitive object, defining a message digest algorithm.
The processing of a message digest is split into three phases: initialization, update, & finalization. These are represented by procedures: INIT, UPDATE | RAW-UPDATE, & FINAL, respectively.
- CONTEXT-INFO
- (or (CONTEXT-INFO -> context-object) positive-fixnum)
- (CONTEXT-INFO -> CONTEXT) ; returns the context-object, which should be unique. At least the object cannot be shared with another activated primitive.
- positive-fixnum : a memory-block of length CONTEXT-INFO bytes is allocated; the memory is automatically free'ed. The context-object here is a {pointer}} to a block of uninitialized memory.
- DIGEST-SIZE
- positive-fixnum
- The count of bytes in the result.
- INIT
- (CONTEXT -> void))
- sets up the CONTEXT.
- UPDATE
- #f or (CONTEXT SOURCE COUNT -> void))
- Must accumulate the SOURCE, beginning at 0, for COUNT bytes. Will be called zero or more times. SOURCE is usually a (or blob string) object.
- COUNT is the actual number of bytes in the SOURCE. Only the first COUNT bytes in the SOURCE are valid. COUNT is a positive-fixnum.
- when #f & RAW-UPDATE then an UPDATE is built, otherwise an error.
- FINAL
- (CONTEXT DESTINATION -> void)).
- Must build the message-digest result in the supplied result DESTINATION, which will have a byte-count of at least DIGEST-SIZE. DESTINATION is usually a (or blob string) object.
- RAW-UPDATE
- (CONTEXT POINTER COUNT -> void)).
- When UPDATE is #f RAW-UPDATE must be defined.
- Must accumulate the memory at POINTER, beginning at 0, for COUNT bytes. Will be called zero or more times.
- COUNT is the actual number of bytes in the SOURCE. Only the first COUNT bytes in the memory at POINTER are valid. COUNT is a positive-fixnum.
- BLOCK-LENGTH
- positive-fixnum ; default 4
- The primitive's accumulator length in bytes.
- NAME
- (or symbol string) ; default uninterned-symbol.
- Identifies the message digest algorithm. The suggested form is <algorithm>-primitive, 'md5-primitive for example.
make-message-digest-primitive-context
[procedure] (make-message-digest-primitive-context PRIM) -> *Returns a message-digest-primitive-context object, used by a message digest algorithm.
Requirements
Author
Repository
This egg is hosted on the CHICKEN Subversion repository:
https://anonymous@code.call-cc.org/svn/chicken-eggs/release/5/message-digest-primitive
If you want to check out the source code repository of this egg and you are not familiar with Subversion, see this page.
Version history
- 4.3.0
- Add message-digest-primitive.types.scm.
- 4.2.1
- .
- 4.2.0
- Add make missing update procedure from raw-update procedure argument.
- 4.1.0
- Fix make-message-digest-primitive-context argument.
- 4.0.0
- CHICKEN 5 release as own egg.
- 3.9.0
- Add types.
- 3.8.0
- Fix message-digest-primitive?; accept *.
- 3.7.1
- 3.7.0
- Add message-digest-object!, message-digest-file!, and message-digest-port!.
- 3.6.0
- Add START and/or END optional arguments.
- 3.5.0
- Add finalize-message-digest!.
- 3.4.0
- Deprecate message-digest-chunk-read-maker. Add message-digest-chunk-port-read-maker, message-digest-chunk-fileno-read-maker. Add message-digest-primitive-raw-update.
- 3.3.0
- Deprecate message-digest-default-result-type. Add message-digest-result-form.
- 3.2.0
- Add message-digest-default-result-type. message-digest-chunk-* are parameters.
- 3.1.1
- Fix check-u8vector import.
- 3.1.0
- Added optional message-digest-primitive-block-length.
- 3.0.5
- Reverted 64 bit support.
- 3.0.4
- Removed 64 bit support.
- 3.0.3
- 3.0.2
- Use of compiled setup-helper.
- 3.0.1
- 3.0.0
- Removed deprecated procedures to own module. Removed integer packing procedures. Split into many modules. Deprecated some procedures.
- 2.3.8
- Treat integers as unsigned. (Ticket #534) Uses blob for finalization result buffer.
- 2.3.7
- Remove no checks optimization compier options.
- 2.3.6
- Deprecated close-output-digest. Restricted no checks optimization compier option.
- 2.3.5
- The 'u8vector RESULT-FORM is slightly faster. Revert to allocated context memory.
- 2.3.4
- Try w/o C-level memory allocation so no finalizer needed.
- 2.3.3
- The 'blob RESULT-FORM is slightly faster.
- 2.3.2
- Deprecated byte-string->hexadecimal. Deprecated string->hex, use string-utils string-hexadecimal#string->hex. Fix for the default message-digest-chunk-read-maker, blob was always chunk-size.
- 2.3.1
- Moved some utility routines into own egg(s).
- 2.3.0
- Added message-digest-update-char-u8, message-digest-update-char-be, and message-digest-update-char-le. message-digest-update-char now treats the actual bit-width of char correctly.
- 2.2.0
- Added Byte Packing API. Downgraded message-digest-chunk-read-maker, message-digest-chunk-size & message-digest-chunk-converter from parameter.
- 2.1.1
- Bug fix for hexstring: must use lowercase.
- 2.1.0
- Added message digest "phase" and port APIs. Deprecated old API.
- 2.0.1
- Bug fix for (message-digest-chunk-converter) use by make-binary-message-digest.
- 2.0.0
- Release for Chicken 4 [From a diff provided by Christian Kellermann]
License
Copyright (C) 2006-2020 Kon Lovett. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the Software), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED ASIS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.