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

group: add SetUint64 method to Group.Scalar. #301

Merged
merged 1 commit into from
Nov 4, 2021

Conversation

armfazh
Copy link
Contributor

@armfazh armfazh commented Nov 3, 2021

No description provided.

@armfazh armfazh self-assigned this Nov 3, 2021
@armfazh armfazh merged commit 81ced92 into cloudflare:master Nov 4, 2021
@armfazh armfazh deleted the groupSetUint64 branch November 4, 2021 00:08
@@ -145,6 +146,8 @@ func (e *ristrettoElement) UnmarshalBinary(data []byte) error {
return e.p.UnmarshalBinary(data)
}

func (s *ristrettoScalar) SetUint64(n uint64) { s.s.SetBigInt(new(big.Int).SetUint64(n)) }
Copy link
Member

Choose a reason for hiding this comment

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

Better to use SetBytes. Scalars are encoded little endian, so simply write the uint64 into the [32]byte at the first 8 bytes using encoding/binary.LittleEndian.

Copy link
Member

Choose a reason for hiding this comment

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

I can also add a SetUint64.

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