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

Improving account import #19

Closed
fraspadafora opened this issue Nov 19, 2016 · 3 comments
Closed

Improving account import #19

fraspadafora opened this issue Nov 19, 2016 · 3 comments

Comments

@fraspadafora
Copy link

fraspadafora commented Nov 19, 2016

I saw that you are using the Java Scrypt library to calculate the derived key.
I noticed that is not that fast and I found that the Bouncy Castle implementation is better.
Here is the class and method that you can call.

org.bouncycastle.crypto.generators.SCrypt.generate(...)

Hope this can improve the Web3j library.

@fraspadafora fraspadafora changed the title Improving account importing Improving account import Nov 19, 2016
@conor10
Copy link
Contributor

conor10 commented Nov 20, 2016

I started off using the Bouncy Castle Scrypt implementation, however migrated to the Java Scrypt library as per the following comments in the Wallet implementation.

Note: we don't use the Bouncy Castle Scrypt implementation org.bouncycastle.crypto.generators.SCrypt, as the following parameter assertion results in failure of the Ethereum reference Scrypt test vector:

  // Only value of r that cost (as an int) could be exceeded for is 1
  if (r == 1 && N > 65536)
  {
      throw new IllegalArgumentException("Cost parameter N must be > 1 and < 65536.");
  }

@fraspadafora
Copy link
Author

Oh I didn't know that, I used Bouncy Castle and I have never received that error because my test accounts have r = 8 and N = 262144.

@conor10
Copy link
Contributor

conor10 commented Nov 21, 2016

Closing, as for the time being I want to ensure that web3j remains compliant with the Scrypt test vector.

@conor10 conor10 closed this as completed Nov 21, 2016
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

No branches or pull requests

2 participants