Ida/pbkdf2 #2
No reviewers
Labels
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: chaintool/funga-eth#2
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "idaapayo/funga-eth:Ida/pbkdf2"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
implementing pbkdf2
@ -29,2 +28,4 @@
'pbkdf2'
]
default_kdfparams = {
This should be renamed to
default_scrypt_params
Thoughts? @lash Not sure which naming convention you prefer
@ -79,3 +103,2 @@
def to_dict(private_key_bytes, passphrase=''):
def to_dict(private_key_bytes, kdf :str, passphrase=''):
This is a potentially breaking change if this method is being used elsewhere. I suggest we default to
scrypt
for now.@ -57,0 +71,4 @@
itr = int(kdfparams['c'])
dklen = int(kdfparams['dklen'])
derived_key = hashlib.pbkdf2_hmac(
We can pass the params directly and return on on it to reduce verbosity.
@ -57,0 +65,4 @@
@staticmethod
def from_pbkdf2(kdfparams=pbkdf2_kdfparams, passphrase=''):
hashname = kdfparams['prf']
prf
key-value from keystore files could also behmac-sha256
, which isn't a valid param forhashlib.pbkdf2_hmac
default tosha256
instead.@ -60,0 +69,4 @@
kdfparams['prf'].replace('sha256')
derived_key = hashlib.pbkdf2_hmac(
hash_name=kdfparams['prf'],
Change this to
hash_name="sha256"
@ -16,6 +16,15 @@ from funga.eth.keystore.keyfile import (
from_file,
to_dict,
)
# from pathlib import Path
Remove these comments
@ -36,2 +37,3 @@
}
}
pbkdf2_kdfparams = {
Chnage this to
default_pbkdf2_kdfparams
@ -5,3 +5,3 @@
# external imports
from hexathon import strip_0x
from hexathon import strip_0x, add_0x
Revert these changes
@ -79,3 +99,2 @@
def to_dict(private_key_bytes, passphrase=''):
def to_dict(private_key_bytes, kdf :str, passphrase=''):
can we have scrypt as default please? that makes it backward compatible
@ -78,3 +80,3 @@
pk_bytes = os.urandom(32)
pk = coincurve.PrivateKey(secret=pk_bytes)
o = to_dict(pk_bytes, passphrase)
o = to_dict(pk_bytes, 'scrypt', passphrase)
... and then you don't have to change this.
merged
e5cd1cad58
Pull request closed