示例#1
0
 def test_integers(self):
     digits = b'123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
     for i in range(len(digits)):
         char = digits[i:i + 1]
         self.assertEqual(_b58decode_to_int(char), i)
         self.assertEqual(_b58encode_from_int(i), char)
     number = 0x111d38e5fc9071ffcd20b4a763cc9ae4f252bb4e48fd66a835e252ada93ff480d6dd43dc62a641155a5
     self.assertEqual(_b58decode_to_int(digits), number)
     self.assertEqual(_b58encode_from_int(number), digits[1:])
示例#2
0
def test_integers() -> None:
    digits = b"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
    for i in range(len(digits)):
        char = digits[i:i + 1]
        assert _b58decode_to_int(char) == i
        assert _b58encode_from_int(i) == char
    number = ("0111d38e5fc9071ffcd20b4a763cc9ae4f252bb4e4"
              "8fd66a835e252ada93ff480d6dd43dc62a641155a5")
    n = int(number, 16)
    assert _b58decode_to_int(digits) == n
    assert _b58encode_from_int(n) == digits[1:]