idaapayo/funga-eth:Ida/pbkdf2
master
implementing pbkdf2
@@ -29,2 +28,4 @@
'pbkdf2'
]
default_kdfparams = {
This should be renamed to default_scrypt_params
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.
scrypt
@@ -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 be hmac-sha256, which isn't a valid param for hashlib.pbkdf2_hmac default to sha256 instead.
prf
hmac-sha256
hashlib.pbkdf2_hmac
sha256
@@ -60,0 +69,4 @@
kdfparams['prf'].replace('sha256')
hash_name=kdfparams['prf'],
Change this to hash_name="sha256"
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
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 @@
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
e5cd1cad58
No dependencies set.
The note is not visible to the blocked user.
implementing pbkdf2
@@ -29,2 +28,4 @@'pbkdf2']default_kdfparams = {This should be renamed to
default_scrypt_paramsThoughts? @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
scryptfor 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 @@@staticmethoddef from_pbkdf2(kdfparams=pbkdf2_kdfparams, passphrase=''):hashname = kdfparams['prf']prfkey-value from keystore files could also behmac-sha256, which isn't a valid param forhashlib.pbkdf2_hmacdefault tosha256instead.@@ -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 PathRemove these comments
@@ -36,2 +37,3 @@}}pbkdf2_kdfparams = {Chnage this to
default_pbkdf2_kdfparams@@ -5,3 +5,3 @@# external importsfrom hexathon import strip_0xfrom hexathon import strip_0x, add_0xRevert 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
e5cd1cad58Pull request closed