Revision control
Copy as Markdown
Other Tools
[SqrtModuloPrime]
Input = 0
Modulus = 2
Output = 0
Input = 1
Modulus = 2
Output = 1
Input = 5
Modulus = 11
Output = 4
Input = 5
Modulus = 6864797660130609714981900799081393217269435300143305409394463459185543183397656052122559640661454554977296311391480858037121987999716643812574028291115057151
Output = 5128001483797946816458955548662741861156429216952843873274631897232136999791540518339021539968609345897897688700798659762992302941280478805021587896033442584
# Input and composite modulus which would previously cause a (nearly) infinite loop
Input = 4
Modulus = 6864797660130609714981900799081393217269435300143305409394463459185543183397656052122559640661454554977296311391480858037121987999716643812574028291115057149
Output = -1
Input = 20749193632488214633180774027217139706413443729200940480695355894185
Modulus = 26959946667150639794667015087019630673557916260026308143510066298881
Output = 1825097171398375765346899906888660610489759292065918530856859649959
Input = 64
Modulus = 85
Output = -1
Input = 181
Modulus = 217
Output = -1
Input = 4225
Modulus = 33153
Output = -1
Input = 2048
Modulus = 31417
Output = -1
Input = 2
Modulus = 4369
Output = -1
Input = 1024
Modulus = 0x40000000000000000000000000000000000000000000000000000000000c100000000000000ffff
Output = 32
Input = 1024
Modulus = 174763
Output = 174731
Input = 1025
Modulus = 0x40000000000000000000000000000000000000000000000000000000000c100000000000000ffff
Output = 7195614950510915163755738138441999335431224576038191833055420996031360079131617522512565985187
Input = 16
Modulus = 0x40000000000000000000000000000000000000000000000000000000000c100000000000000ffff
Output = 4
Input = 120846049
Modulus = 0x40000000000000000000000000000000000000000000000000000000000c100000000000000ffff
Output = 0x40000000000000000000000000000000000000000000000000000000000c100000000000000d50e
Input = 36201062682172739133895248774702438971945580133434799509985105960684260785324273354862758698920426637444639195349626
Modulus = 7804371375789980578453993074482915734542659201646310600434507062475783156891915333150829678341466565780783986206336267453050408740994685888001
Output = -1