chickadee » message-digest-type

message-digest-type

Documentation

The Message Digest Type provides support for an active message digest primitive.

Usage

(import message-digest-type)

Common Argument Definitions

RESULT-FORM is a message-digest-result-form, one of:

'blob
the result bytes as a blob.
'u8vector
the result bytes as a u8vector.
'hex-string 'hex 'hexstring
the result bytes encoded as a string of lower-case hexadecimal digits.
'string 'byte-string
DEPRECATED - the result bytes as a string; these are raw bytes, not necessarily characters!

DIGEST is a message-digest.

ENDIAN is one of 'big-endian, 'little-endian.

SOURCE is a Scheme object.

The buffer argument for the update phase is translated as:

string
buffer is SOURCE.
blob
buffer is SOURCE.
srfi-4-vector
buffer from (...vector->blob/shared SOURCE).
procedure
updates with buffer from (procedure) until #f.
input-port
like procedure above but from ((message-digest-chunk-read-maker) SOURCE).
pointer
buffer is SOURCE, thru the digest primitive raw-update usually.
*
buffer from (message-digest-chunk-converter SOURCE).

Should none of the above interpretations be available then an error is signaled.

A byte-source is one of string, blob, or srfi-4-vector.

A message-digest-result-type is (or blob string u8vector)

Initialized here means the intialization phase is completed.

message-digest-result-form

message-digest-result-form #!optional RESULT-FORMparameter

The initial RESULT-FORM value is 'hex-string.

A RESULT-FORM of #f resets to the initial value.

reset-message-digest!

reset-message-digest! DIGESTprocedure

Returns the re-initialized DIGEST.

Re-use of the backing objects lowers allocations.

setup-message-digest

setup-message-digest PRIM #!optional CTXprocedure

Returns a new, initialized, message-digest for the default or supplied message-digest-primitive-context CTX.

initialized-message-digest

initialized-message-digest OBJprocedure

Operation when OBJ is a

message-digest-primitive
setup-message-digest
message-digest
reset-message-digest!

ensure-message-digest-buffer!

ensure-message-digest-buffer! DIGEST SIZEprocedure

Ensure the DIGEST has a buffer of at least SIZE bytes.

finalize-message-digest

finalize-message-digest DIGEST #!optional RESULT-FORMprocedure

Finalize the DIGEST and return the result in the RESULT-FORM.

RESULT-FORM
message-digest-result-form ; default (message-digest-result-form).

Finalize here means the finalization phase is completed. The DIGEST is not in a useful state.

finalize-message-digest!

finalize-message-digest! DIGEST BUFFERprocedure

Finalize the DIGEST and return the result in the BUFFER.

The BUFFER must be a string, blob, or u8vector of sufficient size; checked at runtime. Does not perform any initialization of the BUFFER.

The result starts at the beginning of the BUFFER, and runs for (message-digest-primitive-digest-length (message-digest-algorithm DIGEST)) bytes. Result is binary only.

Finalize here means the finalization phase is completed. The DIGEST is not in a useful state.

message-digest?

message-digest? OBJprocedure
check-message-digest LOC OBJ #!optional NAMprocedure
error-message-digest LOC OBJ #!optional NAMprocedure

message-digest-algorithm

message-digest-algorithm DIGESTprocedure

Returns the message-digest algorithm object representation used by this DIGEST.

Mostly for use when developing an update operation.

message-digest-context

message-digest-context DIGESTprocedure

Returns the message-digest algorithm object opaque-data object used by this DIGEST.

Mostly for use when developing an update operation.

Requirements

check-errors blob-utils string-utils

Author

Kon Lovett

Repository

This egg is hosted on the CHICKEN Subversion repository:

https://anonymous@code.call-cc.org/svn/chicken-eggs/release/5/message-digest-type

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
Deprecate initialize-message-digest/initialize-message-digest!. Add setup-message-digest/reset-message-digest!.
4.2.0
Add message-digest-type.types.scm.
4.1.0
Add initialize-message-digest!, fix message-digest-result-form.
4.0.1
Add tests & type checking.
4.0.0
CHICKEN 5 release as own egg.

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.

Contents »