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

Sha512 Implementation #27

Closed
satvikc opened this issue Jan 20, 2013 · 4 comments
Closed

Sha512 Implementation #27

satvikc opened this issue Jan 20, 2013 · 4 comments
Labels

Comments

@satvikc
Copy link
Contributor

satvikc commented Jan 20, 2013

How should I capture length of message in this case as it will be 2^128. Should I use Integer or 2 Word64?

@satvikc
Copy link
Contributor Author

satvikc commented Jan 20, 2013

There is also a problem in Hash typeclass in which you assumed message size can not be greater that sizeOf Word64

@satvikc
Copy link
Contributor Author

satvikc commented Jan 20, 2013

I also need 128bit Big endian Word while encoding the padding.

@piyush-kurur
Copy link
Member

I had thought about this. No machines currently have 128-bit native integers. To accomodate sha512 we would have to
use Integer for all hashes which will unnecessarily slow down things. If you think about it. It is going to be a problem if and only if the message size goes beyond 2^64 bits which actually is quite large. about 1024 petabytes.
For network applications this limit will almost never be exceed (Think of using hmac-sha512 to compute the mac of ssh packets). What we can do is we can document this as a limitation of the library and when Word128 arrives on GHC we can implement it.

You can implement the 128 but BE padding by actually storing 2 64 bit BE numbers, the first being just 0.

@satvikc
Copy link
Contributor Author

satvikc commented Jan 20, 2013

Ok.. I have done sha 224,256,512 and doing sha 384. what others we have to do?

@satvikc satvikc closed this as completed Jan 20, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants