In the Cryptography__OTP_repeated_key.py file First I create 4 auxiliary functions which are:
string_fractionator = Fractionates the string into parts of the same amount as the key.
translate_hexa = Translates letters from English to Hexadecimal.
xor_hexa_letters = XORs 2 letters and translates them from hexadecimal to Latin-1.
crib_column_atack = Checks if in a list of letters when XORing a "letter" all translations are within the search string.
The attack takes advantage of the fact that the probability that a letter other than the one in the key will serve all the parts into which it is split is ridiculously small.So if that letter makes all the n-th letters also valid then it will be part of the key.
Streaks:
In the Probability-Theory__streaks.py file I directly use a mathematical model, in which by means of recursion I find the number of possible lists in which the "caster" gets a minimum streak. In the Probability-Theory__streaks-experiment.py file we try to reach the same result but this time resorting to randomization and as its name says, we perform an experiment (in this case many) to reach an approximate probability.
On the other hand inside Probability-Theory__streaks.py is included a function that graphs (m, P(m,n)) for a number of m's proposed by the user.
Root:
Brute-force search: Is a very general problem-solving technique and algorithmic paradigm that consists of systematically enumerating all possible candidates for the solution and checking whether each candidate satisfies the problem's statement.
Binary search algorithm: Binary search compares the target value to the middle element of the array. If they are not equal, the half in which the target cannot lie is eliminated and the search continues on the remaining half, again taking the middle element to compare to the target value, and repeating this until the target value is found.
Newton–Raphson method: Produces successively better approximations to the roots (or zeroes) of a real-valued function. The most basic version starts with a single-variable function f defined for a real variable x, the function's derivative f ′, and an initial guess x0 for a root of f. If the function satisfies sufficient assumptions and the initial guess is close, then
is a better approximation of the root than x0.
Chinese remainder theorem: (expressed in terms of congruences) is true over every principal ideal domain. It has been generalized to any commutative ring, with a formulation involving ideals.
Euclidean division: is the process of dividing one integer (the dividend) by another (the divisor), in a way that produces a quotient and a remainder smaller than the divisor. The greatest common divisor (or highest common factor) of two integers a, b ∈ Z is the largest integer which divides them both.
Modular equation solutions in this function what I do is to return the number of possible solutions of multiples that can obtain a modular expression that is delivered as a string.