-
Notifications
You must be signed in to change notification settings - Fork 152
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 ed448 signature scheme. #102
Conversation
@claucece please take a look on this PR |
Oh! Very nice! I'll check it tomorrow ;) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey! I added some comments as well as on the other PR ;)
sign/ed448/ed448.go
Outdated
type KeyPair struct{ private, public [Size]byte } | ||
|
||
// GetPrivate returns a copy of the private key. | ||
func (k *KeyPair) GetPrivate() PrivateKey { return makeCopy(&k.private) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mmm.. I'm not so sure of this methods, as they seem more from the OOP thinking.. but maybe they can be useful ;)
_, _ = H.Write(signature[:Size]) | ||
_, _ = H.Write(kp.public[:]) | ||
_, _ = H.Write(message) | ||
_, _ = H.Read(hRAM[:]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the functionality of these lines is repeated with the previous ones, this can be extracted to a separated function, like 'hashWithDom', or something like it..
Codecov Report
@@ Coverage Diff @@
## master #102 +/- ##
==========================================
+ Coverage 79.21% 79.59% +0.38%
==========================================
Files 60 61 +1
Lines 5551 5656 +105
==========================================
+ Hits 4397 4502 +105
Misses 1107 1107
Partials 47 47
|
ecc/goldilocks/curve_test.go
Outdated
) | ||
|
||
func TestScalarMult(t *testing.T) { | ||
const testTimes = 1 << 8 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not an issue that needs to be addressed right now, but it can be quite nice for things like this is to allow the iterations to vary based on the -short
flag. For example:
func NumTrials() {
if testing.Short() {
return 16
}
return 1 << 8 // or more
}
If you want to get even more fancy, something I've done before is to also define custom -long
and -stress
flags. So you can do:
// Custom test command line flags.
var (
long = flag.Bool("long", false, "enable long running tests")
stress = flag.Bool("stress", false, "enable stress tests (implies -long)")
)
// timeallowed returns how long a single test is allowed to take.
func timeallowed() time.Duration {
switch {
case testing.Short():
return time.Second / 10
case *long:
return 30 * time.Second
case *stress:
return 2 * time.Minute
default:
return time.Second
}
}
// Repeat the given trial function. The duration is controlled by custom
// command-line flags. The trial function returns whether it wants to continue
// testing.
//
// -short run for less time than usual
// -long allow more time
// -stress run for an extremely long time
func Repeat(t *testing.T, trial func(t *testing.T) bool) {
start := time.Now()
d := timeallowed()
n := 1
for time.Since(start) < d && trial(t) {
n++
}
t.Logf("%d trials in %s", n, time.Since(start))
}
I usually put something like this in an internal/test
package. Then you wrap your test in a test.Repeat(...)
call and it will run until the time limit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a good suggestion, I will open a ticket for tracking your proposal.
By the way... it's not pretty but it is possible to "stack" PRs in github. You have three PRs My company has custom tooling for this and it's really sweet. Maybe we should open source it. Just saying because this PR stack is intimidating to review! |
Oh @mmcloughlin , that is very awesome! Does the tool have a GUI or it's from the terminal? I always wanted something like it, and I keep an eye on: isaacs/github#867, isaacs/github#959. I like this post around the subject very much: https://unhashable.com/stacked-pull-requests-keeping-github-diffs-small/ |
Ah I just realized that our internal tool (we call it I really hope Github comes up with an official solution for this. Seems likely they might... they've been coming out with so many new features since the Microsoft acquisition. |
Nice! Thanks for the changes @armfazh ;) |
Relies on goldilocks and internal/sha3 packages.
2332b5b
to
58214a0
Compare
Adds support for Ed448 digital signature scheme as described in RFC8032.
Relies on mlsbset (#99), goldilocks (#100), and internal/sha3 packages.