Skip to content
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

Implement SHA-512/224 and SHA-512/256 functions #47

Closed
hauleth opened this issue Oct 28, 2015 · 0 comments · Fixed by #55
Closed

Implement SHA-512/224 and SHA-512/256 functions #47

hauleth opened this issue Oct 28, 2015 · 0 comments · Fixed by #55

Comments

@hauleth
Copy link
Member

hauleth commented Oct 28, 2015

No description provided.

@silmeth silmeth self-assigned this Nov 5, 2015
@homu homu closed this as completed in #55 Nov 15, 2015
homu added a commit that referenced this issue Nov 15, 2015
Add SHA-512/224 and SHA-512/256 hash functions

SHA2-512/224 and SHA-512/256 implemented, using existing macros for sha2 functions. However, SHA2-512/224 has 224 bits, and that is not a multiple of 64. Thus, `write_u64()` used for writing state to resulting `out` slice cannot be used directly (as it would copy 4 bytes to few to out, or 4 to many).

Because of that a *proxy* struct `_Sha512_224` which outputs 256 bits is created, and its methods are simply called by proper `Sha512_224` struct. In the `result()` method a new vec, `res` is created, result is written to it, and then 28 first bytes are copied to `out` using a simple for loop.

SHA2-512/256 is implemented with just `impl_sha!(high Sha512_256, SHA512_256_INIT, 256)`.

It closes #47.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants