#include "always.h"#include "mpmath.h"#include "win.h"#include <assert.h>#include <ctype.h>#include <limits.h>#include <stdlib.h>#include <string.h>Go to the source code of this file.
Macros | |
| #define | UPPER_MOST_BIT 0x80000000L |
| #define | SEMI_UPPER_MOST_BIT 0x8000 |
| #define | SEMI_MASK ((unsigned short)~0) |
| #define | min(a, b) |
| #define | _USERENTRY |
Functions | |
| void | memrev (char *buffer, size_t length) |
| unsigned short | mp_quo_digit (unsigned short *dividend) |
| unsigned short const *MPEXPORT | XMP_Fetch_Prime_Table (void) |
| int MPEXPORT | XMP_Fetch_Prime_Size (void) |
| bool MPEXPORT | XMP_Test_Eq_Int (digit const *r, int i, int p) |
| int MPEXPORT | XMP_DER_Length_Encode (unsigned long length, unsigned char *output) |
| int MPEXPORT | XMP_DER_Encode (digit const *from, unsigned char *output, int precision) |
| void MPEXPORT | XMP_DER_Decode (digit *result, unsigned char const *input, int precision) |
| unsigned MPEXPORT | XMP_Encode_Bounded (unsigned char *to, unsigned tobytes, digit const *from, int precision) |
| unsigned MPEXPORT | XMP_Encode (unsigned char *to, digit const *from, int precision) |
| void MPEXPORT | XMP_Signed_Decode (digit *result, const unsigned char *from, int frombytes, int precision) |
| void MPEXPORT | XMP_Unsigned_Decode (digit *result, const unsigned char *from, int frombytes, int precision) |
| int MPEXPORT | XMP_Significance (const digit *number, int precision) |
| void MPEXPORT | XMP_Inc (digit *number, int precision) |
| void MPEXPORT | XMP_Dec (digit *number, int precision) |
| void MPEXPORT | XMP_Neg (digit *number, int precision) |
| void MPEXPORT | XMP_Abs (digit *number, int precision) |
| void MPEXPORT | XMP_Shift_Right_Bits (digit *number, int bits, int precision) |
| void MPEXPORT | XMP_Shift_Left_Bits (digit *number, int bits, int precision) |
| bool MPEXPORT | XMP_Rotate_Left (digit *number, bool carry, int precision) |
| void MPEXPORT | XMP_Not (digit *number, int precision) |
| void MPEXPORT | XMP_Init (digit *number, digit value, int precision) |
| unsigned MPEXPORT | XMP_Count_Bits (const digit *number, int precision) |
| int MPEXPORT | XMP_Count_Bytes (const digit *number, int precision) |
| void MPEXPORT | XMP_Move (digit *dest, digit const *source, int precision) |
| int MPEXPORT | XMP_Compare (const digit *left_number, const digit *right_number, int precision) |
| bool MPEXPORT | XMP_Add (digit *result, const digit *left_number, const digit *right_number, bool carry, int precision) |
| bool MPEXPORT | XMP_Add_Int (digit *result, const digit *left_number, digit right_number, bool carry, int precision) |
| bool MPEXPORT | XMP_Sub (digit *result, const digit *left_number, const digit *right_number, bool borrow, int precision) |
| bool MPEXPORT | XMP_Sub_Int (digit *result, const digit *left_number, unsigned short right_number, bool borrow, int precision) |
| int MPEXPORT | XMP_Unsigned_Mult (digit *prod, const digit *multiplicand, const digit *multiplier, int precision) |
| int MPEXPORT | XMP_Unsigned_Mult_Int (digit *prod, const digit *multiplicand, short multiplier, int precision) |
| int MPEXPORT | XMP_Signed_Mult_Int (digit *prod, const digit *multiplicand, signed short multiplier, int precision) |
| int MPEXPORT | XMP_Signed_Mult (digit *prod, const digit *multiplicand, const digit *multiplier, int precision) |
| unsigned short MPEXPORT | XMP_Unsigned_Div_Int (digit *quotient, digit const *dividend, unsigned short divisor, int precision) |
| int MPEXPORT | XMP_Unsigned_Div (digit *remainder, digit *quotient, digit const *dividend, digit const *divisor, int precision) |
| void MPEXPORT | XMP_Signed_Div (digit *remainder, digit *quotient, digit const *dividend, digit const *divisor, int precision) |
| void MPEXPORT | XMP_Inverse_A_Mod_B (digit *result, digit const *number, digit const *modulus, int precision) |
| int MPEXPORT | XMP_Reciprocal (digit *quotient, const digit *divisor, int precision) |
| void MPEXPORT | XMP_Decode_ASCII (char const *str, digit *mpn, int precision) |
| void | XMP_Hybrid_Mul (unsigned short *prod, unsigned short *multiplicand, unsigned short multiplier, int precision) |
| void MPEXPORT | XMP_Double_Mul (digit *prod, const digit *multiplicand, const digit *multiplier, int precision) |
| int | XMP_Prepare_Modulus (const digit *n_modulus, int precision) |
| int MPEXPORT | XMP_Mod_Mult (digit *prod, const digit *multiplicand, const digit *multiplier, int precision) |
| void MPEXPORT | XMP_Mod_Mult_Clear (int precision) |
| int MPEXPORT | XMP_Exponent_Mod (digit *expout, const digit *expin, const digit *exponent_ptr, const digit *modulus, int precision) |
| int _USERENTRY | pfunc (const void *pkey, const void *base) |
| bool MPEXPORT | XMP_Is_Small_Prime (const digit *candidate, int precision) |
| bool MPEXPORT | XMP_Small_Divisors_Test (const digit *candidate, int precision) |
| bool MPEXPORT | XMP_Fermat_Test (const digit *candidate_prime, unsigned rounds, int precision) |
| bool MPEXPORT | XMP_Rabin_Miller_Test (Straw &rng, digit const *w, int rounds, int precision) |
| void MPEXPORT | XMP_Randomize (digit *result, Straw &rng, int total_bits, int precision) |
| void MPEXPORT | XMP_Randomize_Bounded (digit *result, Straw &rng, digit const *minval, digit const *maxval, int precision) |
| bool MPEXPORT | XMP_Is_Prime (digit const *prime, int precision) |
Variables | |
| unsigned short | primeTable [3511] |
| #define _USERENTRY |
Definition at line 109 of file mpmath.cpp.
| #define min | ( | a, | |
| b ) |
Definition at line 108 of file mpmath.cpp.
| #define SEMI_MASK ((unsigned short)~0) |
Definition at line 101 of file mpmath.cpp.
| #define SEMI_UPPER_MOST_BIT 0x8000 |
Definition at line 100 of file mpmath.cpp.
| #define UPPER_MOST_BIT 0x80000000L |
Definition at line 99 of file mpmath.cpp.
| void memrev | ( | char * | buffer, |
| size_t | length ) |
Definition at line 2227 of file mpmath.cpp.
| unsigned short mp_quo_digit | ( | unsigned short * | dividend | ) |
Definition at line 2095 of file mpmath.cpp.
| int _USERENTRY pfunc | ( | const void * | pkey, |
| const void * | base ) |
Definition at line 2238 of file mpmath.cpp.
Definition at line 622 of file mpmath.cpp.
| bool MPEXPORT XMP_Add | ( | digit * | result, |
| const digit * | left_number, | ||
| const digit * | right_number, | ||
| bool | carry, | ||
| int | precision ) |
Definition at line 1050 of file mpmath.cpp.
| bool MPEXPORT XMP_Add_Int | ( | digit * | result, |
| const digit * | left_number, | ||
| digit | right_number, | ||
| bool | carry, | ||
| int | precision ) |
Definition at line 1092 of file mpmath.cpp.
Definition at line 1010 of file mpmath.cpp.
Definition at line 915 of file mpmath.cpp.
Definition at line 952 of file mpmath.cpp.
Definition at line 564 of file mpmath.cpp.
Definition at line 1698 of file mpmath.cpp.
Definition at line 264 of file mpmath.cpp.
Definition at line 225 of file mpmath.cpp.
| int MPEXPORT XMP_DER_Length_Encode | ( | unsigned long | length, |
| unsigned char * | output ) |
Definition at line 186 of file mpmath.cpp.
| void MPEXPORT XMP_Double_Mul | ( | digit * | prod, |
| const digit * | multiplicand, | ||
| const digit * | multiplier, | ||
| int | precision ) |
Definition at line 1851 of file mpmath.cpp.
Definition at line 357 of file mpmath.cpp.
| unsigned MPEXPORT XMP_Encode_Bounded | ( | unsigned char * | to, |
| unsigned | tobytes, | ||
| digit const * | from, | ||
| int | precision ) |
Definition at line 309 of file mpmath.cpp.
| int MPEXPORT XMP_Exponent_Mod | ( | digit * | expout, |
| const digit * | expin, | ||
| const digit * | exponent_ptr, | ||
| const digit * | modulus, | ||
| int | precision ) |
Definition at line 2128 of file mpmath.cpp.
Definition at line 2329 of file mpmath.cpp.
| int MPEXPORT XMP_Fetch_Prime_Size | ( | void | ) |
Definition at line 124 of file mpmath.cpp.
| unsigned short const *MPEXPORT XMP_Fetch_Prime_Table | ( | void | ) |
Definition at line 118 of file mpmath.cpp.
| void XMP_Hybrid_Mul | ( | unsigned short * | prod, |
| unsigned short * | multiplicand, | ||
| unsigned short | multiplier, | ||
| int | precision ) |
Definition at line 1814 of file mpmath.cpp.
Definition at line 534 of file mpmath.cpp.
Definition at line 888 of file mpmath.cpp.
| void MPEXPORT XMP_Inverse_A_Mod_B | ( | digit * | result, |
| digit const * | number, | ||
| digit const * | modulus, | ||
| int | precision ) |
Definition at line 1595 of file mpmath.cpp.
Definition at line 2517 of file mpmath.cpp.
Definition at line 2263 of file mpmath.cpp.
| int MPEXPORT XMP_Mod_Mult | ( | digit * | prod, |
| const digit * | multiplicand, | ||
| const digit * | multiplier, | ||
| int | precision ) |
Definition at line 1966 of file mpmath.cpp.
| void MPEXPORT XMP_Mod_Mult_Clear | ( | int | precision | ) |
Definition at line 2057 of file mpmath.cpp.
Definition at line 983 of file mpmath.cpp.
Definition at line 594 of file mpmath.cpp.
Definition at line 857 of file mpmath.cpp.
| int XMP_Prepare_Modulus | ( | const digit * | n_modulus, |
| int | precision ) |
Definition at line 1908 of file mpmath.cpp.
Definition at line 2374 of file mpmath.cpp.
Definition at line 2446 of file mpmath.cpp.
| void MPEXPORT XMP_Randomize_Bounded | ( | digit * | result, |
| Straw & | rng, | ||
| digit const * | minval, | ||
| digit const * | maxval, | ||
| int | precision ) |
Definition at line 2484 of file mpmath.cpp.
Definition at line 1642 of file mpmath.cpp.
Definition at line 825 of file mpmath.cpp.
Definition at line 738 of file mpmath.cpp.
Definition at line 652 of file mpmath.cpp.
| void MPEXPORT XMP_Signed_Decode | ( | digit * | result, |
| const unsigned char * | from, | ||
| int | frombytes, | ||
| int | precision ) |
Definition at line 408 of file mpmath.cpp.
| void MPEXPORT XMP_Signed_Div | ( | digit * | remainder, |
| digit * | quotient, | ||
| digit const * | dividend, | ||
| digit const * | divisor, | ||
| int | precision ) |
Definition at line 1540 of file mpmath.cpp.
| int MPEXPORT XMP_Signed_Mult | ( | digit * | prod, |
| const digit * | multiplicand, | ||
| const digit * | multiplier, | ||
| int | precision ) |
Definition at line 1359 of file mpmath.cpp.
| int MPEXPORT XMP_Signed_Mult_Int | ( | digit * | prod, |
| const digit * | multiplicand, | ||
| signed short | multiplier, | ||
| int | precision ) |
Definition at line 1310 of file mpmath.cpp.
Definition at line 503 of file mpmath.cpp.
Definition at line 2296 of file mpmath.cpp.
| bool MPEXPORT XMP_Sub | ( | digit * | result, |
| const digit * | left_number, | ||
| const digit * | right_number, | ||
| bool | borrow, | ||
| int | precision ) |
Definition at line 1133 of file mpmath.cpp.
| bool MPEXPORT XMP_Sub_Int | ( | digit * | result, |
| const digit * | left_number, | ||
| unsigned short | right_number, | ||
| bool | borrow, | ||
| int | precision ) |
Definition at line 1176 of file mpmath.cpp.
Definition at line 130 of file mpmath.cpp.
| void MPEXPORT XMP_Unsigned_Decode | ( | digit * | result, |
| const unsigned char * | from, | ||
| int | frombytes, | ||
| int | precision ) |
Definition at line 458 of file mpmath.cpp.
| int MPEXPORT XMP_Unsigned_Div | ( | digit * | remainder, |
| digit * | quotient, | ||
| digit const * | dividend, | ||
| digit const * | divisor, | ||
| int | precision ) |
Definition at line 1476 of file mpmath.cpp.
| unsigned short MPEXPORT XMP_Unsigned_Div_Int | ( | digit * | quotient, |
| digit const * | dividend, | ||
| unsigned short | divisor, | ||
| int | precision ) |
Definition at line 1413 of file mpmath.cpp.
| int MPEXPORT XMP_Unsigned_Mult | ( | digit * | prod, |
| const digit * | multiplicand, | ||
| const digit * | multiplier, | ||
| int | precision ) |
Definition at line 1215 of file mpmath.cpp.
| int MPEXPORT XMP_Unsigned_Mult_Int | ( | digit * | prod, |
| const digit * | multiplicand, | ||
| short | multiplier, | ||
| int | precision ) |
Definition at line 1270 of file mpmath.cpp.
| unsigned short primeTable |
Definition at line 2555 of file mpmath.cpp.