commit
1eabbca8c4
45
LICENSE
45
LICENSE
@ -1,29 +1,26 @@
|
|||||||
LibTomMath is licensed under DUAL licensing terms.
|
The LibTom license
|
||||||
|
|
||||||
Choose and use the license of your needs.
|
This is free and unencumbered software released into the public domain.
|
||||||
|
|
||||||
[LICENSE #1]
|
Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||||
|
distribute this software, either in source code form or as a compiled
|
||||||
|
binary, for any purpose, commercial or non-commercial, and by any
|
||||||
|
means.
|
||||||
|
|
||||||
LibTomMath is public domain. As should all quality software be.
|
In jurisdictions that recognize copyright laws, the author or authors
|
||||||
|
of this software dedicate any and all copyright interest in the
|
||||||
|
software to the public domain. We make this dedication for the benefit
|
||||||
|
of the public at large and to the detriment of our heirs and
|
||||||
|
successors. We intend this dedication to be an overt act of
|
||||||
|
relinquishment in perpetuity of all present and future rights to this
|
||||||
|
software under copyright law.
|
||||||
|
|
||||||
Tom St Denis
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||||
|
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||||
|
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
|
OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
[/LICENSE #1]
|
For more information, please refer to <http://unlicense.org/>
|
||||||
|
|
||||||
[LICENSE #2]
|
|
||||||
|
|
||||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
|
||||||
Version 2, December 2004
|
|
||||||
|
|
||||||
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
|
|
||||||
|
|
||||||
Everyone is permitted to copy and distribute verbatim or modified
|
|
||||||
copies of this license document, and changing it is allowed as long
|
|
||||||
as the name is changed.
|
|
||||||
|
|
||||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
|
||||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
|
||||||
|
|
||||||
0. You just DO WHAT THE FUCK YOU WANT TO.
|
|
||||||
|
|
||||||
[/LICENSE #2]
|
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static const struct {
|
static const struct {
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* computes the modular inverse via binary extended euclidean algorithm,
|
/* computes the modular inverse via binary extended euclidean algorithm,
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* computes xR**-1 == x (mod N) via Montgomery Reduction
|
/* computes xR**-1 == x (mod N) via Montgomery Reduction
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Fast (comba) multiplier
|
/* Fast (comba) multiplier
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* this is a modified version of fast_s_mul_digs that only produces
|
/* this is a modified version of fast_s_mul_digs that only produces
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* the jist of squaring...
|
/* the jist of squaring...
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* computes a = 2**b
|
/* computes a = 2**b
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* b = |a|
|
/* b = |a|
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* high level addition (handles signs) */
|
/* high level addition (handles signs) */
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* single digit addition */
|
/* single digit addition */
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* d = a + b (mod c) */
|
/* d = a + b (mod c) */
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* AND two ints together */
|
/* AND two ints together */
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* trim unused digits
|
/* trim unused digits
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* clear one (frees) */
|
/* clear one (frees) */
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* compare two ints (signed)*/
|
/* compare two ints (signed)*/
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* compare a digit */
|
/* compare a digit */
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* compare maginitude of two ints (unsigned) */
|
/* compare maginitude of two ints (unsigned) */
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static const int lnz[16] = {
|
static const int lnz[16] = {
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* b = ~a */
|
/* b = ~a */
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* copy, b = a */
|
/* copy, b = a */
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* returns the number of bits in an int */
|
/* returns the number of bits in an int */
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef BN_MP_DIV_SMALL
|
#ifdef BN_MP_DIV_SMALL
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* b = a/2 */
|
/* b = a/2 */
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* shift right by a certain bit count (store quotient in c, optional remainder in d) */
|
/* shift right by a certain bit count (store quotient in c, optional remainder in d) */
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* divide by three (based on routine from MPI and the GMP manual) */
|
/* divide by three (based on routine from MPI and the GMP manual) */
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int s_is_power_of_two(mp_digit b, int *p)
|
static int s_is_power_of_two(mp_digit b, int *p)
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* determines if a number is a valid DR modulus */
|
/* determines if a number is a valid DR modulus */
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* reduce "x" in place modulo "n" using the Diminished Radix algorithm.
|
/* reduce "x" in place modulo "n" using the Diminished Radix algorithm.
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* determines the setup value */
|
/* determines the setup value */
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* swap the elements of two integers, for cases where you can't simply swap the
|
/* swap the elements of two integers, for cases where you can't simply swap the
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* based on gmp's mpz_export.
|
/* based on gmp's mpz_export.
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* wrapper function for mp_expt_d_ex() */
|
/* wrapper function for mp_expt_d_ex() */
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* calculate c = a**b using a square-multiply algorithm */
|
/* calculate c = a**b using a square-multiply algorithm */
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* computes Y == G**X mod P, HAC pp.616, Algorithm 14.85
|
/* computes Y == G**X mod P, HAC pp.616, Algorithm 14.85
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Extended euclidean algorithm of (a, b) produces
|
/* Extended euclidean algorithm of (a, b) produces
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef LTM_NO_FILE
|
#ifndef LTM_NO_FILE
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef LTM_NO_FILE
|
#ifndef LTM_NO_FILE
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Greatest Common Divisor using the binary method */
|
/* Greatest Common Divisor using the binary method */
|
||||||
|
@ -10,8 +10,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Checks the bit at position b and returns MP_YES
|
/* Checks the bit at position b and returns MP_YES
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
double mp_get_double(const mp_int *a)
|
double mp_get_double(const mp_int *a)
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* get the lower 32-bits of an mp_int */
|
/* get the lower 32-bits of an mp_int */
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* get the lower unsigned long of an mp_int, platform dependent */
|
/* get the lower unsigned long of an mp_int, platform dependent */
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* get the lower unsigned long long of an mp_int, platform dependent */
|
/* get the lower unsigned long long of an mp_int, platform dependent */
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* grow as required */
|
/* grow as required */
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* based on gmp's mpz_import.
|
/* based on gmp's mpz_import.
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* init a new mp_int */
|
/* init a new mp_int */
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* creates "a" then copies b into it */
|
/* creates "a" then copies b into it */
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* initialize and set a digit */
|
/* initialize and set a digit */
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* initialize and set a digit */
|
/* initialize and set a digit */
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* init an mp_init for a given size */
|
/* init an mp_init for a given size */
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* hac 14.61, pp608 */
|
/* hac 14.61, pp608 */
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* hac 14.61, pp608 */
|
/* hac 14.61, pp608 */
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Check if remainders are possible squares - fast exclude non-squares */
|
/* Check if remainders are possible squares - fast exclude non-squares */
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* computes the jacobi c = (a | n) (or Legendre if n is prime)
|
/* computes the jacobi c = (a | n) (or Legendre if n is prime)
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* c = |a| * |b| using Karatsuba Multiplication using
|
/* c = |a| * |b| using Karatsuba Multiplication using
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Karatsuba squaring, computes b = a*a using three
|
/* Karatsuba squaring, computes b = a*a using three
|
||||||
|
@ -10,8 +10,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* computes least common multiple as |a*b|/(a, b) */
|
/* computes least common multiple as |a*b|/(a, b) */
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* shift left a certain amount of digits */
|
/* shift left a certain amount of digits */
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* c = a mod b, 0 <= c < b if b > 0, b < c <= 0 if b < 0 */
|
/* c = a mod b, 0 <= c < b if b > 0, b < c <= 0 if b < 0 */
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* calc a value mod 2**b */
|
/* calc a value mod 2**b */
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int mp_mod_d(const mp_int *a, mp_digit b, mp_digit *c)
|
int mp_mod_d(const mp_int *a, mp_digit b, mp_digit *c)
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* computes xR**-1 == x (mod N) via Montgomery Reduction */
|
/* computes xR**-1 == x (mod N) via Montgomery Reduction */
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* setups the montgomery reduction stuff */
|
/* setups the montgomery reduction stuff */
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* high level multiplication (handles sign) */
|
/* high level multiplication (handles sign) */
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* b = a*2 */
|
/* b = a*2 */
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* shift left by a certain bit count */
|
/* shift left by a certain bit count */
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* multiply by a digit */
|
/* multiply by a digit */
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* d = a * b (mod c) */
|
/* d = a * b (mod c) */
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* wrapper function for mp_n_root_ex()
|
/* wrapper function for mp_n_root_ex()
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* find the n'th root of an integer
|
/* find the n'th root of an integer
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* b = -a */
|
/* b = -a */
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* OR two ints together */
|
/* OR two ints together */
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* performs one Fermat test.
|
/* performs one Fermat test.
|
||||||
|
@ -10,8 +10,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* determines if an integers is divisible by one
|
/* determines if an integers is divisible by one
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* portable integer log of two with small footprint */
|
/* portable integer log of two with small footprint */
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Miller-Rabin test of "a" to the base of "b" as described in
|
/* Miller-Rabin test of "a" to the base of "b" as described in
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* finds the next prime after the number "a" using "t" trials
|
/* finds the next prime after the number "a" using "t" trials
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* makes a truly random prime of a given size (bits),
|
/* makes a truly random prime of a given size (bits),
|
||||||
|
@ -10,8 +10,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* returns size of ASCII reprensentation */
|
/* returns size of ASCII reprensentation */
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* chars used in radix conversions */
|
/* chars used in radix conversions */
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* First the OS-specific special cases
|
/* First the OS-specific special cases
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* read a string [ASCII] in a given radix */
|
/* read a string [ASCII] in a given radix */
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* read signed bin, big endian, first byte is 0==positive or 1==negative */
|
/* read signed bin, big endian, first byte is 0==positive or 1==negative */
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* reads a unsigned char array, assumes the msb is stored first [big endian] */
|
/* reads a unsigned char array, assumes the msb is stored first [big endian] */
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* reduces x mod m, assumes 0 < x < m**2, mu is
|
/* reduces x mod m, assumes 0 < x < m**2, mu is
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* reduces a modulo n where n is of the form 2**p - d */
|
/* reduces a modulo n where n is of the form 2**p - d */
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* reduces a modulo n where n is of the form 2**p - d
|
/* reduces a modulo n where n is of the form 2**p - d
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* determines the setup value */
|
/* determines the setup value */
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* determines the setup value */
|
/* determines the setup value */
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* determines if mp_reduce_2k can be used */
|
/* determines if mp_reduce_2k can be used */
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* Michael Fromberger but has been written from scratch with
|
* Michael Fromberger but has been written from scratch with
|
||||||
* additional optimizations in place.
|
* additional optimizations in place.
|
||||||
*
|
*
|
||||||
* The library is free for all purposes without any express
|
* SPDX-License-Identifier: Unlicense
|
||||||
* guarantee it works.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* determines if reduce_2k_l can be used */
|
/* determines if reduce_2k_l can be used */
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user