You are looking at historical revision 40568 of this page. It may differ significantly from its current revision.
sha2
Documentation
Computes SHA2 checksums
See message-digest-primitive for more information.
SHA256 API
Component export
Usage
(use 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
[procedure] (init CTX)Initializes a SHA256 CTX, with at least context-size byte size.
update
[procedure] (update CTX OBJ LEN)Accumulate LEN bytes from the Scheme OBJ into CTX.
raw-update
[procedure] (raw-update CTX PTR LEN)Accumulate LEN bytes from the byte PTR into CTX.
final
[procedure] (final CTX OBJ)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
[procedure] (sha256-primitive) -> message-digest-primitiveReturns the SHA256 checksum digest primitive object.
SHA384 API
Component export
Usage
(use 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
[procedure] (init CTX)Initializes a SHA384 CTX, with at least context-size byte size.
update
[procedure] (update CTX OBJ LEN)Accumulate LEN bytes from the Scheme OBJ into CTX.
raw-update
[procedure] (raw-update CTX PTR LEN)Accumulate LEN bytes from the byte PTR into CTX.
final
[procedure] (final CTX OBJ)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
[procedure] (sha384-primitive) -> message-digest-primitiveReturns the SHA384 checksum digest primitive object.
SHA512 API
Component export
Usage
(use 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
[procedure] (init CTX)Initializes a SHA512 CTX, with at least context-size byte size.
update
[procedure] (update CTX OBJ LEN)Accumulate LEN bytes from the Scheme OBJ into CTX.
raw-update
[procedure] (raw-update CTX PTR LEN)Accumulate LEN bytes from the byte PTR into CTX.
final
[procedure] (final CTX OBJ)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
[procedure] (sha512-primitive) -> message-digest-primitiveReturns the SHA512 checksum digest primitive object.
Usage
(import sha2)
Examples
(import sha256-primitive message-digest-byte-vector) (message-digest-string (sha256-primitive) "abc") ;=> "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad"
Requirements
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.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.