An implementation of multiset hashing
Project description
pymsh
pymsh is an MIT-licensed implementation of the incremental multi-set hashing (MSH) scheme based on Clarke et al. [1] (ASIACRYPT '03).
Specifically, it supports XOR-based hashing for fast updates; BLAKE2B is used as the underlying hash function.
Usage
Simple: initialise the MSH()
class and call hash(...)
for hashing multisets directly, or update(...)
for incremental updates.
Examples:
from pymsh import pymsh
msh = pymsh.MSH()
m1 = msh.hash([b'apple', b'apple', b'banana'])
print(m1.hex()) # => Returns the multiset hash value of m1
msh.reset()
m2 = msh.hash([b'banana', b'apple', b'apple'])
print(m2.hex()) # => m2 will == m1
An example of the update function:
from pymsh import pymsh
msh = pymsh.MSH()
new_lst = [b'apple']
m3 = msh.hash(new_lst)
print(m3.hex())
m3 = msh.update(b'banana')
print(m3.hex())
m3 = msh.update(b'apple')
print(m3.hex()) # => Equivalent to m2 or m1 above
References
- Clarke, D., Devadas, S., van Dijk, M., Gassend, B., Suh, G.E. (2003). "Incremental Multiset Hash Functions and Their Application to Memory Integrity Checking." In: Advances in Cryptology - ASIACRYPT. Lecture Notes in Computer Science, vol 2894. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-40061-5_12
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pymsh-0.2.3.tar.gz
(2.9 kB
view details)
Built Distribution
pymsh-0.2.3-py3-none-any.whl
(3.6 kB
view details)
File details
Details for the file pymsh-0.2.3.tar.gz
.
File metadata
- Download URL: pymsh-0.2.3.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3bd7ced381e674792ae6a95d6f5debfc23b32afbb84018b09ae3288f8373907e |
|
MD5 | 645ef38eb2c31bf1b53dacf6803667bc |
|
BLAKE2b-256 | 129264de18cec1dd612811b317d2a6dfd34b5c09b8f736e95ce749a81564ee96 |
File details
Details for the file pymsh-0.2.3-py3-none-any.whl
.
File metadata
- Download URL: pymsh-0.2.3-py3-none-any.whl
- Upload date:
- Size: 3.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 22f7a63e70d66f7182b904992756b2bd6cbd9d73d6fa83e8fcf3ebc099574604 |
|
MD5 | 0536844e403a9e480226890df68479a8 |
|
BLAKE2b-256 | 2648d71113be5a90e80d9951543db95d251e3cdd7b893385a20744ab09eb4f82 |