Skip to content

Commit f8da6fc

Browse files
committed
initial commit
0 parents  commit f8da6fc

10 files changed

+6390
-0
lines changed

.gitignore

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
*.bak
2+
3+
__pycache__/
4+
*.py[cod]
5+
*.so
6+
7+
# Distribution / packaging
8+
build/
9+
dist/
10+
*.egg-info/

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "MetroHash"]
2+
path = MetroHash
3+
url = https://github.com/jandrewrogers/MetroHash

LICENSE

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
The ISC License
2+
3+
Copyright (c) 2019, Dobatymo
4+
5+
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
6+
7+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

MANIFEST.in

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include MetroHash/src/*.h

MetroHash

Submodule MetroHash added at 690a521

README.md

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# metrohash-python
2+
3+
Python bindings for the fast non-cryptograpical hash function MetroHash. MetroHash C++ library by J. Andrew Rogers, Python bindings by Dobatymo.
4+
5+
## Requirements
6+
7+
The library has been tested on Linux Python 2.7 and 3.6, and on Windows Python 3.5, 3.6, 3.7.
8+
9+
## Install
10+
11+
```
12+
pip install metrohash-python
13+
```
14+
15+
Compilation requires a C++ compiler and optionally `Cython`.
16+
17+
## Examples
18+
19+
The usage is similar to Python's hashlib.
20+
21+
```python
22+
>>> import metrohash
23+
>>> h = metrohash.MetroHash128()
24+
>>> h.update(b'asd')
25+
>>> h.update(b'qwe')
26+
>>> h.digest()
27+
b'K\xfb\x17\xeb>\xb2W\xbd\x93\xad\xf6\x17\xceg\x14\xda'
28+
>>> h.hexdigest()
29+
'4bfb17eb3eb257bd93adf617ce6714da'
30+
```
31+
32+
Or as simple non-incremental function:
33+
34+
```python
35+
>>> import metrohash
36+
>>> metrohash.metrohash128(b'asdqwe')
37+
b'K\xfb\x17\xeb>\xb2W\xbd\x93\xad\xf6\x17\xceg\x14\xda'
38+
```
39+
40+
The interface for `MetroHash64` and `metrohash64` is the same.

0 commit comments

Comments
 (0)