diff --git a/Cargo.toml b/Cargo.toml index 0aefe4a..81027c2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "hashsig" +name = "leansig" version = "0.1.0" edition = "2024" rust-version = "1.87" diff --git a/README.md b/README.md index b271c76..32b0131 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ The examples below, tests, and benchmarks just use a default (potentially insecu ## Signature Interface -If you want to use this library, the main interface is that of a *(synchronized) signature scheme*, which is defined in the [Signature trait](https://github.com/b-wagn/hash-sig/blob/main/src/signature.rs). Here is a summary: +If you want to use this library, the main interface is that of a *(synchronized) signature scheme*, which is defined in the [Signature trait](https://github.com/leanEthereum/leanSig/blob/main/src/signature.rs). Here is a summary: - A function `key_gen` to generate keys. - A function `sign` to sign messages using the secret key with respect to an epoch. - A function `verify` to verify signatures for a given message, public key, and epoch. @@ -52,11 +52,11 @@ let sig = S::sign(&sk, epoch, &message); let is_valid = S::verify(&pk, epoch, &message, &sig); ``` -See also function `test_signature_scheme_correctness` in [this file](https://github.com/b-wagn/hash-sig/blob/main/src/signature.rs). +See also function `test_signature_scheme_correctness` in [this file](https://github.com/leanEthereum/leanSig/blob/main/src/signature.rs). ## Schemes The code implements a generic framework from [this paper](https://eprint.iacr.org/2025/055.pdf), which builds XMSS-like hash-based signatures from a primitive called incomparable encodings. -Hardcoded instantiations of this generic framework (using Poseidon2) are defined in `hashsig::signature::generalized_xmss`. +Hardcoded instantiations of this generic framework (using Poseidon2) are defined in `leansig::signature::generalized_xmss`. The parameters have been chosen based on the analysis in the paper using Python scripts. Details are as follows: | Submodule | Paper / Documentation | Parameters Set With | @@ -93,7 +93,7 @@ Run them with cargo bench ``` -The schemes that are benchmarked are hardcoded instantiations of the generic framework, which are defined in `hashsig::signature::generalized_xmss`. +The schemes that are benchmarked are hardcoded instantiations of the generic framework, which are defined in `leansig::signature::generalized_xmss`. The parameters of these instantiations have been chosen carefully with the aim to achieve a desired security level. By default, key generation is not benchmarked. There are two options to benchmark it: 1. add the option `--features with-gen-benches-poseidon` or `--features with-gen-benches-poseidon-top-level` to `cargo bench`. Note that this will make benchmarks very slow, as key generation will be repeated within the benchmarks. Especially for Poseidon, this is not recommended. diff --git a/benches/benchmark_poseidon.rs b/benches/benchmark_poseidon.rs index 3b1d515..e9186fd 100644 --- a/benches/benchmark_poseidon.rs +++ b/benches/benchmark_poseidon.rs @@ -3,7 +3,7 @@ use std::hint::black_box; use criterion::{Criterion, SamplingMode}; use rand::Rng; -use hashsig::{ +use leansig::{ MESSAGE_LENGTH, signature::{ SignatureScheme, SignatureSchemeSecretKey, diff --git a/benches/benchmark_poseidon_top_level.rs b/benches/benchmark_poseidon_top_level.rs index aa5f235..14c9b7f 100644 --- a/benches/benchmark_poseidon_top_level.rs +++ b/benches/benchmark_poseidon_top_level.rs @@ -3,7 +3,7 @@ use std::{cmp::min, hint::black_box}; use criterion::{Criterion, SamplingMode}; use rand::Rng; -use hashsig::{ +use leansig::{ MESSAGE_LENGTH, signature::{ SignatureScheme, SignatureSchemeSecretKey, diff --git a/src/bin/main.rs b/src/bin/main.rs index 84dca17..466a7b6 100644 --- a/src/bin/main.rs +++ b/src/bin/main.rs @@ -1,12 +1,12 @@ -use hashsig::signature::generalized_xmss::instantiations_poseidon::lifetime_2_to_the_18::target_sum::SIGTargetSumLifetime18W1NoOff; -use hashsig::signature::generalized_xmss::instantiations_poseidon::lifetime_2_to_the_18::target_sum::SIGTargetSumLifetime18W2NoOff; -use hashsig::signature::generalized_xmss::instantiations_poseidon::lifetime_2_to_the_18::target_sum::SIGTargetSumLifetime18W4NoOff; -use hashsig::signature::generalized_xmss::instantiations_poseidon::lifetime_2_to_the_18::target_sum::SIGTargetSumLifetime18W8NoOff; -use hashsig::signature::generalized_xmss::instantiations_poseidon::lifetime_2_to_the_20::target_sum::SIGTargetSumLifetime20W1NoOff; -use hashsig::signature::generalized_xmss::instantiations_poseidon::lifetime_2_to_the_20::target_sum::SIGTargetSumLifetime20W2NoOff; -use hashsig::signature::generalized_xmss::instantiations_poseidon::lifetime_2_to_the_20::target_sum::SIGTargetSumLifetime20W4NoOff; -use hashsig::signature::generalized_xmss::instantiations_poseidon::lifetime_2_to_the_20::target_sum::SIGTargetSumLifetime20W8NoOff; -use hashsig::signature::SignatureScheme; +use leansig::signature::generalized_xmss::instantiations_poseidon::lifetime_2_to_the_18::target_sum::SIGTargetSumLifetime18W1NoOff; +use leansig::signature::generalized_xmss::instantiations_poseidon::lifetime_2_to_the_18::target_sum::SIGTargetSumLifetime18W2NoOff; +use leansig::signature::generalized_xmss::instantiations_poseidon::lifetime_2_to_the_18::target_sum::SIGTargetSumLifetime18W4NoOff; +use leansig::signature::generalized_xmss::instantiations_poseidon::lifetime_2_to_the_18::target_sum::SIGTargetSumLifetime18W8NoOff; +use leansig::signature::generalized_xmss::instantiations_poseidon::lifetime_2_to_the_20::target_sum::SIGTargetSumLifetime20W1NoOff; +use leansig::signature::generalized_xmss::instantiations_poseidon::lifetime_2_to_the_20::target_sum::SIGTargetSumLifetime20W2NoOff; +use leansig::signature::generalized_xmss::instantiations_poseidon::lifetime_2_to_the_20::target_sum::SIGTargetSumLifetime20W4NoOff; +use leansig::signature::generalized_xmss::instantiations_poseidon::lifetime_2_to_the_20::target_sum::SIGTargetSumLifetime20W8NoOff; +use leansig::signature::SignatureScheme; use rand::rngs::ThreadRng; use rand::Rng; use std::time::Instant;