Package Crypto :: Package Hash :: Module SHA
[frames] | no frames]

Module SHA

SHA-1 cryptographic hash algorithm.

SHA-1 produces the 160 bit digest of a message.

>>> from Crypto.Hash import SHA
>>>
>>> h = SHA.new()
>>> h.update(b'Hello')
>>> print h.hexdigest()

SHA stands for Secure Hash Algorithm.

This algorithm is not considered secure. Do not use it for new designs.

Classes
  SHA1Hash
Class that implements a SHA-1 hash
Functions
 
new(data=None)
Return a fresh instance of the hash object.
Variables
  digest_size = 20
The size of the resulting hash in bytes.
Function Details

new(data=None)

 
Return a fresh instance of the hash object.
Parameters:
  • data (byte string) - The very first chunk of the message to hash. It is equivalent to an early call to SHA1Hash.update(). Optional.
Returns:
A SHA1Hash object