![]() |
|
|
#1 |
|
Oct 2012
10100102 Posts |
I've read that the Cantor-Zassenhaus algorithm can be used to find modular square roots.
I don't understand how the algorithm is supposed to work, could someone give an example of say: How much more difficult would the Tonelli-Shanks algorithm be to program than Cantor-Zassnehaus? |
|
|
|
|
|
#2 | |
|
"Ben"
Feb 2007
352210 Posts |
Quote:
|
|
|
|
|
|
|
#3 |
|
Noodles
"Mr. Tuch"
Dec 2007
Chennai, India
23518 Posts |
|
|
|
|
|
|
#4 |
|
Basketry That Evening!
"Bunslow the Bold"
Jun 2011
40<A<43 -89<O<-88
3×29×83 Posts |
|
|
|
|
|
|
#5 |
|
Romulan Interpreter
Jun 2011
Thailand
966410 Posts |
Last fiddled with by LaurV on 2012-12-24 at 06:08 |
|
|
|
|
|
#6 | |
|
Basketry That Evening!
"Bunslow the Bold"
Jun 2011
40<A<43 -89<O<-88
1C3516 Posts |
Quote:
Code:
>>> pow(61063, 128//4, 127) == 61063 % 127 False >>> pow(61063, 128//4, 127) 22 >>> 61063 % 127 103 |
|
|
|
|
|
|
#7 | |
|
Romulan Interpreter
Jun 2011
Thailand
26·151 Posts |
Quote:
x can not be equal to x^2. your left side is x your right side is x^2. 22^2=103 105^2=103 mod 127. The formula gives you x, not x^2. You have to square it. Too much (..!? what are people drinking there usually for xmas?) already, or what? Last fiddled with by LaurV on 2012-12-24 at 06:18 |
|
|
|
|
|
|
#8 |
|
Basketry That Evening!
"Bunslow the Bold"
Jun 2011
40<A<43 -89<O<-88
1C3516 Posts |
|
|
|
|
|
|
#9 |
|
Tribal Bullet
Oct 2004
3×1,181 Posts |
Tonelli-Shanks is specialized to find modular square roots; Cantor-Zassenhaus finds the roots of general polynomials mod p. Basically you solve x^2-a=0 for x, with all quantities mod p.
I don't think you want to get into the details of how Cantor-Zassenhaus actually works, and Ben is correct that it's overkill for this application. Crandall and Pomerance have a nice description for a modular square root algorithm that is straightforward to implement. |
|
|
|
|
|
#10 |
|
Oct 2012
2·41 Posts |
I've decided to go for the Shanks-Tonelli algorithm. I think I understand how it works, there's just one thing I'm unsure of:
After you have removed all the powers of 2 from (p - 1), so that p - 1 = q * 2^s, will q always be odd, or do you need to find a solution where it's odd? |
|
|
|
|
|
#11 | |
|
"Ben"
Feb 2007
2·3·587 Posts |
Quote:
|
|
|
|
|
![]() |
| Thread Tools | |
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| new factorization algorithm | jasonp | Math | 2 | 2012-06-17 20:04 |
| TF algorithm(s) | davieddy | Miscellaneous Math | 61 | 2011-07-06 20:13 |
| Is there an algorithm which solves this? | Unregistered | Homework Help | 0 | 2007-08-09 17:40 |
| Maybe new sieving algorithm | nuggetprime | Riesel Prime Search | 5 | 2007-04-20 04:19 |
| Prime95's FFT Algorithm | Angular | Math | 6 | 2002-09-26 00:13 |