Skip to content

Instantly share code, notes, and snippets.

@zezic
Created August 3, 2019 09:57
Show Gist options
  • Save zezic/2ba23b35e153f76ecf6b3c966d7acb70 to your computer and use it in GitHub Desktop.
Save zezic/2ba23b35e153f76ecf6b3c966d7acb70 to your computer and use it in GitHub Desktop.
Text Encoding Test
import base64
import binascii
import string
while True:
print('Input Certificate Serial Number:')
text_bytes = bytes.fromhex(''.join([
char for char in input('> ')
if char in string.hexdigits
]))
print('Base64:', base64.b64encode(text_bytes).decode('utf-8'))
print('Base85:', base64.b85encode(text_bytes).decode('utf-8'))
print('')
$ python3 enctest.py
Input Certificate Serial Number:
> 03:4A:72:43:1B:35:86:E7:D1:F9:22:2B:03:F6:9E:15:3E:54
Base64: A0pyQxs1hufR+SIrA/aeFT5U
Base85: 14?p38#RXK(fJ}P1NNR3K2!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment