c++ - mpz_powm with gmp why it returns 1? -


i have following code , problem result 1. 3 numbers generated algorithm should have small probability result of 1 (look @ n - 256 bits long).

int main() {    mpz_t a, b, c, result;      mpz_init(a);    mpz_init(b);    mpz_init(c);    mpz_init(result);     mpz_init_set_str(a,  "f1231212317f905af25ca06aa2234b2ff1231212317f905af25ca06aa2234b30", 16);    mpz_init_set_str(b, "94ae1752817e4c42124c0aee0682fbdb08963cdf94434e42fa7f813d888c02", 16);    mpz_init_set_str(c,     "4a570ba940bf26210926057703417df32874c857872d4cae532af37a8bcd959", 16);      printf("\n\n%s", mpz_get_str(null, 10, a));    printf("\n\n%s", mpz_get_str(null, 10, b));    printf("\n\n%s", mpz_get_str(null, 10, c));     mpz_powm(result, a, b, c);     // result = (a ^ b) % n - why 1 ?!?!     printf("\n\n%s", mpz_get_str(null, 10, result));    printf("\n   done");    return 0; } 


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -