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

Method checkPrime() is too slow #16

Closed
zhulduz opened this issue Oct 23, 2015 · 4 comments
Closed

Method checkPrime() is too slow #16

zhulduz opened this issue Oct 23, 2015 · 4 comments

Comments

@zhulduz
Copy link

zhulduz commented Oct 23, 2015

Hi.

I use ssh2 library https://github.com/mscdex/ssh2 in a browser. I have faced up with next problem.

Method checkPrime() at this code

defineError(this, checkPrime(this.__prime, generator));

works very very slowly, so I can't connect to my server. I try to connect by key with a passphrase, 'ctr' ciphers is used.
As I discovered method Red.prototype.pow make such delays.

Thanks a lot.

@calvinmetcalf
Copy link
Contributor

so diffie-hellman arithmetic is pretty slow in general, so if you are able to use elliptical curve diffie hellman to authenticate then that is probably preferable for you.

checkPrime is simply the very first bit of big number math being done, if it can't get through that it probably won't get there the latter stuff.

@zhulduz
Copy link
Author

zhulduz commented Oct 26, 2015

Can you please get additional information about this method?
As I understood, this method checks is number prime or not?

Commented code is always usefull)

@calvinmetcalf
Copy link
Contributor

In previous versions of node it would throw an error if you used an unsafe
prime but in more recent versions it just sets a property so we could
switch that to a lazily calculated getter so we only do the work if we need
to.

On Mon, Oct 26, 2015, 2:14 AM zhulduz notifications@github.com wrote:

I can't understand a meaning of this method. If I set another value (8, 4,
2, "any_string") instead of calling checkPrime(this.__prime, generator)),
the connection to the server is work correctly.

Can you please get additional information about this method?

When code is commented, it is also useful.


Reply to this email directly or view it on GitHub
#16 (comment)
.

@zhulduz
Copy link
Author

zhulduz commented Oct 27, 2015

Thanks a lot)

@zhulduz zhulduz closed this as completed Oct 27, 2015
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