chiark
/
gitweb
/
~mdw
/
catacomb-python
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
bytestring.c, catacomb/__init__.py: Compare for equality in constant time.
[catacomb-python]
/
catacomb
/
__init__.py
diff --git
a/catacomb/__init__.py
b/catacomb/__init__.py
index 120ef111d967e3bc368daf9584a1ff7b285b06fd..6745bcee016c68df54016eafea601441a0aec7d3 100644
(file)
--- a/
catacomb/__init__.py
+++ b/
catacomb/__init__.py
@@
-94,8
+94,19
@@
class _tmp:
def __repr__(me):
return 'bytes(%r)' % hex(me)
_augment(ByteString, _tmp)
def __repr__(me):
return 'bytes(%r)' % hex(me)
_augment(ByteString, _tmp)
+ByteString.__hash__ = str.__hash__
bytes = ByteString.fromhex
bytes = ByteString.fromhex
+###--------------------------------------------------------------------------
+### Hashing.
+
+class _tmp:
+ def check(me, h):
+ hh = me.done()
+ return ctstreq(h, hh)
+_augment(GHash, _tmp)
+_augment(Poly1305Hash, _tmp)
+
###--------------------------------------------------------------------------
### Multiprecision integers and binary polynomials.
###--------------------------------------------------------------------------
### Multiprecision integers and binary polynomials.