コード例 #1
0
from basehash import HASH_LENGTH, base36, base52, base56, base58, base62, base94

base36 = base36()
base52 = base52()
base56 = base56()
base58 = base58()
base62 = base62()
base94 = base94()

# Base encode an integer/long
print(base36.encode(200))
print(base52.encode(200))
print(base56.encode(200))
print(base58.encode(200))
print(base62.encode(200))
print(base94.encode(200))

# Base decode encoded string.
print(base36.decode('5K'))
print(base52.decode('3r'))
print(base56.decode('5a'))
print(base58.decode('4T'))
print(base62.decode('3E'))
print(base94.decode('#-'))

# Base hash an integer/long
# Takes an option param, length, which is defaulted to
# basehash.base.HASH_LENGTH
print(base36.hash(200))
print(base52.hash(200))
print(base56.hash(200))
コード例 #2
0
def test_base62_encode_with_1234567890_1LY7VK():
    assert base62.encode(1234567890) == '1LY7VK'
コード例 #3
0
def test_base62_encode_with_1234567890_1LY7VK():
    assert base62.encode(1234567890) == '1LY7VK'
コード例 #4
0
ファイル: examples.py プロジェクト: calve/python-basehash
from basehash import HASH_LENGTH, base36, base52, base56, base58, base62, base94

base36 = base36()
base52 = base52()
base56 = base56()
base58 = base58()
base62 = base62()
base94 = base94()


# Base encode an integer/long
print base36.encode(200)
print base52.encode(200)
print base56.encode(200)
print base58.encode(200)
print base62.encode(200)
print base94.encode(200)

# Base decode encoded string.
print base36.decode("5K")
print base52.decode("3r")
print base56.decode("5a")
print base58.decode("4T")
print base62.decode("3E")
print base94.decode("#-")

# Base hash an integer/long
# Takes an option param, length, which is defaulted to
# basehash.base.HASH_LENGTH
print base36.hash(200)
print base52.hash(200)
コード例 #5
0
ファイル: examples.py プロジェクト: x2nie/python-basehash
from basehash import HASH_LENGTH, base36, base52, base56, base58, base62, base94

base36 = base36()
base52 = base52()
base56 = base56()
base58 = base58()
base62 = base62()
base94 = base94()


# Base encode an integer/long
print base36.encode(200)
print base52.encode(200)
print base56.encode(200)
print base58.encode(200)
print base62.encode(200)
print base94.encode(200)

# Base decode encoded string.
print base36.decode('5K')
print base52.decode('3r')
print base56.decode('5a')
print base58.decode('4T')
print base62.decode('3E')
print base94.decode('#-')

# Base hash an integer/long
# Takes an option param, length, which is defaulted to
# basehash.base.HASH_LENGTH
print base36.hash(200)
print base52.hash(200)