Utility
Conversions
1 byte
= 8 bit
= 2 hex
int —> char
char —> int
bytes —> HEX
HEX —> bytes
HEX —> int
int —> HEX
bytes —> int
From Crypto.Util.number
int —> bytes
From Crypto.Util.number
bytes —> Base64
From base64
Base64 —> bytes
From base64
bytes XOR bytes
From PwnTools
Functions
GCD
From sympy
Modular Inverse
From Crypto.Util.number
From sympy
Extended Euclidean
X*A + Y*B = GCD(A,B)
From sympy
Chinese Remainder Theorem
x % M1 = U1
x = U1 % M1
x % M2 = U2
x = U2 % M2
From sympy.ntheory.modular
Congruence Resolution
N1 == N2 (mod M)
Solves the modules and returns if they are congruent modulo M
From sympy.ntheory.modular
A*? = B mod N
x
such that A*x = B mod N
From Crypto.Util.number
From sympy
Discrete Logarithm
Given a prime p
, g
is defined to be a primitive root of p
if for every y
∈ {1, .... , p-1} there exists an i
such that: y = g^i mod p
From sympy.ntheory
N-th root
N-th root of v
. Returns 2 values, the approximate root, and if it is perfect (with or without approximation).
From gmpy2
N-th root Extended
N-th root of A
(A^(1/N)
)
From decimal.Decimal
Large Number
From decimal.Decimal
, decimal.getcontext
Modular Square Root
Find the square root of x mod p
(hard problem, like factorization).
From sympy
SAT & SMT solver
From z3
For my setting on macOS
From sage
Discrete Logarithm
Calculate i
in: RESULT = BASE^i mod M
Factorization
Gets the factorization of the number n
. Returns the list of factors.
Chinese Remainder Theorem
x % M1 = U1
x = U1 % M1
x % M2 = U2
x = U2 % M2
Last updated