-
Notifications
You must be signed in to change notification settings - Fork 8
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
Add crypto GenerateEntropy() and GenerateHexNonce() #57
Conversation
8fa1b2b
to
12ceed7
Compare
Co-authored-by: Diane Huxley <[email protected]>
@KendallWeihe thoughts on doing the following for the argument passed to type EntropySize int
const (
// Directly set the sizes according to NIST recommendations for entropy
// defined here: https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-90Ar1.pdf
Entropy112Bits EntropySize = 112 / 8 // 14 bytes
Entropy128Bits = 128 / 8 // 16 bytes
Entropy192Bits = 192 / 8 // 24 bytes
Entropy256Bits = 256 / 8 // 32 bytes
) this way we can call either function like so: crypto.GenerateEntropy(Entropy128Bits)
crypto.GenerateNonce(Entropy128Bits) This provides consumers with easy access to recommended values. wish we could use could also leave off const (
// Directly set the sizes according to NIST recommendations for entropy
// defined here: https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-90Ar1.pdf
Entropy112 EntropySize = 112 / 8 // 14 bytes
Entropy128 = 128 / 8 // 16 bytes
Entropy192 = 192 / 8 // 24 bytes
Entropy256 = 256 / 8 // 32 bytes
) |
…evant doc comment
@mistermoe awesome idea! Done ✅ And also added additional test coverage for custom size, and nonce error case, as well as a doc comment for |
Co-authored-by: Diane Huxley <[email protected]>
Closes #51