~/bend-docscommunity

inst_sha2.bend checks

raw source on the hub · import bend-osdev-crypto@0.1.0.0/inst_sha2.bend as Inst_sha2

SHA-256 and SHA-512 (FIPS 180-4) as hashes: bend-collections' hashes, adapted to Octets. The code is bend-collections@1.0.0.0's src/crypto (hash.bend and the sha, sha512 and keccak files it imports), imported from bend-collections-laws-crypto@1.0.0.0, which ships the same files with their proofs: Bend names a def by the package it comes from, so those proofs (Split.sha256, Incremental.sha256, Sha256.length, ...) are about that package's copy, and this adapter uses it so that LAWS.bend can cite them. No other file of bend-osdev sees bend-collections' types: the state is wrapped in CrSha2State, and bytes cross as Octets.

The instances (block size 64 and 128 bytes, digest 32 and 64): ~CrSha2State, ~64n, ~32n, ~CrSha2.init256(), ~CrSha2.update, ~CrSha2.final, ~CrSha2.sha256 ~CrSha2State, ~128n, ~64n, ~CrSha2.init512(), ~CrSha2.update, ~CrSha2.final, ~CrSha2.sha512

3 imports
import Base
import bend-osdev-bytes@0.1.0.0/bytes.bend as B
import bend-collections-laws-crypto@1.0.0.0/src/crypto/hash.bend as Hc

Types

type CrSha2State source · line 22 · raw

Data

A hash state (opaque): which hash, its chaining value, the bytes of the unfinished block, and the length so far

Definitions

def CrSha2.init256 source · line 25 · raw

CrSha2State

def CrSha2.init512 source · line 28 · raw

CrSha2State

def CrSha2.update source · line 32 · raw

@s:CrSha2State -> @o:0x9df7f91779a4a1c215bfa96cd0864601/bytes.Octets -> CrSha2State

the state after more bytes (either hash: the state knows which it is)

def CrSha2.final source · line 38 · raw

@s:CrSha2State -> 0x9df7f91779a4a1c215bfa96cd0864601/bytes.Octets

the digest of the bytes so far

def CrSha2.sha256 source · line 44 · raw

@o:0x9df7f91779a4a1c215bfa96cd0864601/bytes.Octets -> 0x9df7f91779a4a1c215bfa96cd0864601/bytes.Octets

The digests in one call

def CrSha2.sha512 source · line 47 · raw

@o:0x9df7f91779a4a1c215bfa96cd0864601/bytes.Octets -> 0x9df7f91779a4a1c215bfa96cd0864601/bytes.Octets