json fingerprinting tool for creating consistent and comparable checksums of unordered json data
Project description
The json-fingerprint package provides easy checksum creation ("fingerprinting") from unordered JSON data.
Installation and use
To install the package, run pip install json-fingerprint
.
Below is a sample for creating simple fingerprints:
import json
import json_fingerprint as jfp
obj_1_str = json.dumps([3, 2, 1, {"foo": "bar"}])
obj_2_str = json.dumps([2, {"foo": "bar"}, 1, 3])
fp_1 = jfp.json_fingerprint(obj_1_str, hash_function='sha256', version=1)
fp_2 = jfp.json_fingerprint(obj_2_str, hash_function='sha256', version=1)
print(f'fp_1: {fp_1}')
print(f'fp_2: {fp_2}')
This will output two identical fingerprints regardless of the different ordering of the json elements:
fp_1: jfpv1$sha256$5815eb0ce6f4e5ab0a771cce2a8c5432f64222f8fd84b4cc2d38e4621fae86af
fp_2: jfpv1$sha256$5815eb0ce6f4e5ab0a771cce2a8c5432f64222f8fd84b4cc2d38e4621fae86af
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
json-fingerprint-0.1.5.tar.gz
(4.3 kB
view hashes)
Built Distribution
Close
Hashes for json_fingerprint-0.1.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 18bbf36f5fd4e7950c2496e381a8588c13774b998fa1e5005352bd7d7c499a00 |
|
MD5 | 12eb063c6ddc64f16fa64df3ea77c632 |
|
BLAKE2b-256 | 4b00e93d46f8e33f8c79847e6cf506b9b7cdf83f0e6363b9a078607c4f257b59 |