Implement get_fingerprint on Keypair

pull/157/head
tuxxy 2018-02-10 15:43:00 -07:00
parent 03ffe8c9cd
commit b894ca6d18
2 changed files with 10 additions and 1 deletions

View File

@ -1,3 +1,5 @@
import sha3
from typing import Union
from nkms.crypto import api as API
@ -45,6 +47,14 @@ class Keypair(object):
return bytes(self.pubkey)
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):
"""

View File

@ -22,7 +22,6 @@ class KeyStore(object):
"""
A storage class of cryptographic keys.
"""
kfrag_splitter = BytestringSplitter(Signature, (KFrag, KFRAG_LENGTH))
def __init__(self, sqlalchemy_engine=None):