Wednesday, April 2, 2008

How to SHA1 hash in python tutorial

import sha
resp = raw_input("What to SHA1? ")
hash =
print hash.hexdigest()

First line is importing the sha library.
Second line is printing "What to SHA1" then listening to a response, and putting that response into a variable named resp.
Third line is declaring a variable, hash, and that it is a new sha
Fourth line is saying update "hash" with the response of the user and sha it.
Last line print it.
This needs to be saved in a file with a .py extension and run from the cmd line.

No comments: