def _calc_checksum_builtin(self, secret): if isinstance(secret, unicode): secret = secret.encode("utf-8") rounds = self.rounds #NOTE: this uses a different format than the hash... result = u"%s$sha1$%s" % (self.salt, rounds) result = result.encode("ascii") r = 0 while r < rounds: result = hmac_sha1(secret, result) r += 1 return h64.encode_transposed_bytes(result, self._chk_offsets).decode("ascii")
def test_hmac_sha1(self): "test independant hmac_sha1() method" self.assertEqual( pbkdf2.hmac_sha1(b("secret"), b("salt")), b('\xfc\xd4\x0c;]\r\x97\xc6\xf1S\x8d\x93\xb9\xeb\xc6\x00\x04.\x8b\xfe' ))
def test_hmac_sha1(self): "test independant hmac_sha1() method" self.assertEqual( pbkdf2.hmac_sha1(b("secret"), b("salt")), b('\xfc\xd4\x0c;]\r\x97\xc6\xf1S\x8d\x93\xb9\xeb\xc6\x00\x04.\x8b\xfe') )