2c771fb004771ed4683747368d98806741643a96
[python-cryptoplus.git] / src / CryptoPlus / Hash / python_SHA256.py
blob2c771fb004771ed4683747368d98806741643a96
1 from pysha256 import sha256
3 __all__ = ['new','digest_size']
5 def new(data=""):
6 """Create a new pure python SHA-256 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_SHA256
16 >>> message = "abc"
17 >>> hasher = python_SHA256.new()
18 >>> hasher.update(message)
19 >>> hasher.hexdigest()
20 'ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad'
22 >>> message = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
23 >>> hasher = python_SHA256.new()
24 >>> hasher.update(message)
25 >>> hasher.hexdigest()
26 '248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1'
27 """
28 return sha256(data)
30 digest_size = sha256.digest_size