Ejemplo n.º 1
0
 def intdigest(self):
     return self.h and bin_to_num(self.h)
Ejemplo n.º 2
0
 def intdigest(self):
     return self.h and int(bin_to_num(self.h))
Ejemplo n.º 3
0
 def test_num_to_bin_bin_to_num_is_idempotent(self):
     expected = b'\x06\x00\x00\x9c\xbf\xeb\x83\xdb'
     result = num_to_bin(bin_to_num(b'\x06\x00\x00\x9c\xbf\xeb\x83\xdb'))
     assert expected == result
Ejemplo n.º 4
0
 def intdigest(self):
     if self.hd:
         return codec.bin_to_num(self.hd)
Ejemplo n.º 5
0
 def test_bin_to_num_large_number(self):
     expected = 432346237462348763
     result = bin_to_num(b'\x06\x00\x00\x9c\xbf\xeb\x83\xdb')
     assert expected == result
Ejemplo n.º 6
0
 def test_bin_to_num_and_num_to_bin_is_idempotent(self):
     expected = 432346237462348763
     result = bin_to_num(num_to_bin(432346237462348763))
     assert expected == result
Ejemplo n.º 7
0
 def test_bin_to_num_basic(self):
     expected = 123
     result = bin_to_num(b'{')
     assert expected == result
Ejemplo n.º 8
0
 def test_bin_to_num_zero(self):
     expected = 0
     result = bin_to_num(b'\x00')
     assert expected == result
Ejemplo n.º 9
0
 def test_num_to_bin_bin_to_num_is_idempotent(self):
     expected = '\x06\x00\x00\x9c\xbf\xeb\x83\xdb'
     result = num_to_bin(bin_to_num('\x06\x00\x00\x9c\xbf\xeb\x83\xdb'))
     assert expected == result
Ejemplo n.º 10
0
 def test_bin_to_num_null(self):
     expected = 0
     result = bin_to_num('\x00')
     assert expected == result
Ejemplo n.º 11
0
 def test_bin_to_num_and_num_to_bin_is_idempotent(self):
     expected = 432346237462348763
     result = bin_to_num(num_to_bin(432346237462348763))
     assert expected == result
Ejemplo n.º 12
0
 def test_bin_to_num_large_number(self):
     expected = 432346237462348763
     result = bin_to_num('\x06\x00\x00\x9c\xbf\xeb\x83\xdb')
     assert expected == result
Ejemplo n.º 13
0
 def test_bin_to_num_null(self):
     expected = 0
     result = bin_to_num('\x00')
     assert expected == result
Ejemplo n.º 14
0
 def test_bin_to_num_basic(self):
     expected = 123
     result = bin_to_num('{')
     assert expected == result
Ejemplo n.º 15
0
 def intdigest(self):
     if self.hd:
         return codec.bin_to_num(self.hd)