mirror of
https://github.com/kazu-yamamoto/crypton.git
synced 2024-10-04 07:50:45 +03:00
adding comment
This commit is contained in:
parent
665b97d139
commit
c18b7d2dcc
@ -50,6 +50,12 @@ seedLength = 40
|
||||
|
||||
-- | Create a new Seed from system entropy
|
||||
seedNew :: MonadRandom randomly => randomly Seed
|
||||
-- The degree of its randomness depends on the source, e.g. for iOS we
|
||||
-- have to compile with DoNotUseEntropy flag, as iOS doesn't allow
|
||||
-- using getentropy, and on some other systems it can be also
|
||||
-- potentially comprisable sources. Hashing of entropy before using
|
||||
-- it as a seed is a common mitigation for attacks via RNG/entropy
|
||||
-- source.
|
||||
seedNew = (Seed . B.take seedLength . B.convert . (hash :: ScrubbedBytes -> Digest SHA512)) `fmap` getRandomBytes 64
|
||||
|
||||
-- | Convert a Seed to an integer
|
||||
|
Loading…
Reference in New Issue
Block a user