Created
November 29, 2016 11:17
-
-
Save christ0pher/3d0cbba0c8baf35eebcacdbf3c9128ce to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import base64 | |
import uuid | |
__author__ = '[email protected]' | |
def enc_uuid(uid): | |
uuid_uid = uuid.UUID(uid) | |
uuid_uid_bytes = uuid_uid.bytes | |
uuid_uid_bytes_64 = base64.urlsafe_b64encode(uuid_uid_bytes) | |
return uuid_uid_bytes_64.decode() | |
def dec_uuid(uid): | |
uuid_uid_bytes_64 = base64.urlsafe_b64decode(uid) | |
uuid_dec = uuid.UUID(bytes=uuid_uid_bytes_64) | |
return str(uuid_dec) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment