e173e05daa60db7a04785cb4d7a0daf4bdf153c3
[python-cryptoplus.git] / src / CryptoPlus / Hash / python_SHA.py
blobe173e05daa60db7a04785cb4d7a0daf4bdf153c3
1 import pysha
3 __all__ = ['new','digest_size']
5 def new(data=""):
6 """Create a new pure python SHA hash object
8 data = initial input (raw string) to the hashing object
9 if present, the method call update(arg) is made
11 EXAMPLE: FIPS 180-2
12 =========
14 >>> from CryptoPlus.Hash import python_SHA
16 >>> message = "abc"
17 >>> hasher = python_SHA.new()
18 >>> hasher.update(message)
19 >>> hasher.hexdigest()
20 'a9993e364706816aba3e25717850c26c9cd0d89d'
22 >>> message = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
23 >>> hasher = python_SHA.new()
24 >>> hasher.update(message)
25 >>> hasher.hexdigest()
26 '84983e441c3bd26ebaae4aa1f95129e5e54670f1'
27 """
28 return pysha.new(data)
30 digest_size = pysha.digest_size