openGPMP
Open Source Mathematics Package
factorization.hpp
Go to the documentation of this file.
1 /*************************************************************************
2  *
3  * Project
4  * _____ _____ __ __ _____
5  * / ____| __ \| \/ | __ \
6  * ___ _ __ ___ _ __ | | __| |__) | \ / | |__) |
7  * / _ \| '_ \ / _ \ '_ \| | |_ | ___/| |\/| | ___/
8  *| (_) | |_) | __/ | | | |__| | | | | | | |
9  * \___/| .__/ \___|_| |_|\_____|_| |_| |_|_|
10  * | |
11  * |_|
12  *
13  * Copyright (C) Akiel Aries, <akiel@akiel.org>, et al.
14  *
15  * This software is licensed as described in the file LICENSE, which
16  * you should have received as part of this distribution. The terms
17  * among other details are referenced in the official documentation
18  * seen here : https://akielaries.github.io/openGPMP/ along with
19  * important files seen in this project.
20  *
21  * You may opt to use, copy, modify, merge, publish, distribute
22  * and/or sell copies of the Software, and permit persons to whom
23  * the Software is furnished to do so, under the terms of the
24  * LICENSE file. As this is an Open Source effort, all implementations
25  * must be of the same methodology.
26  *
27  *
28  *
29  * This software is distributed on an AS IS basis, WITHOUT
30  * WARRANTY OF ANY KIND, either express or implied.
31  *
32  ************************************************************************/
33 
40 #ifndef FACTORIZATION_HPP
41 #define FACTORIZATION_HPP
42 
43 #include <cstdint>
44 
45 namespace gpmp {
47  public:
48  // std::vector<uint64_t> pollard_rho(const std::vector<uint64_t>&
49  // nums_to_factorize);
50  /* integer factorization */
51 
52  /*
53  * algorithm for integer factorization proportial to the runtime of
54  * the square root of the size of the smallest prime factor of the
55  * composite factor being factorized. Given a positive and composite
56  * integer n, find a divisor of it.
57  *
58  * x_n-1 = x^2_n + a(mod n)
59  *
60  * n = 1111, set x_0 = 2 & f(x) = x^2 + 1
61  *
62  * x_1 = 5
63  * x_2 = 26 gcd(26 - 5, 1111) = 1
64  * x_3 = 677
65  * x_4 = 598 gcd(698 - 26, 1111) = 11
66  * @brief This function implements the Pollard Rho algorithm for
67  * integer factorization.
68  * @param n The integer to be factorized.
69  * @return uint64_t One of the prime factors of n.
70  */
71  uint64_t pollard_rho(uint64_t n);
72 
73  /* */
74  // std::vector<std::future<uint64_t>>
75  // pollard_rho_thread(const std::vector<uint64_t> &nums_to_factorize);
76  /* Lenstra elliptic-curve factorization */
77  // uint64_t LECF(uint64_t n);
78 
79  /* */
80 };
81 
82 } // namespace gpmp
83 
84 #endif
uint64_t pollard_rho(uint64_t n)
The source C++ openGPMP namespace.