O'Reilly logo

Python: Essential Reference, Third Edition by David Beazley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

sha

The sha module implements the secure hash algorithm (SHA). SHA takes a sequence of input text and produces a 160-bit hash value. To compute the hash value, create an sha object using the new() function and feed data to it.

						new([string])

Returns a new sha object. If string is present, update(string) is called.

An instance, s, of an sha object has the following methods:

						s.update(arg)

Updates the sha object with the string arg.

						s.digest()

Returns the digest of all data passed to the object using the update() method and returns a 20-byte string that may contain nonprintable characters, including null bytes.

						s.copy()

Returns a copy of the sha object.

						s.hexdigest()

Returns the digest value as a string of hexadecimal digits.

Note

The SHA algorithm ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required