mirror of https://github.com/nucypher/nucypher.git
Implement get_fingerprint on Keypair
parent
03ffe8c9cd
commit
b894ca6d18
|
@ -1,3 +1,5 @@
|
||||||
|
import sha3
|
||||||
|
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
from nkms.crypto import api as API
|
from nkms.crypto import api as API
|
||||||
|
@ -45,6 +47,14 @@ class Keypair(object):
|
||||||
return bytes(self.pubkey)
|
return bytes(self.pubkey)
|
||||||
return self.pubkey.save_key()
|
return self.pubkey.save_key()
|
||||||
|
|
||||||
|
def get_fingerprint(self):
|
||||||
|
"""
|
||||||
|
Hashes the key using keccak-256 and returns the hexdigest in bytes.
|
||||||
|
|
||||||
|
:return: Hexdigest fingerprint of key (keccak-256) in bytes
|
||||||
|
"""
|
||||||
|
return sha3.keccak_256(bytes(self.pubkey)).hex_digest().encode()
|
||||||
|
|
||||||
|
|
||||||
class EncryptingKeypair(Keypair):
|
class EncryptingKeypair(Keypair):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -22,7 +22,6 @@ class KeyStore(object):
|
||||||
"""
|
"""
|
||||||
A storage class of cryptographic keys.
|
A storage class of cryptographic keys.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
kfrag_splitter = BytestringSplitter(Signature, (KFrag, KFRAG_LENGTH))
|
kfrag_splitter = BytestringSplitter(Signature, (KFrag, KFRAG_LENGTH))
|
||||||
|
|
||||||
def __init__(self, sqlalchemy_engine=None):
|
def __init__(self, sqlalchemy_engine=None):
|
||||||
|
|
Loading…
Reference in New Issue