sha2

  1. sha2
  2. Documentation
    1. SHA256 API
      1. Usage
      2. Constants
      3. init
      4. update
      5. raw-update
      6. final
    2. SHA256 Primitive
      1. Usage
      2. sha256-primitive
    3. SHA384 API
      1. Usage
      2. Constants
      3. init
      4. update
      5. raw-update
      6. final
    4. SHA384 Primitive
      1. Usage
      2. sha384-primitive
    5. SHA512 API
      1. Usage
      2. Constants
      3. init
      4. update
      5. raw-update
      6. final
    6. SHA512 Primitive
      1. Usage
      2. sha512-primitive
  3. Usage
  4. Examples
  5. Notes
  6. Requirements
  7. Author
  8. Repository
  9. Version history
  10. License

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

[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-primitive

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

[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-primitive

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

[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-primitive

Returns the SHA512 checksum digest primitive object.

Usage

(import sha2)

Examples

(import sha256-primitive message-digest-byte-vector)

(message-digest-string (sha256-primitive) "abc")
;=> "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad"

Notes

Requirements

message-digest-primitive

srfi-1 srfi-13 message-digest-utils test

Author

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.