def hmac(key, data, algo='sha1'): md = getattr(m2, algo, None) if md is None: raise ValueError, ('unknown algorithm', algo) return m2.hmac(key, data, md())
def hmac(key, data, algo="sha1"): md = getattr(m2, algo, None) if md is None: raise ValueError("unknown algorithm", algo) return m2.hmac(key, data, md())
def _hmac(self, key, data): return binascii.b2a_base64(m2.hmac(key, data, m2.sha1()))[:-1]