1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-24 15:28:10 +00:00

trezor.crypto: add hashlib.HashIO

This commit is contained in:
Pavol Rusnak 2016-11-01 15:23:37 +01:00
parent 54a045e9de
commit 56eb351816
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

View File

@ -3,3 +3,15 @@ from TrezorCrypto import Sha256 as sha256
from TrezorCrypto import Sha512 as sha512 from TrezorCrypto import Sha512 as sha512
from TrezorCrypto import Sha3_256 as sha3_256 from TrezorCrypto import Sha3_256 as sha3_256
from TrezorCrypto import Sha3_512 as sha3_512 from TrezorCrypto import Sha3_512 as sha3_512
class HashIO:
def __init__(self, hashfunc=sha256):
self.hashfunc = hashfunc
self.ctx = hashfunc()
def write(self, data):
self.ctx.update(data)
def getvalue(self):
return self.ctx.digest()