Python wrapper around poly1305_donna by floodberry
Project description
py_poly1305_donna
Fork of poly1305-donna by floodberry (https://github.com/floodyberry/poly1305-donna) adding a Python wrapper as an extension module
What is a HMAC (Hash-based Message Authentication Code)?
From wikipedia (https://en.wikipedia.org/wiki/Hash-based_message_authentication_code):
In cryptography, a keyed-hash message authentication code (HMAC) is a specific construction for calculating a message authentication code (MAC) involving a cryptographic hash function in combination with a secret cryptographic key. As with any MAC, it may be used to simultaneously verify both the data integrity and the authentication of a message. Any cryptographic hash function, such as MD5 or SHA-1, may be used in the calculation of an HMAC; the resulting MAC algorithm is termed HMAC-MD5 or HMAC-SHA1 accordingly. The cryptographic strength of the HMAC depends upon the cryptographic strength of the underlying hash function, the size of its hash output, and on the size and quality of the key.
What is poly1305?
From http://cr.yp.to/mac.html:
Poly1305-AES is a state-of-the-art secret-key message-authentication code suitable for a wide variety of applications. Poly1305-AES computes a 16-byte authenticator of a message of any length, using a 16-byte nonce (unique message number) and a 32-byte secret key. Attackers can’t modify or forge messages if the message sender transmits an authenticator along with each message and the message receiver checks each authenticator.
LICENSE:
Following floodberry’s code license, this code is also released into the public domain. See LICENSE file.
The ‘floodberry.poly1305_donna’ directory contains the unmodified source code forked from poly1305-donna from https://github.com/floodyberry/poly1305-donna
EXAMPLES
from poly1305_donna import ( self_test, get_key, authenticate, verify, ) print('Power-On Self Test result: ' + str(self_test())) msg = 'Hello world' print('\nTest class methods - authenticate, verify') kr = get_key() auth = authenticate(kr, msg) bad_kr = get_key() bad_msg = msg + '1' bad_auth = authenticate(kr, bad_msg) print('Good: %s\nBad auth: %s\nBad kr: %s\nBad msg: %s' % ( str(verify(auth, kr, msg)), str(verify(bad_auth, kr, msg)), str(verify(auth, bad_kr, msg)), str(verify(auth, kr, bad_msg)) ))
Alternately, run the test script that is shipped:
python -m poly1305_donna.test
To run a simple benchmark:
python -m poly1305_donna.benchmark
INSTALLATION
Using pip:
pip install 'git+https://github.com/sundarnagarajan/py_poly1305-donna.git'
Using setup.py:
python setup.py install
BUILD / INSTALL REQUIREMENTS
GNU/Linux:
Python Tested on 2.7.6, 3.4.3, pypy 2.7.10 (pypy 4.0.1)
cffi >= 1.0.0
six
Python.h (libpython-dev on Debian-like systems)
gcc (build-essential on Debian-like systems)
NOTES
py_poly1305_donna does not offer an API for incremental update and HMAC calculation.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file poly1305_donna-0.11.15.tar.gz
.
File metadata
- Download URL: poly1305_donna-0.11.15.tar.gz
- Upload date:
- Size: 16.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4467d34c4cbab1ec6e2f61d16d1a256a19b96fd8ad89696643282a7163704d17 |
|
MD5 | a2303d032cb0b9df1af9aef0ce32270a |
|
BLAKE2b-256 | 78b972b7778a05714973b24be1f103d0a194ca66b8a0519a1334511928d14e7e |