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?
message-digest-primitive accessors
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 thecontext-object, which should be unique. At least the object cannot be shared with another activated primitive.positive-fixnum: a memory-block of lengthCONTEXT-INFObytes is allocated; the memory is automatically free'ed. Thecontext-objecthere is a {pointer}} to a block of uninitialized memory.
DIGEST-SIZEpositive-fixnum
- The count of bytes in the result.
INIT(CONTEXT -> void))
- sets up the
CONTEXT.
UPDATE#for(CONTEXT SOURCE COUNT -> void))
- Must accumulate the
SOURCE, beginning at0, forCOUNTbytes. Will be called zero or more times.SOURCEis usually a(or bytevector string)object. COUNTis the actual number of bytes in theSOURCE. Only the firstCOUNTbytes in theSOURCEare valid.COUNTis apositive-fixnum.- when
#f&RAW-UPDATEthen anUPDATEis 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 leastDIGEST-SIZE.DESTINATIONis usually abytevectorobject.
RAW-UPDATE(CONTEXT POINTER COUNT -> void)).
- When
UPDATEis#fRAW-UPDATEmust be defined. - Must accumulate the memory at
POINTER, beginning at0, forCOUNTbytes. Will be called zero or more times. COUNTis the actual number of bytes in theSOURCE. Only the firstCOUNTbytes in the memory atPOINTERare valid.COUNTis apositive-fixnum.
BLOCK-LENGTHpositive-fixnum; default4
- The primitive's accumulator length in bytes.
NAME(or symbol string); defaultuninterned-symbol.
- Identifies the message digest algorithm. The suggested form is
<algorithm>-primitive,'md5-primitivefor 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.4.0
- CHICKEN 6 release.
License
Copyright (C) 2006-2026 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.