b8f223b3b57d07b260ad5d6561ebc493305fe311
[python-cryptoplus.git] / src / CryptoPlus / Hash / python_whirlpool.py
blobb8f223b3b57d07b260ad5d6561ebc493305fe311
1 import pywhirlpool
3 __all__ = ['new','digest_size']
5 def new(data=""):
6 """Create a new pure python Whirlpool hash object
8 data = initial input (raw string) to the hashing object
9 if present, the method call update(arg) is made
11 EXAMPLE: (http://paginas.terra.com.br/informatica/paulobarreto/WhirlpoolPage.html)
12 =========
14 >>> from CryptoPlus.Hash import python_whirlpool
16 >>> message = "abc"
17 >>> hasher = python_whirlpool.new()
18 >>> hasher.update(message)
19 >>> hasher.hexdigest().upper()
20 '4E2448A4C6F486BB16B6562C73B4020BF3043E3A731BCE721AE1B303D97E6D4C7181EEBDB6C57E277D0E34957114CBD6C797FC9D95D8B582D225292076D4EEF5'
22 >>> message = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
23 >>> hasher = python_whirlpool.new()
24 >>> hasher.update(message)
25 >>> hasher.hexdigest().upper()
26 'DC37E008CF9EE69BF11F00ED9ABA26901DD7C28CDEC066CC6AF42E40F82F3A1E08EBA26629129D8FB7CB57211B9281A65517CC879D7B962142C65F5A7AF01467'
27 """
28 return pywhirlpool.new(data)
30 digest_size = pywhirlpool.digest_size