used buffer API instead of string concatenation
@@ -33,11 +33,11 @@ def _ensure_msg_size(hf, msg: bytes) -> None:
def _e(ec: Curve, hf, r: int, P: Point, mhd: bytes) -> int:
# Let e = int(hf(bytes(x(R)) || bytes(dG) || mhd)) mod n.
- ebytes = octets_from_int(r, ec.psize) # FIXME: hsize, nsize ?
- ebytes += octets_from_point(ec, P, True)
- ebytes += mhd
- ebytes = hf(ebytes).digest()
- e = int_from_bits(ec, ebytes)
+ h = hf()
+ h.update(octets_from_int(r, ec.psize))
+ h.update(octets_from_point(ec, P, True))
+ h.update(mhd)
+ e = int_from_bits(ec, h.digest())
return e
