source: trunk/essentials/dev-lang/python/Lib/hmac.py@ 3951

Last change on this file since 3951 was 3225, checked in by bird, 19 years ago

Python 2.5

File size: 3.5 KB
Line 
1"""HMAC (Keyed-Hashing for Message Authentication) Python module.
2
3Implements the HMAC algorithm as described by RFC 2104.
4"""
5
6def _strxor(s1, s2):
7 """Utility method. XOR the two strings s1 and s2 (must have same length).
8 """
9 return "".join(map(lambda x, y: chr(ord(x) ^ ord(y)), s1, s2))
10
11# The size of the digests returned by HMAC depends on the underlying
12# hashing module used.
13digest_size = None
14
15# A unique object passed by HMAC.copy() to the HMAC constructor, in order
16# that the latter return very quickly. HMAC("") in contrast is quite
17# expensive.
18_secret_backdoor_key = []
19
20class HMAC:
21 """RFC2104 HMAC class.
22