-
Notifications
You must be signed in to change notification settings - Fork 214
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
Passphrase Primitives (encryption & check) #175
Conversation
6a67224
to
ea6df96
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Some thoughts on the MonadRandom ((->) (Passphrase "salt"))
doc-comment.
This has been checked with the crypto team
👍
data ErrWrongPassphrase = ErrWrongPassphrase | ||
deriving stock (Show, Eq) | ||
|
||
-- | Little trick to be able to provide our own random "salt" in order to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found this very confusing at first.
our own random "salt"
why call it random then?
-- | Little trick to be able to provide our own random "salt" in order to | |
-- | Little trick to be able to provide our own "random" salt in order to |
or maybe:
-- | Little trick to be able to provide our own random "salt" in order to | |
-- | Little trick to provide a specific salt instead of a random one in order to |
Regardless, adding the type signature as FYI in this comment somehow would make the point more explicit / difficult to miss:
>>> encryptPassphrase
:: MonadRandom m => Passphrase purpose -> m (Hash purpose)
>>> encryptPassphrase pwd (Passphrase @"salt" salt)
Hash "..."
if you don't find it too ugly.
Also, interesting trick 😮
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am all for better comments 👍
@@ -116,6 +125,15 @@ spec = do | |||
goldenYoroiAddr (seed1, recPwd1) InternalChain accIx addrIx | |||
"Ae2tdPwUPEZLSqQN7XNJRMJ6yHWdfFLaQgPPYgyJKrJnCVnRtbfw6EHRv1D" | |||
|
|||
describe "Passphrases" $ do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
ea6df96
to
4a2b529
Compare
Issue Number
#95
Overview
Comments
This has been checked with the crypto team. A possible improvement later: use a timing loop instead of a fixed iteration count (i.e. loop for a short & constant period, and then, store the total number of iterations so that iterations are non-deterministic).
This is preparatory work for an upcoming keystore to store and retrieve encrypted private keys.