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

Class SHA224 in Principal.mo contains dead data #594

Open
ggreif opened this issue Oct 23, 2023 · 1 comment
Open

Class SHA224 in Principal.mo contains dead data #594

ggreif opened this issue Oct 23, 2023 · 1 comment

Comments

@ggreif
Copy link
Contributor

ggreif commented Oct 23, 2023

let ivs : [[Nat32]] = [

should be a one-dimensional array for only the first 8 values. This also implies simplifying the func reset().
Furthermore the iv in let (sum_bytes, iv) = (28, 0); can be eliminated (probably).

@timohanke
Copy link

Yes, iv and sum_bytes can both be eliminated from the code and their values hardcoded in the single place where they are used (e.g. iv in the reset() function).

Btw, I also noticed that the SHA224 class does not use the latest code from https://github.com/research-ag/sha2. The difference being that the current code there uses direct conversion between Nat8 <-> Nat16 <-> Nat32 and eliminates heap allocations. Anyway, probably not worth touching the whole code again.

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

No branches or pull requests

2 participants