pycryptonight

Python wrappers for CryptoNight


License
GPL-2.0+
Install
pip install pycryptonight==0.0.1

Documentation

pycryptonight

This an easy-use python-wrapper lib to give cryptonight hashing functions.

Install:

You can install it from git repo.

git clone https://github.com/maoxs2/pycryptonight
cd pycryptonight
python setup.py install

Also, you can directly install by pypi

pip install pycryptonight

Usage:

from pycryptonight import cpu_has_aes_in_supported, cryptolite_hash, cryptonite_hash

HAS_AES_NI = cpu_has_aes_in_supported() # return a bool

blob_hex = job_params.get("blob")

try:
    blob_bin = unhexlify(blob_hex)
    nonce = long( hexlify(blob_bin[39:43]), 16)
    assert(len(blob_bin) == 76)
    assert(nonce >= 0)
except:
    log("Invalid stratum blob: %s" % blob_hex, LEVEL_ERROR, self._pool_id)

cryptonite_hash(blob_bin, HAS_AES_NI) # or cryptolite

# Gather Codes from SumokoinEasyMiner

Work well under python2.7 & python3.5 on Ubuntu16.04