CI/CD | |
Package | |
Meta |
Pure python implementation of SHA256 with features which are often lacking:
- bit granularity for message input length
- import/export API to "persist" the state in the middle of a hash computation
User documentation is hosted on readthedocs.
python3 -m pip install sha256bit
>>> from sha256bit import Sha256bit
>>> Sha256bit("abc".encode()).hexdigest()
'ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad'
>>> from sha256bit import Sha256bit
>>> Sha256bit(b'\x00',bitlen=1).hexdigest()
'bd4f9e98beb68c6ead3243b1b4c7fed75fa4feaab1f84795cbd8a98676a2a375'
>>> from sha256bit import Sha256bit
>>> h1 = Sha256bit("a".encode())
>>> state = h1.export_state()
>>> h2 = Sha256bit.import_state(state)
>>> h2.update("bc".encode())
>>> h2.hexdigest()
'ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad'
pytest-3
Tests can run without creating/installing the package:
python3 -m test.test
you can also run each test separately:
python3 -m test.test_api
python3 -m test.test_cavp
python3 -m test.test_hardcoded
python3 -m test.test_vs_hashlib
cd docs
pipenv shell
make clean doctest html
cd docs
pipenv shell
#use pip to update whatever ou want
pip freeze > requirements.txt
pipenv update
Build is done using hatchling
. The script build
allows to build for different version of python3:
./build python3.9
Version is managed by hatch-vcs
, you just need to create a tag in github.
They use the configuration from pyproject.toml
./lint