-
Notifications
You must be signed in to change notification settings - Fork 0
feat: trait for signature and NCS impl over it #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 17 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
f1384e2
feat: trait for signature and NC1 impl over it
pedrohba1 a1e887e
feat(nc1): setup of parameters
pedrohba1 cd6bb18
refactor: use generic Pairing P instead of direct G1Projective
pedrohba1 1bead82
feat: keygen function
pedrohba1 638ffc7
feat: add sign and verify of single message
pedrohba1 e46b998
feat: aggregate and verify aggregate attempt
pedrohba1 c54ac50
feat: use lane_point aggregate in precompute instead of hash_scalar
pedrohba1 8ab5b2d
refactor: change Signature to AggregateSignature, regular indexes and…
pedrohba1 11641af
test: working test of aggregate and verify aggregate of signatures
pedrohba1 d966c4b
test: add verify of invalid singatur
pedrohba1 7244f27
refactor: remove unused commented code
pedrohba1 cc883dd
feat: use scalar weights in evaluate
pedrohba1 f286cf4
refactor: use generator() instead of random point in the curve
pedrohba1 b24557c
test: add keys to the params
pedrohba1 6176415
docs(cargo.toml): add new author to Cargo.toml
pedrohba1 448bea3
refactor: add only base generator
pedrohba1 ab14f0a
refactor: add allocation_id generate outside of precopute
pedrohba1 4197fc3
Merge branch 'main' into hs2s2-library-impl
pedrohba1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| [workspace] | ||
| members = [ | ||
| "h2s2", | ||
| ] | ||
|
|
||
|
|
||
| [workspace.dependencies] | ||
| ark-std = {version ="0.5.0", features = ["parallel"]} | ||
| ark-ec = {version = "0.5.0", features = ["parallel"]} | ||
| ark-ff = { version = "0.5", features = [ "parallel" ] } | ||
| blake2 = "0.10.6" | ||
| digest = "0.10.7" | ||
| rayon = "1.1" | ||
| ark-bn254 = "0.5.0" |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| [package] | ||
| name = "h2s2" | ||
| version = "0.1.0" | ||
| authors = [ | ||
| "Bryan Cole <bryan.cole@semiotic.ai>", | ||
| "Severiano Sisneros <severiano@semiotic.ai>", | ||
| "Alexis Asseman <alexis@semiotic.ai>", | ||
| "Tomasz Kornuta <tomasz@semiotic.ai>", | ||
| "Pedro Bufulin <pedro@semiotic.ai>", | ||
| ] | ||
| license = "Apache-2.0" | ||
| description = "" | ||
| edition = "2021" | ||
| keywords = ["holographic", "homomorphic", "signature-scheme"] | ||
| catagories = ["cryptography", "cryptography::cryptocurrencies"] | ||
|
|
||
| [dependencies] | ||
| ark-ec = {workspace = true} | ||
| ark-std = { workspace = true} | ||
| ark-ff = { workspace = true} | ||
| ark-bn254 = { workspace = true} | ||
| blake2 = {workspace = true} | ||
| rayon = { workspace = true} | ||
| digest = { workspace = true} | ||
| once_cell = "1.20.2" | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| use ark_ec::pairing::Pairing; | ||
| use ark_std::rand::Rng; | ||
| use digest::Digest; | ||
| use std::error::Error; | ||
|
|
||
| pub trait HolographicHomomorphicSignatureScheme<P: Pairing, D: Digest + Send + Sync> { | ||
| type Parameters; | ||
| type PublicKey; | ||
| type SecretKey; | ||
| type Signature; | ||
| type Message; | ||
| type Weight; | ||
| type AggregatedSignature; | ||
|
|
||
| /// Generate one G2 element and `n` G1 elements | ||
| fn setup(n: usize) -> Result<Self::Parameters, Box<dyn Error>>; | ||
|
|
||
| /// Generate hash aggregate (H_a) with `tag` and `n` lanes, and a | ||
| /// allocation_id as a ScalarField | ||
| fn precompute( | ||
| pp: &Self::Parameters, | ||
| tag: P::ScalarField, | ||
| n: usize, | ||
| ) -> Result<(P::G1, P::ScalarField), Box<dyn Error>>; | ||
|
|
||
| /// Generate private and public receipt keys using `pp` parameters from `setup` | ||
| fn keygen<R: Rng>( | ||
| pp: &Self::Parameters, | ||
| rng: &mut R, | ||
| ) -> Result<(Self::PublicKey, Self::SecretKey), Box<dyn Error>>; | ||
|
|
||
| /// Sign `message` with `tag` at `index` | ||
| fn sign( | ||
| pp: &Self::Parameters, | ||
| tag: P::ScalarField, | ||
| index: usize, | ||
| message: Self::Message, | ||
| ) -> Result<Self::Signature, Box<dyn Error>>; | ||
|
|
||
| /// Verify a single `signature` matches `message` with `tag` at `index` using `pp` parameter and `pk` public key | ||
| /// TODO: index should be restricted to a number from 1 to N (max number of lanes) | ||
| fn verify( | ||
| pp: &Self::Parameters, | ||
| tag: P::ScalarField, | ||
| index: usize, | ||
| message: &Self::Message, | ||
| signature: &Self::Signature, | ||
| ) -> Result<bool, Box<dyn Error>>; | ||
|
|
||
| /// Verify aggregate `signature` matches `message_aggregate` | ||
| /// contained in [`AggregatedSignature`] with `tag` and `hash_aggregate` using `pp` parameter and `pk` public key | ||
| fn verify_aggregate( | ||
| pp: &Self::Parameters, | ||
| hash_aggregate: &P::G1, | ||
| signature: &Self::AggregatedSignature, | ||
| ) -> Result<bool, Box<dyn Error>>; | ||
|
|
||
| /// Aggregate `signatures` with `weights` | ||
| fn evaluate( | ||
| signatures: &[Self::Signature], | ||
| weights: &[Self::Weight], | ||
| ) -> Result<Self::AggregatedSignature, Box<dyn Error>>; | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| pub mod holographic_homomorphic_signature_scheme; | ||
| pub mod ncs; |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.