Chilkat2-Python
Chilkat2-Python
Base62 Encoding and Decoding
Demonstrates base62 encoding and decoding.Chilkat Chilkat2-Python Downloads
import chilkat2
bd = chilkat2.BinData()
# Base62 encode.
bd.AppendString("hello world","utf-8")
base62_encoded = bd.GetEncoded("base62")
print("hello world --> " + base62_encoded)
# Output:
# hello world --> AAwf93rvy4aWQVw
# Base62 decode
sb = chilkat2.StringBuilder()
sb.DecodeAndAppend("AAwf93rvy4aWQVw","base62","utf-8")
print("decoded: " + sb.GetAsString())
# Output:
# decoded: hello world