Add compressed lamport pubkey fingerprint#78
Open
danielemiliogarcia wants to merge 13 commits intodevfrom
Open
Add compressed lamport pubkey fingerprint#78danielemiliogarcia wants to merge 13 commits intodevfrom
danielemiliogarcia wants to merge 13 commits intodevfrom
Conversation
Comment on lines
+143
to
+150
| println!( | ||
| "\nSerialized compressed Lamport public key ({} bytes)", | ||
| serialized_compressed.len() | ||
| ); | ||
| println!( | ||
| "Serialized uncompressed Lamport public key ({} bytes)", | ||
| serialized_uncompressed.len() | ||
| ); |
Contributor
Author
There was a problem hiding this comment.
Serialized compressed Lamport public key (51 bytes)
Serialized uncompressed Lamport public key (20515 bytes)
examples/sign_verify_lamport.rs
Outdated
Comment on lines
+32
to
+42
|
|
||
| // Difference in size between serialized compressed and uncompressed public key | ||
| println!( | ||
| "\nSerialized compressed Lamport public key ({} bytes)", | ||
| bincode::serialize(&lamport_pubkey.to_compressed()).unwrap().len() | ||
| ); | ||
| println!( | ||
| "Serialized uncompressed Lamport public key ({} bytes)", | ||
| bincode::serialize(&lamport_pubkey).unwrap().len() | ||
| ); | ||
|
|
Contributor
Author
There was a problem hiding this comment.
Even at 1 bit level (as used for garbled circuits wire labels values) the compression reduces the key > 2x
Serialized compressed Lamport public key (51 bytes)
Serialized uncompressed Lamport public key (115 bytes)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add compressed lamport pubkey fingerprint
This PR introduces a compressed representation of
LamportPublicKeyto reduce storage and transmission size, along with a matching expansion API that re-derives or reloads the full key and verifies integrity via BLAKE3.Motivation
A Lamport public key grows linearly with the message bit length: a key for a 256-bit message already serialises to several kilobytes. Storing or passing the full key around adds unnecessary overhead. This PR addresses that by separating the identity of a key (its BLAKE3 fingerprint + metadata) from its full material.
Example size comparison (from the updated example output):
The ratio grows with
message_bit_length.Changes
New type -
LamportCompressedPubKeyLamportPublicKey::to_compressed()and theFrom<&LamportPublicKey>impl construct it automatically.verify_against(&LamportPublicKey)checks that a re-derived key still matches the stored fingerprint.New trait -
LamportPubKeyIdImplemented by both
LamportPublicKey(computes on the fly) andLamportCompressedPubKey(returns storedid). Used to unify operations.New function -
KeyManager::expand_lamport()Reconstructs the full
LamportPublicKeyAfter reconstruction, the BLAKE3 fingerprint is verified against the stored
idTests
Unit tests have been added