A simple proof of work using SHA-256 hashes
Project description
Proof of work
A simple Proof Of Work module made with python
POW ALGORITHM
The algorythm used in this module is very simple: The inputs are an initial SHA-256 hash (that could be the last proof of work hash, like in bitcoin system) and a difficult in number of zeroes. That means the number of zeroes that the resulting hash must have at it's begining.
Starting with those two arguments, the script now makes a new random hash. That's the proof of work. This new hash has to meet a condition:
- The new hash is attached to the initial hash
- The script now converts those two joint hashes (initial + new) into another hash. (Resulting hash)
- If the resulting hash begins with the specified number of zeroes, the proof of work is valid.
- The information returned is: (proof_of_work_hash, resulting_hash, number_of_attempts)
Notice that the resulting hash may have more zeroes than the specified. The difficult is a minimum.
For curious people: What is a proof of work?
Other methods
proof_of_work() is not the only method contained in this module. Here's an explanation of some others:
- random_hash(): Returns a random SHA-256 hash.
- make_hash(string): Converts a string into a SHA-256 hash.
How to use it
From pip: pip install powpy
From github repository: Download and run setup.py
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file powpy-0.1.1.tar.gz.
File metadata
- Download URL: powpy-0.1.1.tar.gz
- Upload date:
- Size: 2.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f9f629aa26701ba78d654064cb360ad22892fad6c1eadcfc92cffad13945d538
|
|
| MD5 |
f14f25e2bd29906edb3ccf3c9f94fe21
|
|
| BLAKE2b-256 |
9dc92f1655f5ac64f58232b7acfc4df3607ef8682871aa0573fcf533c386da73
|
File details
Details for the file powpy-0.1.1-py3-none-any.whl.
File metadata
- Download URL: powpy-0.1.1-py3-none-any.whl
- Upload date:
- Size: 2.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a7dd54d9e1b1d88be7767b500c6efb567b0e6d4b385a079bac5d89afbebd78c
|
|
| MD5 |
f06e81c1d71089648aa8b15835aa17fa
|
|
| BLAKE2b-256 |
13626587e82bd3823fd4f9b752cafe04064ef003bd65cfc01588344b802768b4
|