author | Olivier Brunel
<jjk@jjacky.com> 2023-03-26 14:30:48 UTC |
committer | Olivier Brunel
<jjk@jjacky.com> 2023-03-26 14:54:40 UTC |
parent | 96e372eb86e5367bcb654650dae1dd915713cf49 |
doc/buffer_putmsg.3.md | +1 | -1 |
doc/hasher_hash.3.md | +18 | -2 |
doc/hasher_sha3_224.h.0.md | +25 | -0 |
doc/hasher_sha3_256.h.0.md | +25 | -0 |
doc/hasher_sha3_384.h.0.md | +25 | -0 |
doc/hasher_sha3_512.h.0.md | +25 | -0 |
doc/hlookup.3.md | +1 | -1 |
doc/hlookup.h.0.md | +1 | -1 |
doc/{sha3.3.md => sha3_224_init.3.md} | +6 | -1 |
diff --git a/doc/buffer_putmsg.3.md b/doc/buffer_putmsg.3.md index febe7ca..ac924d4 100644 --- a/doc/buffer_putmsg.3.md +++ b/doc/buffer_putmsg.3.md @@ -60,7 +60,7 @@ dump, as described on [buffer_puthex](3). ! ! : *PUTMSG_HEX(`data`,`dlen`)*, *HEX(`data`,`dlen`)* ! :: Shorthand to easily add a blob/byte array whose content shall be written -! :: out :: in hexadecimal form into a message. This is intended for use in a +! :: out in hexadecimal form into a message. This is intended for use in a ! :: coma-separated, as it expands to: ! :: `PUTMSG_HEX_NEXT, data, PUTMSG_ASUINT(dlen)` diff --git a/doc/hasher_hash.3.md b/doc/hasher_hash.3.md index 7f569ba..b015286 100644 --- a/doc/hasher_hash.3.md +++ b/doc/hasher_hash.3.md @@ -20,7 +20,7 @@ void hasher_hash(void *<em>digest</em>, const void *<em>msg</em>, size_t <em>mle # DESCRIPTION A hasher is a structure containing all required information to compute a message -digest for a given algorithm. It is defined as such : +digest with a given algorithm. It is defined as such : typedef void (*hasher_init) (void *ctx); typedef void (*hasher_update) (const void *msg, size_t mlen, void *ctx); @@ -35,7 +35,7 @@ digest for a given algorithm. It is defined as such : void *ctx; }; -The members are the following : +The meanings of different members are : : `hlen` :: Length (in bytes) of the generated hash/message digest. @@ -85,6 +85,18 @@ The following hashers are available : : *blake3* :: Requires [hasher_blake3.h](0). +: *sha3_224* +:: Requires [hasher_sha3_224.h](0). + +: *sha3_256* +:: Requires [hasher_sha3_256.h](0). + +: *sha3_384* +:: Requires [hasher_sha3_384.h](0). + +: *sha3_512* +:: Requires [hasher_sha3_512.h](0). + # EXAMPLE To compute the SHA1 of a given message, and show it on *stdout*, one could do : @@ -96,3 +108,7 @@ char digest[sha1->hlen]; hasher_hash(digest, msg, strlen(msg), sha1); out("The SHA1 of ", ESC, msg, ESC, " is ", HEX(digest, sizeof(digest))); ``` + +# SEE ALSO + +[blake3_init](3), [sha3_224_init](3) diff --git a/doc/hasher_sha3_224.h.0.md b/doc/hasher_sha3_224.h.0.md new file mode 100644 index 0000000..1b25fe7 --- /dev/null +++ b/doc/hasher_sha3_224.h.0.md @@ -0,0 +1,25 @@ +% limb manual +% hasher_sha3_224.h(0) + +# NAME + +hasher\_sha3\_224.h - hasher for SHA3-224 + +# SYNOPSIS + + #include <limb/hasher_sha3_224.h> + +# DESCRIPTION + +This header defines the hasher to compute the SHA3-224 of a given message. + +## Hashers + +The following hashers are defined : + +: *sha3_224* +:: A hasher for SHA3-224. See [hasher_hash](3) for more. + +# SEE ALSO + +[sha3_224_init](3) diff --git a/doc/hasher_sha3_256.h.0.md b/doc/hasher_sha3_256.h.0.md new file mode 100644 index 0000000..046c394 --- /dev/null +++ b/doc/hasher_sha3_256.h.0.md @@ -0,0 +1,25 @@ +% limb manual +% hasher_sha3_256.h(0) + +# NAME + +hasher\_sha3\_256.h - hasher for SHA3-256 + +# SYNOPSIS + + #include <limb/hasher_sha3_256.h> + +# DESCRIPTION + +This header defines the hasher to compute the SHA3-256 of a given message. + +## Hashers + +The following hashers are defined : + +: *sha3_256* +:: A hasher for SHA3-256. See [hasher_hash](3) for more. + +# SEE ALSO + +[sha3_256_init](3) diff --git a/doc/hasher_sha3_384.h.0.md b/doc/hasher_sha3_384.h.0.md new file mode 100644 index 0000000..4a5614a --- /dev/null +++ b/doc/hasher_sha3_384.h.0.md @@ -0,0 +1,25 @@ +% limb manual +% hasher_sha3_384.h(0) + +# NAME + +hasher\_sha3\_384.h - hasher for SHA3-384 + +# SYNOPSIS + + #include <limb/hasher_sha3_384.h> + +# DESCRIPTION + +This header defines the hasher to compute the SHA3-384 of a given message. + +## Hashers + +The following hashers are defined : + +: *sha3_384* +:: A hasher for SHA3-384. See [hasher_hash](3) for more. + +# SEE ALSO + +[sha3_384_init](3) diff --git a/doc/hasher_sha3_512.h.0.md b/doc/hasher_sha3_512.h.0.md new file mode 100644 index 0000000..3b16d94 --- /dev/null +++ b/doc/hasher_sha3_512.h.0.md @@ -0,0 +1,25 @@ +% limb manual +% hasher_sha3_512.h(0) + +# NAME + +hasher\_sha3\_512.h - hasher for SHA3-512 + +# SYNOPSIS + + #include <limb/hasher_sha3_512.h> + +# DESCRIPTION + +This header defines the hasher to compute the SHA3-512 of a given message. + +## Hashers + +The following hashers are defined : + +: *sha3_512* +:: A hasher for SHA3-512. See [hasher_hash](3) for more. + +# SEE ALSO + +[sha3_512_init](3) diff --git a/doc/hlookup.3.md b/doc/hlookup.3.md index 9d41c98..6de36c9 100644 --- a/doc/hlookup.3.md +++ b/doc/hlookup.3.md @@ -22,7 +22,7 @@ These functions are designed to compute 32bit hashes of the given block of data pointed by `data` of length `dlen`. Resulting hashes are aimed for use in hash table lookups, e.g. with [hmap_set](3), or anything where one collision in 2^32 is acceptable, they are *not* meant to be used for cryptographic purposes. -See [sha3](3) or [blake3](3) for such use cases. +See [hasher_hash](3) for such use cases. The `hlookup`() function calculates two 32bit hashes at once. You can either only use the main one, switch to the second one should the main one not please diff --git a/doc/hlookup.h.0.md b/doc/hlookup.h.0.md index cdd6d25..109f91b 100644 --- a/doc/hlookup.h.0.md +++ b/doc/hlookup.h.0.md @@ -31,4 +31,4 @@ The following functions are defined : # SEE ALSO -[hmap.h](0), [blake3.h](0), [sha3.h](0) +[hmap.h](0), [hasher.h](0) diff --git a/doc/sha3.3.md b/doc/sha3_224_init.3.md similarity index 88% rename from doc/sha3.3.md rename to doc/sha3_224_init.3.md index 3f9aad9..a02ccd2 100644 --- a/doc/sha3.3.md +++ b/doc/sha3_224_init.3.md @@ -1,5 +1,5 @@ % limb manual -% sha3(3) +% sha3_224_init(3) % limb 0.0.2 % 2023-02-03 @@ -37,3 +37,8 @@ function repeatedly as many times as needed. The `sha3_final`() function stores the calculated hash from `ctx` in binary form into `md`, which must be able to store as many bytes as needed: `bits / 8`, where `bits` corresponds to the `sha3_*_init`() function called. + +# SEE ALSO + +[hasher_sha3_224.h](0), [hasher_sha3_256.h](0), [hasher_sha3_384.h](0), +[hasher_sha3_512.h](0), [hasher_hash](3), [blake3_init](3)