Commit Graph

12 Commits

Author SHA1 Message Date
Laytan
164bb52212 crypto/hash: hash_bytes_to_buffer slice result to digest size 2025-07-19 19:50:32 +02:00
gingerBill
68960e7d0a Use #+ tags 2024-09-19 12:39:56 +01:00
gingerBill
d560dad0d8 Add missing import that was accidentally deleted before commit 2024-09-19 12:09:30 +01:00
gingerBill
244907149a Move os stuff to OS specific files 2024-09-19 12:06:31 +01:00
Laytan Laats
288312a812 core: improve package doc comments for the documentation generator 2024-09-03 19:59:04 +02:00
Yawning Angel
b68311d777 core/crypto/hash: Make the _to_buffer routines return the hash slice
Quality of life improvement.
2024-08-10 18:32:37 +09:00
Yawning Angel
44758f2a60 core/crypto: Stop using context.temp_allocator
The max digest size for the foreseeable future will be 512 bits, and the
max block size is currently 1152 bits (SHA3-224).  If people add more
exotic hash algorithms without bumping the constants when required,
tests will fail.

The stream buffer will currently be 576 bytes, which is "fine" to just
stick on the stack, and is a sensible multiple of the more common block
size of 64 bytes.
2024-02-07 02:33:53 +09:00
Yawning Angel
2357293e05 core/crypto/hash: Make the low level interface allocator-less
Just (ab)using reflect to victory is probably fine.
2024-02-07 00:37:18 +09:00
Yawning Angel
7a8b1669b0 core/crypto: Expose the block sizes for every hash algorithm
While I just went and made this private, this information is required
for keying HMAC.
2024-02-07 00:37:18 +09:00
Yawning Angel
b02b85d242 core/crypto/shake: SHAKE is an XOF, not a hash 2024-02-07 00:37:18 +09:00
Yawning Angel
899fab64d9 core/crypto: Documentation cleanups 2024-02-07 00:37:18 +09:00
Yawning Angel
00ab3beed9 core:crypto/hash: Add a generic higher level hash interface
There is a lot of code duplicated in convenience methods in each hash
implementation, and having a generic hash type makes implementing
higher-level constructs such as HMAC significantly easier down the road.
2024-02-07 00:37:18 +09:00