aboutsummaryrefslogtreecommitdiff
path: root/lib/std/crypto/blake2.zig
AgeCommit message (Collapse)Author
2025-08-28std.Io: delete GenericWriterAndrew Kelley
2025-07-07std.io: deprecated Reader/Writer; introduce new APIAndrew Kelley
2024-08-21std: update eval branch quotas after bdbc485mlugg
Also, update `std.math.Log2Int[Ceil]` to more efficient implementations that don't use up so much damn quota!
2023-10-31std.builtin.Endian: make the tags lower caseAndrew Kelley
Let's take this breaking change opportunity to fix the style of this enum.
2023-10-31mem: fix ub in writeIntJacob Young
Use inline to vastly simplify the exposed API. This allows a comptime-known endian parameter to be propogated, making extra functions for a specific endianness completely unnecessary.
2023-06-24all: migrate code to new cast builtin syntaxmlugg
Most of this migration was performed automatically with `zig fmt`. There were a few exceptions which I had to manually fix: * `@alignCast` and `@addrSpaceCast` cannot be automatically rewritten * `@truncate`'s fixup is incorrect for vectors * Test cases are not formatted, and their error locations change
2023-04-28update codebase to use `@memset` and `@memcpy`Andrew Kelley
2023-02-18update std lib and compiler sources to new for loop syntaxAndrew Kelley
2021-11-20std: add `writer` methods on all crypto.hash types (#10168)Meghan
2021-08-24remove redundant license headers from zig standard libraryAndrew Kelley
We already have a LICENSE file that covers the Zig Standard Library. We no longer need to remind everyone that the license is MIT in every single file. Previously this was introduced to clarify the situation for a fork of Zig that made Zig's LICENSE file harder to find, and replaced it with their own license that required annual payments to their company. However that fork now appears to be dead. So there is no need to reinforce the copyright notice in every single file.
2021-05-08std: update usage of std.testingVeikka Tuominen
2021-01-03std/crypto: add BLAKE2-160 types and testsFrank Denis
2021-01-02std/crypto: properly support arbitrary output sizesFrank Denis
Fixes #7657
2020-12-31Year++Frank Denis
2020-11-05math.shl/math.shr: add support for vectorsFrank Denis
2020-10-29std/crypto/blake2b: allow the initial output length to be setFrank Denis
BLAKE2 includes the expected output length in the initial state. This length is actually distinct from the actual output length used at finalization. BLAKE2b-256/128 is thus not the same as BLAKE2b-128. This behavior can be a little bit surprising, and has been "fixed" in BLAKE3. In order to support this, we may want to provide an option to set the length used for domain separation. In Zig, there is another reason to allow this: we assume that the output length is defined at comptime. But BLAKE2 doesn't have a fixed output length. For an output length that is not known at comptime, we can't take the full block size and truncate it due to the reason above. What we can do now is set that length as an option to get the correct initial state, and truncate the output if necessary.
2020-10-26std/crypto: API cleanupŽiga Željko
2020-10-17std/crypto: make the whole APIs more consistentFrank Denis
- use `PascalCase` for all types. So, AES256GCM is now Aes256Gcm. - consistently use `_length` instead of mixing `_size` and `_length` for the constants we expose - Use `minimum_key_length` when it represents an actual minimum length. Otherwise, use `key_length`. - Require output buffers (for ciphertexts, macs, hashes) to be of the right size, not at least of that size in some functions, and the exact size elsewhere. - Use a `_bits` suffix instead of `_length` when a size is represented as a number of bits to avoid confusion. - Functions returning a constant-sized slice are now defined as a slice instead of a pointer + a runtime assertion. This is the case for most hash functions. - Use `camelCase` for all functions instead of `snake_case`. No functional changes, but these are breaking API changes.
2020-09-08std: clean up bitrotten imports in cryptoxackus
2020-08-21Hash functions now accept an option setFrank Denis
- This avoids having multiple `init()` functions for every combination of optional parameters - The API is consistent across all hash functions - New options can be added later without breaking existing applications. For example, this is going to come in handy if we implement parallelization for BLAKE2 and BLAKE3. - We don't have a mix of snake_case and camelCase functions any more, at least in the public crypto API Support for BLAKE2 salt and personalization (more commonly called context) parameters have been implemented by the way to illustrate this.
2020-08-20Remove explicit comptimeFrank Denis
2020-08-20Remove the reset() function from hash functionsFrank Denis
Justification: - reset() is unnecessary; states that have to be reused can be copied - reset() is error-prone. Copying a previous state prevents forgetting struct members. - reset() forces implementation to store sensitive data (key, initial state) in memory even when they are not needed. - reset() is confusing as it has a different meaning elsewhere in Zig.
2020-08-20Repair crypto/benchmark; add BLAKE2b256Frank Denis
Some MACs have a 64-bit output
2020-08-20add license header to all std lib filesAndrew Kelley
add SPDX license identifier copyright ownership is zig contributors
2020-08-01remove unnecessary operationsMantas Jonytis
2020-08-01implement keyed blake2Mantas Jonytis
2020-08-01make blake2 publicMantas Jonytis
2020-08-01compute blake2 at compile timeMantas Jonytis
2020-08-01blake2b: off-by-one on updateMantas Jonytis
2020-08-01add more blake2b test casesMantas Jonytis
2020-08-01blake2s: off-by-one on updateMantas Jonytis
2020-08-01add more blake2s testsMantas Jonytis
2020-03-19update std lib to take advantage of slicing with comptime indexesAndrew Kelley
2020-02-24hashing algorithms: fix logic and index out of boundsJ.W
2019-11-27remove type coercion from array values to referencesAndrew Kelley
* Implements #3768. This is a sweeping breaking change that requires many (trivial) edits to Zig source code. Array values no longer coerced to slices; however one may use `&` to obtain a reference to an array value, which may then be coerced to a slice. * Adds `IrInstruction::dump`, for debugging purposes. It's useful to call to inspect the instruction when debugging Zig IR. * Fixes bugs with result location semantics. See the new behavior test cases, and compile error test cases. * Fixes bugs with `@typeInfo` not properly resolving const values. * Behavior tests are passing but std lib tests are not yet. There is more work to do before merging this branch.
2019-11-08update the codebase to use `@as`Andrew Kelley
2019-09-25mv std/ lib/Andrew Kelley
that's all this commit does. further commits will fix cli flags and such. see #2221