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

Add hash to point from RFC9380 #510

Open
wants to merge 44 commits into
base: drandmerge
Choose a base branch
from
Open

Conversation

K1li4nL
Copy link
Contributor

@K1li4nL K1li4nL commented Apr 21, 2024

Add Hash() on Ed25519

@K1li4nL K1li4nL marked this pull request as ready for review April 21, 2024 17:16
@K1li4nL K1li4nL changed the base branch from master to drandmerge April 30, 2024 08:53
Copy link
Contributor

@AnomalRoil AnomalRoil left a comment

Choose a reason for hiding this comment

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

Please, add better comments to refer to which part of the RFC you've implemented, that will make review easier.

group/edwards25519/fe.go Show resolved Hide resolved
dst.SetBytes(b[:])
}

func feFromBn(dst *fieldElement, src *big.Int) {
Copy link
Contributor

Choose a reason for hiding this comment

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

same, add a comment saying what it does

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not exactly, it converts from big.Int, its fixed !

Copy link
Contributor

Choose a reason for hiding this comment

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

It would be good to have some tests testing both, going both directions and weird testing edge cases (all 1s, all 0s, etc.)

group/edwards25519/point.go Show resolved Hide resolved
group/edwards25519/point.go Show resolved Hide resolved
return dst, nil
}

func curve25519Elligator2(u fieldElement) (xn, xd, yn, yd fieldElement) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can't this also be used for Curve25519? Why put it in Edwards25519?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes it can, though our Curve25519 doesn't use fieldElement but only big.Int, it would make sense to put it there but it would be of no use unfortunately.

@K1li4nL K1li4nL changed the base branch from drandmerge to Fix-DKG May 8, 2024 16:44
Base automatically changed from Fix-DKG to drandmerge May 10, 2024 09:20
dst.SetBytes(b[:])
}

func feFromBn(dst *fieldElement, src *big.Int) {
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be good to have some tests testing both, going both directions and weird testing edge cases (all 1s, all 0s, etc.)

group/edwards25519/point.go Show resolved Hide resolved
group/edwards25519/point_test.go Show resolved Hide resolved
go.mod Outdated Show resolved Hide resolved
@K1li4nL K1li4nL self-assigned this May 23, 2024
group/edwards25519/fe_test.go Outdated Show resolved Hide resolved
group/edwards25519/fe_test.go Show resolved Hide resolved
group/edwards25519/point.go Outdated Show resolved Hide resolved
group/edwards25519/point.go Outdated Show resolved Hide resolved
group/edwards25519/point.go Outdated Show resolved Hide resolved
group/edwards25519/point.go Show resolved Hide resolved
Copy link

sonarcloud bot commented Jun 6, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
22.1% Duplication on New Code (required ≤ 10%)

See analysis details on SonarCloud

Copy link

@azixus azixus left a comment

Choose a reason for hiding this comment

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

I just have one comment on expandMessageXOF, the rest looks good to me :)

Comment on lines 453 to 455
h.Reset()
return uniformBytes, nil
}
Copy link

Choose a reason for hiding this comment

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

I believe that we can remove the last h.Reset(), as you always reset it prior to updating its state.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Its fixed, thank you very much !

Copy link

sonarcloud bot commented Jun 12, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
21.3% Duplication on New Code (required ≤ 10%)

See analysis details on SonarCloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants