Skip to content

Instantly share code, notes, and snippets.

@amintos
Created February 12, 2013 10:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amintos/4761533 to your computer and use it in GitHub Desktop.
Save amintos/4761533 to your computer and use it in GitHub Desktop.
Method generating a string of given length which is its own prefix in base64 encoding.
def base64_fixpoint(prefix_len):
s = 'rofl'
t = 'lol'
while s != t:
s = t
t = s.encode("base64")[:prefix_len]
return t
@niccokunzmann
Copy link

Python3:

import base64
base64.b64encode(b"Vm0wd2QyUXlVWGxWV0d4V1YwZDRWMVl3WkRSV01WbD")[:42]
b'Vm0wd2QyUXlVWGxWV0d4V1YwZDRWMVl3WkRSV01WbD'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment