Skip to content
This repository has been archived by the owner on Feb 15, 2023. It is now read-only.

Add the basic interface and documentation for the sponge trait #2

Merged
merged 7 commits into from
Oct 13, 2020

Conversation

Will-Lin4
Copy link
Collaborator

No description provided.

src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
Absorbable is now sponge implementation independent and only
requires conversion to a byte vector and a field element. The
CryptographicSponge trait now supports outputting both bytes and
field elements.
src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
/// The output depends on previous `absorb` and `squeeze` calls.
pub trait CryptographicSponge<F: Field> {
/// Initialize a new instance of the sponge.
fn new() -> Self;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the zexe ecosystem built with security parameter as a variable everywhere? I feel like it should be an input to new. (Or alternatively change new to something like clone or reset)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What’s the use case?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding is that one would write a PoseidonSponge that implements CryptographicSponge, and then have a
PoseidonSponge<F>::new() that generates the parameters for it, and gives you an instance of the object.

But you don't want to write a different PoseidonSponge for each security level. Or is the idea instead that you would make a parameter class, and then it'd be PoseidonSponge<F, params>::new()?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess my question is, when would you not want 128-bit security?

Copy link
Member

@ValarDragon ValarDragon Oct 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like one may want to be shaving off the last few bits (or adding more in) depending on various circumstances.

Some cases that come to mind:

  1. You only need pre-image resistance, not collision resistance for certain things (e.g. blockchain addresses)
  2. You don't trust the papers analyses, so you use a higher security param
  3. You're already not at 128 bits of soundness due to other things. (Pretty common, ZCash Sapling was designed for 125 bits, later reduced to 122 due to Cheon's)

Also there are a lot of questions around what does 128 bit security mean for the sponge vs standard hashes / other parts of your system.
E.g. these arithmetic hash papers don't consider bit complexity per field op, so you feel safer lowering the last few bits of soundness, or you weight time/memory trade-offs differently, leading to different parameterizations.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the idea instead that you would make a parameter class, and then it'd be PoseidonSponge<F, params>::new()?

I think this approach makes sense, no?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On further thought, I completely agree.

src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
Copy link
Member

@Pratyush Pratyush left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. I filed #3 to deal with the question brought up by @ValarDragon. Let's get this initial design merged, and then we can use it in our crates to see any issues that arise.

@Will-Lin4
Copy link
Collaborator Author

This looks good to me. I filed arkworks-rs/crypto-primitives#100 to deal with the question brought up by @ValarDragon. Let's get this initial design merged, and then we can use it in our crates to see any issues that arise.

Sounds good. I will merge it in.

@Will-Lin4 Will-Lin4 merged commit d221746 into master Oct 13, 2020
@Pratyush Pratyush deleted the dev branch October 13, 2020 21:01
@Pratyush Pratyush mentioned this pull request Oct 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants