No project description provided
Project description
hoshrust (see hosh for the implementation of the current specification)
Fast cryptographic 22-digit hash and operators for Rust and Python. This is based on the Symmetric group, which is not robust to many repetitions (see hosh for a robust 40-digit version).
Python installation
from package
# Set up a virtualenv.
python3 -m venv venv
source venv/bin/activate
# Install from PyPI
pip install hoshrust
from source
cd my-project
git clone https://github.com/davips/hoshrust ../hoshrust
pip install -e ../hoshrust
Examples
Basic operations
from hoshrust import Hash
# Hashes can be multiplied.
a = Hash(blob=b"Some large binary content...")
b = Hash(blob=b"Some other binary content. Might be, e.g., an action or another large content.")
c = a * b
print(f"{a} * {b} = {c}")
"""
0v58YxIhaae5NfYuXsoC1i * 04orKjYHAZraYORILOVwos = 3yT1A5oLlW2HpjSkgzo2yg
"""
# Multiplication can be reverted by the inverse hash. Zero is the identity hash.
print(f"{b} * {~b} = {b * ~b} = 0")
"""
04orKjYHAZraYORILOVwos * 211eErwhEiGnit0beo4tjo = 0000000000000000000000 = 0
"""
print(f"{c} * {~b} = {c * ~b} = {a} = a")
"""
3yT1A5oLlW2HpjSkgzo2yg * 211eErwhEiGnit0beo4tjo = 0v58YxIhaae5NfYuXsoC1i = 0v58YxIhaae5NfYuXsoC1i = a
"""
print(f"{~a} * {c} = {~a * c} = {b} = b")
"""
4q4X1jczNK2eKCV4uxEPNk * 3yT1A5oLlW2HpjSkgzo2yg = 04orKjYHAZraYORILOVwos = 04orKjYHAZraYORILOVwos = b
"""
# Division is shorthand for reversion.
print(f"{c} / {b} = {c / b} = a")
"""
3yT1A5oLlW2HpjSkgzo2yg / 04orKjYHAZraYORILOVwos = 0v58YxIhaae5NfYuXsoC1i = a
"""
# Hash multiplication is not expected to be commutative.
print(f"{a * b} != {b * a}")
"""
3yT1A5oLlW2HpjSkgzo2yg != 4AvOF9Fbhakd26mosfuuvR
"""
# Hash multiplication is associative.
print(f"{a * (b * c)} = {(a * b) * c}")
"""
51UdYbEAGI5mVogE4aFFKe = 51UdYbEAGI5mVogE4aFFKe
"""
Features
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
hoshrust-0.211225.0.tar.gz
(6.1 MB
view hashes)
Built Distributions
Close
Hashes for hoshrust-0.211225.0-cp39-cp39-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d1cde29e2295b41822d92ef380a5df661354a7ebd0bc97e9b1d93d6c443e09fd |
|
MD5 | 94b31fc663fec9b6d4a117853a39df49 |
|
BLAKE2b-256 | dbbb2f6306c10dd8abc3960f8739bd263b5432392b4a9ddf575d930d78ffffc3 |
Close
Hashes for hoshrust-0.211225.0-cp39-cp39-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | afa4830d984ea461de89357d49bab48d242dc3b0c27c1a565e1f977c2e3dc243 |
|
MD5 | 9476caa82b3efb369c8ad40ba2b4fdcc |
|
BLAKE2b-256 | b3205d873391788b2935bc104dda39eb94daa558fa8cbd386063b447ca1f9a3a |
Close
Hashes for hoshrust-0.211225.0-cp38-cp38-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e873044953047a5d873a119721d8286d5d1fa16abf0b77228ba4a87f64b7725e |
|
MD5 | 130b85a12f612913a11b4ff99102f1c6 |
|
BLAKE2b-256 | 8ed228c6a5d35149536e8f981b5e6465ac0a5147a1c5cc486c7f22cffab213bb |
Close
Hashes for hoshrust-0.211225.0-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d5de4edd133dbcb59035980b18e8a27c27af8a6e78ca2abeaf4610c320aa3b81 |
|
MD5 | 6246e95900eeb413a69ce620354eac90 |
|
BLAKE2b-256 | 4833206e4d49b33027baeb90368227b23e4e09add302f8a52ae02b54716f5a0f |
Close
Hashes for hoshrust-0.211225.0-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ab0abb0ec33bff39c53169a8d577482ed2348f0a20f776ddc1d3c72f638d3e7 |
|
MD5 | 19dd2a5b7aa21ae9d914d7f32295a871 |
|
BLAKE2b-256 | 461ea9e057cf92928a32b2909d0c99721b84e4877589c4103dc0cf67877e7705 |
Close
Hashes for hoshrust-0.211225.0-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ddb909de643bd906a4b22d0681c07c1bbe2a035e622640d22bb1047339746ff |
|
MD5 | 5e8359a6f22faf0137daf1efb58559ed |
|
BLAKE2b-256 | 19900b2325f147b6541cb7fc377a560878d39500bfac206a7da0100fbbb7925b |
Close
Hashes for hoshrust-0.211225.0-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ad73216c60d0a07183b6fb9deedfedc0f7ccb36fc284ad03360b1209618bcb6d |
|
MD5 | 72daffc147554391063abe9e5f5d7253 |
|
BLAKE2b-256 | 1e4e038468d540d0a50fe2437e16873ed20bfdfc0286ac34e80799b72d4cbd13 |
Close
Hashes for hoshrust-0.211225.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5b6b2b410603904caf71b31962d6390fa41fae6a51fc1dce3ed91c6b21925775 |
|
MD5 | 6fa075944e282bbdf7e34595d1addb9d |
|
BLAKE2b-256 | fa23fd902f46c024273911b395c39ef0ed15d4045a7c4473a4b9d3c311f19a1b |