Crates.io | two-party-hash |
lib.rs | two-party-hash |
version | 0.1.0 |
source | src |
created_at | 2019-06-29 18:48:48.77957 |
updated_at | 2019-06-29 18:48:48.77957 |
description | Generate a hash between two different parties without revealing preimages |
homepage | |
repository | https://github.com/elichai/two-party-hash |
max_upload_size | |
id | 144584 |
size | 30,199 |
A Rust binary to demonstrate how 2 parties can come up with a hash when each one knows just part of the preimage.
With Rust's package manager cargo, you can install it via:
cargo install --force two-party-hash
First Party:
two-party-hash first
Second Party:
two-party-hash second <first-party-hash>
Hash them together with regular concatination
two-party-hash verify <first-preimage> <second-preimage>
$ two-party-hash first
Preimage: 0x5904b7c57d0ae7afcb13a0c75e156c4f01d7fae4e530d12d896673885f9b38f3b3d58f3912e9d07d425e9792949895fd9f391231185df39487bd5f22ce017627
Non finalized hashed: 0xfcf89320f4b984683b93ef1e3ebbb33ea4a880b8dd1a685f142af9ab2fef5c46
$ two-party-hash second 0xfcf89320f4b984683b93ef1e3ebbb33ea4a880b8dd1a685f142af9ab2fef5c46
Preimage: 0x23e1c69b26401525173be914bdd718b9bfd74a655e9330e0c3cfe8f6bf1ed80e
Final hashed: 0x54c4289d02d9e4ae99e04bad638911c0236226c0ee20ba820fa856e6f5802911
$ two-party-hash verify 0x5904b7c57d0ae7afcb13a0c75e156c4f01d7fae4e530d12d896673885f9b38f3b3d58f3912e9d07d425e9792949895fd9f391231185df39487bd5f22ce017627 0x23e1c69b26401525173be914bdd718b9bfd74a655e9330e0c3cfe8f6bf1ed80e
Regular hash of both preimages: 0x54c4289d02d9e4ae99e04bad638911c0236226c0ee20ba820fa856e6f5802911