def test_blake_encoding_not_power_of_2(self): with self.assertRaises(ValueError): blake_encode_ngrams(self.ngrams, (self.key_sha1, ), self.ks, 1023, 'ascii') with self.assertRaises(ValueError): blake_encode_ngrams(self.ngrams, (self.key_sha1, ), self.ks, 1025, 'ascii')
def test_order_of_ngrams(self): self._test_order_of_ngrams( lambda ngrams: blake_encode_ngrams(ngrams, (self.key_sha1, ), self. ks, 1024, 'ascii'), copy(self.ngrams)) self._test_order_of_ngrams( lambda ngrams: double_hash_encode_ngrams(ngrams, ( self.key_sha1, self.key_md5), self.ks, 1024, 'ascii'), copy(self.ngrams)) self._test_order_of_ngrams( lambda ngrams: double_hash_encode_ngrams_non_singular( ngrams, (self.key_sha1, self.key_md5), self.ks, 1024, 'ascii'), copy(self.ngrams))
def test_blake_encoding(self): bf = blake_encode_ngrams(self.ngrams, (self.key_sha1, ), self.ks, 1024, 'ascii') self._test_bit_range(bf.count(), self.k, len(self.ngrams))