openGPMP
Open Source Mathematics Package
Functions
logarithms.cpp File Reference
#include <iostream>
#include <openGPMP/nt.hpp>

Go to the source code of this file.

Functions

int main ()
 

Function Documentation

◆ main()

int main ( void  )
Examples
logarithms.cpp.

Definition at line 11 of file logarithms.cpp.

11  {
12  gpmp::Logarithms logs;
13  int64_t g = 3;
14  int64_t y = 7;
15  int64_t p = 11;
16  int64_t x = logs.pollard_rho_log(g, y, p);
17  std::cout << "The discrete logarithm of " << y
18  << " with respect to the base " << g << " in the group of order "
19  << p << " is " << x << std::endl;
20 
21  int64_t a = 2, b = 3, m = 5;
22  std::cout << logs.BSGS(a, b, m) << std::endl;
23 
24  a = 3, b = 7, m = 11;
25  std::cout << logs.BSGS(a, b, m) << std::endl;
26 
27  return 0;
28 }
uint64_t BSGS(uint64_t a, uint64_t b, uint64_t m)
Definition: logarithms.cpp:98
uint64_t pollard_rho_log(uint64_t a, uint64_t b, uint64_t m)
Definition: logarithms.cpp:58

References gpmp::Logarithms::BSGS(), and gpmp::Logarithms::pollard_rho_log().