Skip to content

Instantly share code, notes, and snippets.

@arnauorriols
Created February 18, 2014 15:33
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 arnauorriols/9073232 to your computer and use it in GitHub Desktop.
Save arnauorriols/9073232 to your computer and use it in GitHub Desktop.
Python replacement for Encode.java used in OpenAM
# Python replacement for Encode.java used in OpenAM
#
# Author: Arnau orriols
from hashlib import sha1
from base64 import b64encode
from sys import argv
def encode(string):
return b64encode(sha1(string).digest())
if __name__ == "__main__":
if len(argv) == 2:
print encode(argv[1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment