Last active
December 23, 2015 06:29
-
-
Save kouk/6594128 to your computer and use it in GitHub Desktop.
base58 ID with AES (pyCrypto)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from Crypto.Cipher import AES | |
from base58 import b58encode | |
shard = {'id': 5, 'pw': 'myshardpw16bytes'} | |
id = "%016d-" % shard['id'] | |
id += AES.new('myshardpw16bytes').encrypt("%016d"%1) | |
assert b58encode(id) == 'FKGJyhKSHVaem5JbQqmBLTcgHzBtp7D3UGZPuPqSB8PN9' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment