parent
d4038cc03a
commit
a4081bab72
@ -1,16 +0,0 @@
|
||||
|
||||
class HashWriter:
|
||||
|
||||
def __init__(self, hashfunc):
|
||||
self.ctx = hashfunc()
|
||||
self.buf = bytearray(1) # used in append()
|
||||
|
||||
def extend(self, buf: bytearray):
|
||||
self.ctx.update(buf)
|
||||
|
||||
def append(self, b: int):
|
||||
self.buf[0] = b
|
||||
self.ctx.update(self.buf)
|
||||
|
||||
def get_digest(self, *args) -> bytes:
|
||||
return self.ctx.digest(*args)
|
Loading…
Reference in new issue