Skip to content

define std.crypto.sha2.Sha512224 #19697

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 19, 2024
Merged

define std.crypto.sha2.Sha512224 #19697

merged 4 commits into from
Apr 19, 2024

Conversation

nektro
Copy link
Contributor

@nektro nektro commented Apr 19, 2024

@jedisct1
Copy link
Contributor

jedisct1 commented Apr 19, 2024

Not the most common variant, but sure!

There's an issue with the test vectors, though.

@nektro
Copy link
Contributor Author

nektro commented Apr 19, 2024

yep working on a fix for the test now

@jedisct1
Copy link
Contributor

🎉

@jedisct1 jedisct1 enabled auto-merge (squash) April 19, 2024 14:46
@jedisct1 jedisct1 merged commit f03829a into ziglang:master Apr 19, 2024
10 checks passed
@nektro nektro deleted the patch-3 branch April 19, 2024 18:16
agreppin pushed a commit to agreppin/zig that referenced this pull request Apr 21, 2024
* define std.crypto.sha2.Sha512224

* rename blunder

* add sha512-224 and sha512-256 tests

* fix Sha2x64 for variations that aren't a multiple of 64 bits
clickingbuttons added a commit to clickingbuttons/zig that referenced this pull request Apr 22, 2024
Replace `Sha512224`, `Sha512256`, and `Sha512T224` with
`fn Sha512T(digest_bits: comptime_int)`.

This required refactoring `Sha2x64(comptime params)` to
`Sha2x64(comptime iv: [8]u64, digest_bits: comptime_int)`
for user-specified `digest_bits`.

I left ziglang#19697 alone but added a compile-time check that digest_bits is
divisible by 8.

Remove docs which restate type name. Add module docs and reference where
IVs come from.
clickingbuttons added a commit to clickingbuttons/zig that referenced this pull request Apr 22, 2024
Replace `Sha512224`, `Sha512256`, and `Sha512T224` with
`fn Sha512Truncated(digest_bits: comptime_int)`.

This required refactoring `Sha2x64(comptime params)` to
`Sha2x64(comptime iv: [8]u64, digest_bits: comptime_int)`
for user-specified `digest_bits`.

I left ziglang#19697 alone but added a compile-time check that digest_bits is
divisible by 8.

Remove docs which restate type name. Add module docs and reference where
IVs come from.
clickingbuttons added a commit to clickingbuttons/zig that referenced this pull request Apr 22, 2024
Replace `Sha512224`, `Sha512256`, and `Sha512T224` with
`fn Sha512Truncated(digest_bits: comptime_int)`.

This required refactoring `Sha2x64(comptime params)` to
`Sha2x64(comptime iv: [8]u64, digest_bits: comptime_int)`
for user-specified `digest_bits`.

I left ziglang#19697 alone but added a compile-time check that digest_bits is
divisible by 8.

Remove docs which restate type name. Add module docs and reference where
IVs come from.
jedisct1 pushed a commit that referenced this pull request Apr 28, 2024
* std.crypto.hash.sha2: generalize sha512 truncation

Replace `Sha512224`, `Sha512256`, and `Sha512T224` with
`fn Sha512Truncated(digest_bits: comptime_int)`.

This required refactoring `Sha2x64(comptime params)` to
`Sha2x64(comptime iv: [8]u64, digest_bits: comptime_int)`
for user-specified `digest_bits`.

I left #19697 alone but added a compile-time check that digest_bits is
divisible by 8.

Remove docs which restate type name. Add module docs and reference where
IVs come from.

* std.crypto.sha2: make Sha512_224 and Sha512_256 pub

* make generic type implementation detail, add comments

* fix iv

* address @jedisct1 feedback

* fix typo

* renaming

* add truncation clarifying comment and Sha259T192 tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants