Merge pull request #54 from tendermint/cRandHex-doc-fix

CRandHex: fix up doc to mention length of digits
This commit is contained in:
Ethan Buchman 2017-12-26 23:48:05 -05:00 committed by GitHub
commit 4041adbf92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -44,7 +44,10 @@ func CRandBytes(numBytes int) []byte {
return b return b
} }
// RandHex(24) gives 96 bits of randomness, strong enough for most purposes. // CRandHex returns a hex encoded string that's floor(numDigits/2) * 2 long.
//
// Note: CRandHex(24) gives 96 bits of randomness that
// are usually strong enough for most purposes.
func CRandHex(numDigits int) string { func CRandHex(numDigits int) string {
return hex.EncodeToString(CRandBytes(numDigits / 2)) return hex.EncodeToString(CRandBytes(numDigits / 2))
} }