Runnable with both Python3 and Python2, with PyQt4 #2249
|
@ -7,6 +7,8 @@ High level cryptographic functions based on `.pyelliptic` OpenSSL bindings.
|
||||||
`More discussion. <https://github.com/yann2192/pyelliptic/issues/32>`_
|
`More discussion. <https://github.com/yann2192/pyelliptic/issues/32>`_
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from unqstr import unic
|
||||||
|
|
||||||
import hashlib
|
import hashlib
|
||||||
import os
|
import os
|
||||||
from binascii import hexlify
|
from binascii import hexlify
|
||||||
|
@ -102,7 +104,7 @@ def random_keys():
|
||||||
|
|
||||||
def deterministic_keys(passphrase, nonce):
|
def deterministic_keys(passphrase, nonce):
|
||||||
"""Generate keys from *passphrase* and *nonce* (encoded as varint)"""
|
"""Generate keys from *passphrase* and *nonce* (encoded as varint)"""
|
||||||
priv = hashlib.sha512(passphrase + nonce).digest()[:32]
|
priv = hashlib.sha512(unic(passphrase).encode("utf-8", "replace") + nonce).digest()[:32]
|
||||||
pub = pointMult(priv)
|
pub = pointMult(priv)
|
||||||
return priv, pub
|
return priv, pub
|
||||||
|
|
||||||
|
|
Reference in New Issue
Block a user