sha3_224, as we only need 32 bit anyways
This commit is contained in:
parent
b1e5992f05
commit
f19a8eb6a8
1 changed files with 2 additions and 2 deletions
|
@ -1,5 +1,5 @@
|
||||||
from base64 import b64decode, b64encode
|
from base64 import b64decode, b64encode
|
||||||
from hashlib import sha3_256
|
from hashlib import sha3_224
|
||||||
|
|
||||||
from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PrivateKey
|
from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PrivateKey
|
||||||
from cryptography.hazmat.primitives.serialization import Encoding, PrivateFormat, PublicFormat, NoEncryption
|
from cryptography.hazmat.primitives.serialization import Encoding, PrivateFormat, PublicFormat, NoEncryption
|
||||||
|
@ -16,7 +16,7 @@ def generate_ed25519_key_pair(secret):
|
||||||
|
|
||||||
# handle random 32bit number, occuring twice in a row
|
# handle random 32bit number, occuring twice in a row
|
||||||
nondeterministic_bytes = b64decode(''.join(nondeterministic_privatekey.split('\n')[1:-2]))
|
nondeterministic_bytes = b64decode(''.join(nondeterministic_privatekey.split('\n')[1:-2]))
|
||||||
random_bytes = sha3_256(secret).digest()[0:4]
|
random_bytes = sha3_224(secret).digest()[0:4]
|
||||||
deterministic_bytes = nondeterministic_bytes[:98] + random_bytes + random_bytes + nondeterministic_bytes[106:]
|
deterministic_bytes = nondeterministic_bytes[:98] + random_bytes + random_bytes + nondeterministic_bytes[106:]
|
||||||
deterministic_privatekey = '\n'.join([
|
deterministic_privatekey = '\n'.join([
|
||||||
'-----BEGIN OPENSSH PRIVATE KEY-----',
|
'-----BEGIN OPENSSH PRIVATE KEY-----',
|
||||||
|
|
Loading…
Reference in a new issue