The sha Module

The sha module provides an alternative way to calculate message signatures, as shown in Example 2-39. It's similar to the md5 module, but generates 160-bit signatures instead.

Example 2-39. Using the sha Module

File: sha-example-1.py

import sha

hash = sha.new()
hash.update("spam, spam, and eggs")

print repr(hash.digest())
print hash.hexdigest()

'3213330326I331272-j303247240345343Tvq364346311'
d1db031649d9ba2d6ac3a7a0e5e3547671f4e6c9

See the md5 examples for more ways to use sha signatures.

Core Modules

More Standard Modules

Threads and Processes

Data Representation

File Formats

Mail and News Message Processing

Network Protocols

Internationalization

Multimedia Modules

Data Storage

Tools and Utilities

Platform-Specific Modules

Implementation Support Modules

Other Modules



Python Standard Library
Python Standard Library (Nutshell Handbooks) with
ISBN: 0596000960
EAN: 2147483647
Year: 2000
Pages: 252
Authors: Fredrik Lundh

Flylib.com © 2008-2020.
If you may any questions please contact us: flylib@qtcs.net