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

use crypto/rand instead of math/rand #1

Merged
merged 3 commits into from Mar 25, 2024
Merged

Conversation

shogo82148
Copy link
Contributor

  1. I changed to using multiple processes instead of goroutines. Goroutines are good at concurrent I/O operations, but not at parallelizing computations that use the CPU. In such cases, using processes is faster.
  2. I switched to using crypto/rand instead of math/rand. As you know, math/rand is not cryptographically secure and only provides 64 bits of entropy. The method I propose offers at least 240 bits of entropy.

var seed [ed25519.SeedSize]byte
var encodedPublicKey [encodedPublicKeyLen]byte
for {
privateKey := generateKey(unsafeFastRandReader, seed)
if _, err := crand.Read(seed[:]); err != nil {
Copy link
Owner

Choose a reason for hiding this comment

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

It looks good and will make brute-force faster!

@akiym akiym merged commit 36adb98 into akiym:master Mar 25, 2024
@akiym
Copy link
Owner

akiym commented Mar 25, 2024

Thank you for your contribution!

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.

None yet

2 participants