Skip to content
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

feat: add from_var_bytes to Scalar #131

Closed
wants to merge 6 commits into from
Closed

Conversation

vlopes11
Copy link

This commit introduces from_var_bytes for Scalar, a function that will take arbitrary slices, hash with BLAKE2b into 256-bit numbers, and perform a modulus multiplication to produce valid scalars.

Such functionality is required for downstream protocols such as Phoenix or Rusk contract ID computation. They produce arbitrary bytes, being either asymmetric key exchange protocols or network transaction payload, annd perform off-circuit field operations with such inputs.

This commit introduces `from_var_bytes` for `Scalar`, a function that
will take arbitrary slices, hash with BLAKE2b into 256-bit numbers, and
perform a modulus multiplication to produce valid scalars.

Such functionality is required for downstream protocols such as Phoenix
or Rusk contract ID computation. They produce arbitrary bytes, being
either asymmetric key exchange protocols or network transaction payload,
annd perform off-circuit field operations with such inputs.
Copy link
Member

@moCello moCello left a comment

Choose a reason for hiding this comment

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

LGTM apart from the version bump and the missing changelog entry

Cargo.toml Outdated Show resolved Hide resolved
@vlopes11 vlopes11 closed this Nov 23, 2023
@vlopes11 vlopes11 deleted the artifex11/from-var-bytes branch November 23, 2023 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants