Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kmyk/libproofofwork
Simple hash-mining c library and its python binding.
https://github.com/kmyk/libproofofwork
hash md5 python-bindings sha1
Last synced: 21 days ago
JSON representation
Simple hash-mining c library and its python binding.
- Host: GitHub
- URL: https://github.com/kmyk/libproofofwork
- Owner: kmyk
- License: mit
- Archived: true
- Created: 2017-03-15T16:14:04.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-06-28T12:28:39.000Z (over 5 years ago)
- Last Synced: 2024-05-01T14:11:02.982Z (7 months ago)
- Topics: hash, md5, python-bindings, sha1
- Language: C
- Size: 58.6 KB
- Stars: 65
- Watchers: 3
- Forks: 4
- Open Issues: 6
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
- awesome-hacking-lists - kmyk/libproofofwork - Simple hash-mining c library and its python binding. (C)
README
# libProofOfWork
[![Travis](https://img.shields.io/travis/kmyk/libproofofwork.svg)](https://travis-ci.org/kmyk/libproofofwork)
![PyPI](https://img.shields.io/pypi/l/proofofwork.svg)
![PyPI](https://img.shields.io/pypi/pyversions/proofofwork.svg)
![PyPI](https://img.shields.io/pypi/status/proofofwork.svg)
[![PyPI](https://img.shields.io/pypi/v/proofofwork.svg)](https://pypi.python.org/pypi/proofofwork)Simple hash-mining c library and its python binding.
## Requirements
- `cmake` and things to build
- non-old CPU for AVX2 instructions
- Check `flags` sections of your `/proc/cpuinfo`.
- OpenMP (optional)## How to Install
``` sh
$ pip install proofofwork
```## How to Use
``` python
>>> import proofofwork
>>> import hashlib>>> s = proofofwork.md5('00000000')
>>> s
b'erno8AAA'
>>> hashlib.md5(s).hexdigest()
'0000000057c4ca67d38e6826053824bd'>>> s = proofofwork.sha1('000??????????????????????????????????000', text=b'sha1{????????}', alphabet=bytes(range(128, 256)))
>>> s
b'sha1{\xcb\xf0\xa4\x80\x80\x80\x80\xe0}'
>>> hashlib.sha1(s).hexdigest()
'00099d6917591c54f861032fd0d0071fbc647000'
```## Benchmark
### MD5
In my laptop environment (`Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz`),
| Code | Speed [hashes/sec] |
| -------------- | ------------------:|
| libproofofwork | 158000000 |
| C openssl | 5890000 |
| python hashlib | 794000 |### SHA1
In my laptop environment (`Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz`),
| Code | Speed [hases/sec] |
| -------------- | -----------------:|
| libproofofwork | 83700000 |
| C openssl | 6360000 |
| python hashlib | 815000 |## License
MIT License