Skip to content

Conversation

@xevisalle
Copy link
Member

@xevisalle xevisalle commented Feb 4, 2025

In this PR, we implement a method map_to_point to map a u64 input value to a point on the curve. Likewise, we implement a unmap_from_point method, to be able to recover the original value.

The mapping we implemented is probabilistic, meaning that trying to find a correct map can require several tries, until finding a real point on the curve, that lies also on the correct subgroup.

To achieve such an outcome, we craft a 32-bytes representation of a point as follows:
target_point = (random_value[31..8] || u64_input_value)

given that, we check if this point is valid or not. If that's not, we keep iterating and checking again, by adding u64_size + 1 each iteration.

@xevisalle xevisalle linked an issue Feb 4, 2025 that may be closed by this pull request
@xevisalle xevisalle requested a review from moCello February 4, 2025 16:58
Copy link

@marta-belles marta-belles left a comment

Choose a reason for hiding this comment

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

LGTM but it would be good if a dev also takes a look at it

@xevisalle xevisalle merged commit 9f6a44b into master Feb 13, 2025
3 checks passed
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.

Implement methods to map u64 values to points on the curve

3 participants