-
Notifications
You must be signed in to change notification settings - Fork 164
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
Only chars. #9
Comments
Sorry, I missed the email notification for this because of your username. On Mon, May 20, 2013 at 6:50 AM, forgotPassword notifications@github.comwrote:
Eric Swanson |
thanks. meanwhile i changed DoesOnionHashMatchPattern to:
edit: |
Well, I didn't write the regex code originally, but from my reading, it On Sat, May 25, 2013 at 1:55 PM, forgotPassword notifications@github.comwrote:
Eric Swanson |
ok. any thoughts as to why the performance drops for short matches? (edited-in previous comment). also any possibility for improving the docs? i don't seem to understand from the code how the public exponent is enumerated, does it just takes it as is and only checks for sanity after a hash match? thanks. |
So if the match is short enough it does the check on the GPU via a lookup in a hash table. If the match is longer it does the check on on the CPU. This is done because short matches are very common and it is too expensive to send them all back to the CPU to check. Checking on the GPU has some overhead that will slow down performance but should be the same if you have one or many short regexp. Not sure I understand your second question but we enumerate the public exponent skipping obviously bad exponents (those divisible by 2). When an exponent is found to be a match it is sent back to the CPU to be be checked by OpenSSL. Enumerating the exponent is complicated because some of the enumeration happens on the CPU and some of the enumeration happens on the GPU. In general the process is 1) The CPU generates a bunch of base exponents 2) The GPU enumerates a large block of exponents starting at the base_exponent and stopping at approximately base_exponent + work_size*2 |
The public exponent needs to be co-prime of φ(n). So i am confused as to how you can generate a bunch of exponents without validating them. ChangePublicExponent() calls CheckSanity() but this is after the hashing is done. Am i missing something? |
CheckSanity calls Rsa.Check which is simply OpenSSL's RSA_check_key function. We rely on OpenSSL for final verification that our key is secure. You are correct that this is done after the hashing. It is rare that a matching hash is rejected because the exponent is not co-prime. Think about it, given two large primes, p and q what are the odds that (p-1)(q-1) is not coprime to a random large odd number e? Turns out this is a rare case and it is alot more computationally efficient to check after hashing. |
This is what surprised me. [0] says two random numbers have odds of 61% to be co-prime. I am not sure how (p-1)(q-1) changes it. [0] http://en.wikipedia.org/wiki/Coprime_integers#Probabilities |
Few things 1) we tested empirically to ensure that too many hashes were not being rejected. 2) We do not test even exponents which will always be co-prime with (p-1)(q-1). Choosing an odd even pair of numbers would significantly lower the odds from 61%. That being said, if you can come up with fast way of generating exponents that would save us from from checking co-prime exponents I would be interested. |
It seems to work fine as is, just wanted to make sure i understand how. |
Thanks, it works :)
Questions:
[a-z]{16} does not seem to work.
Also, is running two instances on different devices (gpus) will work or will it do the same work twice?
The text was updated successfully, but these errors were encountered: