All Categories

Cryptography & Security

Keeping secrets safe: modular arithmetic, RSA, entropy, hashing and error-correcting codes

Modular Exponentiation

NEWIntermediate
c=memodnc = m^e \bmod n

Core operation of RSA encryption — raise a message to a power, modulo n.

View details

RSA Decryption

NEWAdvanced
m=cdmodnm = c^d \bmod n

Recovers the message using the private exponent d.

View details

Euler's Totient

NEWIntermediate
φ(n)=(p1)(q1)\varphi(n) = (p-1)(q-1)

Counts integers below n coprime to it, for n = pq — used to make RSA keys.

View details

Shannon Entropy

NEWAdvanced
H=ipilog2piH = -\sum_i p_i \log_2 p_i

Average information content — and the theoretical strength of a random source.

View details

Password Entropy

NEWIntermediate
H=Llog2RH = L \log_2 R

Bits of security from password length and character-set size.

View details

Key Space Size

NEWIntermediate
K=2bK = 2^b

Number of possible keys for a b-bit key.

View details

Birthday Bound

NEWAdvanced
n1.1772bn \approx 1.177\sqrt{2^b}

Collisions become likely after about √ of the hash space.

View details

Hamming Distance

NEWBasic
d(x,y)=i[xiyi]d(x,y) = \sum_i [x_i \ne y_i]

Number of positions at which two strings differ.

View details

Hamming Code Parity Bits

NEWAdvanced
2rm+r+12^r \ge m + r + 1

Minimum parity bits r needed to protect m data bits.

View details

XOR Cipher

NEWBasic
c=mkc = m \oplus k

Bitwise XOR of message and key; XOR again with k to decrypt.

View details

Diffie–Hellman Shared Secret

NEWAdvanced
s=Bamodps = B^a \bmod p

Two parties derive the same secret over a public channel.

View details

Brute-Force Time

NEWIntermediate
t=Krt = \frac{K}{r}

Time to try every key at a given guess rate.

View details

Avalanche Effect Target

NEWAdvanced
E[Δ]=n2E[\Delta] = \frac{n}{2}

A good hash flips about half its output bits when one input bit changes.

View details

Caesar Cipher Shift

NEWBasic
c=(m+k)mod26c = (m + k) \bmod 26

Shift each letter forward by k positions.

View details

Collision Probability

NEWAdvanced
Pn22NP \approx \frac{n^2}{2N}

Approximate chance of a collision among n items in space N.

View details