General Purpose Hashing

Index

hash/bytes hash/bytes-max hash/bytes-min hash/context-bytes hash/final hash/hash hash/key-bytes hash/keygen hash/new-state hash/update

Reference

hash/bytesnumber 32

Number of bytes in a generic, simple hash.

hash/bytes-maxnumber 65535

Maximum number of bytes allowed when creating a keyed hash.

Minimum number of bytes allowed when creating a keyed hash.

Number of bytes required in context buffer for hashing.

hash/finalcfunction
(hash/final state len)

Get the final hash after digesting all of the input as a string. The resulting hash will be a string of length len.

hash/hashcfunction
(hash/hash size input ctx &opt key)

Hash some input bytes into an output string of length size. Optionally provide a key that can be used to generate different hashes on the same input.

Number of bytes in a key required for hashing.

hash/keygencfunction
(hash/keygen &opt buf)

Generate a key suitable for use in hashing. The key is a buffer of at least 32 bytes. If a buffer buf is provided, the first 32 bytes of buf will be set to a new random key. Returns a key buffer.

(hash/new-state ctx key)

Create a new hash-state. Takes a context ctx and a key and returns a new abstract type, jhydro/hash-state. Both ctx and key should be byte sequences, of at least lengths 8 and 32 respectively. Returns the new state.

hash/updatecfunction
(hash/update state bytes)

Add more bytes to the hash state. Returns the modified state