sha2
TOC »
Documentation
Computes SHA2 checksums
See message-digest-primitive for more information.
SHA256 API
Component export
Usage
(import sha256-api)
Constants
- name
- algorithm name ; symbol
- version
- algorithm version ; string
- context-size
- context byte length ; fixnum
- digest-length
- final byte length ; fixnum
- block-length
- buffer byte length ; fixnum
Note that block-length is informational only.
init
- init CTXprocedure
Initializes a SHA256 CTX, with at least context-size byte size.
update
- update CTX OBJ LENprocedure
Accumulate LEN bytes from the Scheme OBJ into CTX.
raw-update
- raw-update CTX PTR LENprocedure
Accumulate LEN bytes from the byte PTR into CTX.
final
- final CTX OBJprocedure
Finalize the CTX into a Scheme OBJ with at least digest-length byte size. The target is usually a blob, u8vector, or string.
SHA256 Primitive
Packaged export
Usage
(import sha256-primitive)
sha256-primitive
- sha256-primitiveprocedure
Returns the SHA256 checksum digest primitive object.
SHA384 API
Component export
Usage
(import sha384-api)
Constants
- name
- algorithm name ; symbol
- version
- algorithm version ; string
- context-size
- context byte length ; fixnum
- digest-length
- final byte length ; fixnum
- block-length
- buffer byte length ; fixnum
Note that block-length is informational only.
init
- init CTXprocedure
Initializes a SHA384 CTX, with at least context-size byte size.
update
- update CTX OBJ LENprocedure
Accumulate LEN bytes from the Scheme OBJ into CTX.
raw-update
- raw-update CTX PTR LENprocedure
Accumulate LEN bytes from the byte PTR into CTX.
final
- final CTX OBJprocedure
Finalize the CTX into a Scheme OBJ with at least digest-length byte size. The target is usually a blob, u8vector, or string.
SHA384 Primitive
Packaged export
Usage
(import sha384-primitive)
sha384-primitive
- sha384-primitiveprocedure
Returns the SHA384 checksum digest primitive object.
SHA512 API
Component export
Usage
(import sha512-api)
Constants
- name
- algorithm name ; symbol
- version
- algorithm version ; string
- context-size
- context byte length ; fixnum
- digest-length
- final byte length ; fixnum
- block-length
- buffer byte length ; fixnum
Note that block-length is informational only.
init
- init CTXprocedure
Initializes a SHA512 CTX, with at least context-size byte size.
update
- update CTX OBJ LENprocedure
Accumulate LEN bytes from the Scheme OBJ into CTX.
raw-update
- raw-update CTX PTR LENprocedure
Accumulate LEN bytes from the byte PTR into CTX.
final
- final CTX OBJprocedure
Finalize the CTX into a Scheme OBJ with at least digest-length byte size. The target is usually a blob, u8vector, or string.
SHA512 Primitive
Packaged export
Usage
(import sha512-primitive)
sha512-primitive
- sha512-primitiveprocedure
Returns the SHA512 checksum digest primitive object.
Usage
(import sha2)
Examples
- Note the message-digest-utils egg is a dependency for the example.
(import sha256-primitive message-digest-byte-vector) (message-digest-string (sha256-primitive) "abc") ;=> "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad"
Notes
- The ...-primitive API is for use with the message-digest extensions. And the ...-api API implements the ...-primitive API. One packages the algorithm as a record, the other a module.
- From the 4.2.0 version importing/loading any combination of sha2 modules increases the allocation. The assumption is one or the other but not both.
Requirements
- Note test dependencies only. The egg runtime does not depend on these.
srfi-1 srfi-13 message-digest-utils test
Author
- Aaron D. Gifford, wrapped for Chicken by Daishi Kato
- C5 by Kon Lovett
Repository
This egg is hosted on the CHICKEN Subversion repository:
https://anonymous@code.call-cc.org/svn/chicken-eggs/release/5/sha2
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.2.3
- Add SHA2 testvectors test.
- 4.2.2
- Upstream SHA2 1.0.1 integration.
- 4.2.1
- Update test runner.
- 4.2.0
- Separate api & primitive binaries per bit-count.
- 4.1.0
- Split into api & primitive modules.
- 4.0.0
- CHICKEN 5 release.
- 3.2.0
- Add raw-update. Kon Lovett
- 3.1.0
- Add block-length. Kon Lovett
- 3.0.0
- Remove deprecated procedures. Kon Lovett
- 2.1.1
- Change deprecated pointer foreign type specifier to scheme-pointer to make it work under chickens newer than 4.6.0.
- 2.0.1
- a message-digest-primitive has no "state". Kon Lovett
- 2.0.1
- fix for #163 (Mario Domenech Goulart)
- 2.0.0
- Initial Chicken 4 release Kon Lovett
License
Copyright (c) 2000-2001, Aaron D. Gifford and Daishi Kato All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTOR(S) ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.