Skip to content

Instantly share code, notes, and snippets.

@ruanbekker
Created April 30, 2018 06:09
Show Gist options
  • Save ruanbekker/c30a6602c5b45fcf2cfa565d255b23ae to your computer and use it in GitHub Desktop.
Save ruanbekker/c30a6602c5b45fcf2cfa565d255b23ae to your computer and use it in GitHub Desktop.
Generate 16 or 32 Byte Readable Strings with Python
>>> import random, string
>>> key = ''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for x in range(32))
>>> iv = ''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for x in range(16))
>>> print(key, len(key))
('eXS8qhYpisQf4zm60pBeMGbCTh5dfXiQ', 32)
>>> print(iv, len(iv))
('mjVRMZ3WSd31fEVn', 16)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment