Number Theory and Cryptography
- 114Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
- spaceFlip card
- KI knew it
- DI didn't know it
- ←Previous card
- →Next card
What does it mean for an integer a to divide an integer b?
a divides b if b=ac for some integer c. Then a is a divisor of b, and b is a multiple of a.
Or swipe the card
114 cards
What does it mean for an integer a to divide an integer b?
a divides b if b=ac for some integer c. Then a is a divisor of b, and b is a multiple of a.
If a divides both b and c, what can be concluded about b+c and mb+nc?
a divides b+c and every linear combination mb+nc for integers m,n.
What are three basic divisibility rules for integers?
If a∣b and a∣c, then a∣(b+c); if a∣b, then a∣bc for any integer c; and if a∣b and b∣c, then a∣c.
State the division algorithm for an integer a and a positive integer d.
There are unique integers q,r such that a=dq+r and 0≤r<d.
In the division algorithm, what do a, d, q, and r represent?
a is the dividend, d the positive divisor, q the quotient, and r the remainder. They can be written q=adivd and r=amodd.
What are the quotient and remainder when 101 is divided by 11?
101=11⋅9+2, so the quotient is 9 and the remainder is 2.
What are the quotient and remainder when −11 is divided by 3 under the division algorithm?
−11=3(−4)+1, so the quotient is −4 and the remainder is 1.
When are integers a and b congruent modulo a positive integer m?
a≡b(modm) exactly when m∣(a−b).
How can congruence modulo m be interpreted using remainders?
a≡b(modm) exactly when a and b have the same remainder upon division by m.
Test whether 17≡5(mod6) and whether 24≡14(mod6).
17≡5(mod6) because 17−5=12 is divisible by 6. But 24≡14(mod6) because 24−14=10 is not divisible by 6.
What does the equivalence a≡b(modm) if and only if a=b+km express?
Two integers are congruent modulo m exactly when they differ by k whole steps of size m, for some integer k.
How are the relation a≡b(modm) and the remainder function amodm connected?
a≡b(modm) if and only if amodm=bmodm.
Which operations preserve congruences?
Congruences can be added and multiplied: if a≡b(modm) and c≡d(modm), then a+c≡b+d(modm) and ac≡bd(modm).
Why is division not always valid in a congruence?
Dividing both sides can destroy the congruence. For example, 14≡8(mod6), but dividing by 2 gives 7≡4(mod6).
How can modular addition and multiplication keep calculations with large numbers manageable?
Reduce each input modulo m, perform the operation on the smaller remainders, then reduce the result modulo m.
What is Zm, and what does arithmetic modulo m do?
Zm={0,1,…,m−1}. Modular addition or multiplication performs the usual operation and then reduces the result modulo m.
Which familiar arithmetic properties hold in Zm?
Addition and multiplication are closed, associative, and commutative; 0 and 1 are their respective identities; every element has an additive inverse; and multiplication distributes over addition.
Does every element of Zm have a multiplicative inverse?
No. For example, 2 has no multiplicative inverse modulo 6, since no multiple of 2 modulo 6 equals 1.
What is a base-b expansion of a positive integer?
It is a unique expression n=akbk+ak−1bk−1+⋯+a0, where each digit satisfies 0≤ai<b and the leading digit ak is nonzero.
How does place value work in base ten?
Each position is a power of 10. For example, 965=9⋅102+6⋅10+5.
What are the digits used in binary, octal, and hexadecimal?
Binary (base 2) uses 0,1; octal (base 8) uses 0 through 7; hexadecimal (base 16) uses 0 through 9 and A through F, where A=10 through F=15.
How do you convert a binary numeral to decimal?
Sum the powers of 2 corresponding to positions containing a 1. For example, (11011)2=16+8+2+1=27.
How do you convert an octal or hexadecimal numeral to decimal?
Multiply each digit by its place value and add. For example, (7016)8=7⋅83+1⋅8+6=3598, and (E5)16=14⋅16+5=229.
What are the base-conversion steps for converting a positive integer n to base b?
Repeatedly divide by b, recording each remainder. Continue with each quotient until it is zero; read the remainders in reverse order.
How can binary be converted to octal or hexadecimal without arithmetic?
Group bits from the right into groups of 3 for octal or 4 for hexadecimal, padding the left with zeros if needed, then convert each group to one digit.
What is the basic binary-addition procedure at each bit position?
Add the two bits and the incoming carry. The sum bit is the remainder modulo 2; the outgoing carry is the floor of the total divided by 2.
What is the running time of binary addition of two n-bit integers?
O(n) bit operations.
How does the shifted-partial-products algorithm multiply binary integers?
For each 1 bit of one factor at position j, include the other factor shifted left by j places, equivalent to multiplying it by 2j. Add all partial products.
What is the bit-operation cost of multiplying two n-bit integers by shifted partial products?
O(n2) bit additions.
How does repeated squaring compute bn efficiently?
Write n in binary, successively square b to obtain b,b2,b4,b8,…, then multiply only the powers whose corresponding exponent bits are 1.
How does repeated squaring compute bn(modm) while controlling the size of intermediate values?
Initialize the answer to 1 and the current power to bmodm. Process exponent bits: multiply the answer by the current power modulo m for each 1 bit, and square the current power modulo m at every step.
What is the stated bit-operation cost of modular exponentiation by repeated squaring?
O((logm)2logn) bit operations for computing bn(modm).
What defines a prime, a composite number, and the special case 1?
A prime is an integer greater than 1 whose only positive divisors are 1 and itself. A composite integer greater than 1 is not prime. The number 1 is neither prime nor composite.
What does the Fundamental Theorem of Arithmetic say?
Every integer greater than 1 has a prime factorization, unique apart from the order of its prime factors.
Give prime factorizations of 100, 999, and 1024.
100=22⋅52; 999=33⋅37; 1024=210.
How does the Sieve of Eratosthenes find primes up to a bound?
List integers from 2 to the bound. Keep the next uncrossed number and cross out its larger multiples; repeat until the needed prime divisors have been tested. The uncrossed numbers are prime.
Why is it enough to test prime divisors up to n when checking whether n is composite?
If n=ab is composite, its two factors cannot both exceed n, so at least one factor—and therefore a prime divisor—is at most n.
What is trial division, and why does it become impractical for very large integers?
Test whether any integer from 2 through n divides n; if none does, n is prime. The number of tests grows too large for integers with many digits.
What is Euclid's proof that there are infinitely many primes?
Assume the primes are a finite list and form q as their product plus 1. No listed prime divides q, because each would then divide 1. Yet q is prime or has a prime factor, giving a prime missing from the list—a contradiction.
What is a Mersenne prime, and does a prime exponent guarantee one?
A Mersenne prime has the form 2p−1 and is prime. A prime exponent p does not guarantee primality: 211−1=2047=23⋅89 is composite.
What does the prime number theorem say about the number and frequency of primes?
The number of primes up to x is approximately lnxx, with a better relative estimate as x grows. The chance that a random integer near n is prime is about lnn1.
Can a nonconstant polynomial with integer coefficients produce only primes for all integer inputs?
No. No nonconstant polynomial with integer coefficients always produces primes.
What is Goldbach's conjecture?
Every even integer greater than 2 is the sum of two primes; for example, 10=3+7. It remains unproved.
What are the twin-prime conjecture and the conjecture about numbers of the form n2+1?
The twin-prime conjecture says infinitely many prime pairs differ by 2. Another unproved conjecture says infinitely many numbers n2+1 are prime.
Why is finding large primes important in cryptography?
Large primes are used to construct cryptographic keys, while factoring large composite numbers is computationally difficult.
What is the greatest common divisor of two integers?
The greatest common divisor, gcd(a,b), is the largest positive integer dividing both a and b.
When are two integers relatively prime?
They are relatively prime when their greatest common divisor is 1.
What does it mean for a list of integers to be pairwise relatively prime?
Every pair of distinct members has greatest common divisor 1.
How can prime factorizations be used to find a greatest common divisor?
For each prime appearing in either factorization, take the smaller exponent; multiply the resulting prime powers.
Why is prime factorization a poor general method for finding the gcd of large integers?
The exponent rule is simple, but finding the prime factorizations of large integers is difficult and no fast general method is known.
How is the least common multiple defined, and how can it be found from prime factorizations?
The least common multiple, lcm(a,b), is the smallest positive common multiple. From prime factorizations, use the larger exponent for each prime.
What relationship connects the product, gcd, and lcm of two positive integers?
ab=gcd(a,b)lcm(a,b).
State the key reduction rule behind the Euclidean algorithm.
If a=bq+r, then gcd(a,b)=gcd(b,r).
Use the Euclidean algorithm to find gcd(287,91).
287=3⋅91+14, 91=6⋅14+7, and 14=2⋅7+0, so gcd(287,91)=7.
How does the Euclidean algorithm update its values?
Start with x=a,y=b. While y=0, set r=xmody, then replace (x,y) by (y,r). Return x when y=0.
Why does the Euclidean algorithm terminate, and which remainder gives the gcd?
Each remainder is a nonnegative integer smaller than the previous divisor, so the sequence must reach zero. The gcd is the last nonzero remainder.
What is Bezout's identity?
For positive integers a,b, there exist integers s,t such that gcd(a,b)=sa+tb. The integers s,t are Bezout coefficients.
How can the Euclidean algorithm produce Bezout coefficients?
Record the divisions in a forward pass, then substitute each remainder backward until the gcd is expressed using the original two numbers.
State the divisibility lemma that follows from Bezout's identity.
If gcd(a,b)=1 and a∣bc, then a∣c.
What does the prime-divisor lemma say about a prime dividing a product?
If a prime p divides a1a2⋯an, then p divides at least one factor.
How does the prime-divisor lemma establish uniqueness of prime factorization?
If two prime factorizations of the same integer differed, a prime on one side would divide the product on the other side and therefore equal one of its prime factors. Canceling common primes then contradicts the assumption that the factorizations differed.
When is cancellation valid in a congruence ac≡bc(modm)?
If gcd(c,m)=1, then ac≡bc(modm) implies a≡b(modm).
What is a linear congruence, and how are its solutions organized?
A linear congruence has form ax≡b(modm). If x is a solution, then so is x+km for any integer k; solutions occur in congruence classes.
What do the examples 2x≡3(mod6) and 2x≡2(mod6) illustrate?
2x≡3(mod6) has no solution because 2x is always even. The congruence 2x≡2(mod6) has two solution classes: x≡1 and x≡4(mod6).
What is a multiplicative inverse of a modulo m?
An inverse of a modulo m is a number aˉ satisfying aˉa≡1(modm).
When does a have a unique multiplicative inverse modulo m?
If m>1 and gcd(a,m)=1, then an inverse exists and is unique modulo m.
How does Bezout's identity prove that an inverse exists when gcd(a,m)=1?
Bezout gives integers s,t with sa+tm=1. Reducing modulo m yields sa≡1(modm), so s is an inverse of a.
How can the Euclidean algorithm find the inverse of 3 modulo 7?
7=2⋅3+1, so 1=7−2⋅3. Thus −2 is an inverse of 3 modulo 7; its representative in {0,…,6} is 5.
How do you solve 3x≡4(mod7) using an inverse?
Multiply by the inverse −2≡5(mod7): x≡−8≡6(mod7).
What is the Chinese Remainder Theorem?
If moduli m1,…,mn are pairwise relatively prime, then any system x≡ai(modmi) has a unique solution modulo M=m1m2⋯mn.
How does the constructive proof of the Chinese Remainder Theorem build a solution?
Set M=∏imi, Mk=M/mk, and choose yk with Mkyk≡1(modmk). Then x=∑kakMkyk solves the system.
Solve Sun-Tsu's system x≡2(mod3), x≡3(mod5), x≡2(mod7).
x≡23(mod105).
How does back substitution solve a system of congruences?
Rewrite the first congruence as an equation with an integer parameter, substitute into the next congruence, solve for the new parameter, and repeat. Convert the final equation back into a congruence.
State Fermat's little theorem in its two forms.
If p is prime and p∤a, then ap−1≡1(modp). For every integer a, ap≡a(modp).
How does Fermat's little theorem simplify a large exponent modulo a prime?
Reduce the exponent using ap−1≡1(modp), leaving only the exponent's remainder modulo p−1 when p∤a.
What is a pseudoprime to base b?
A composite integer n is a pseudoprime to base b if bn−1≡1(modn).
What can a Fermat primality test conclude when its congruence fails or passes?
If the test fails, n is certainly composite. If it passes, n may be prime or a pseudoprime, so the test is inconclusive.
What is a primitive root modulo a prime p?
A primitive root r has powers that visit every nonzero residue modulo p exactly once before repeating.
What is a discrete logarithm modulo a prime?
If r is a primitive root modulo p, the discrete logarithm of a to base r is the exponent e such that re≡a(modp).
Why is the discrete logarithm problem useful in cryptography?
Computing a modular power forward is efficient, while recovering its exponent for large parameters is believed to be difficult.
What is a hashing function, and what does h(k)=kmodm accomplish?
A hash function maps a record's key to a storage location. The function h(k)=kmodm maps keys into locations 0 through m−1.
What is a collision in hashing, and why are collisions unavoidable?
A collision occurs when distinct keys map to the same location. Collisions are unavoidable when there are more possible keys than storage locations.
How does linear probing handle a hashing collision?
Try (h(k)+i)modm for i=0,1,2,… until a free slot is found.
What is a pseudorandom number generator, and how does the linear congruential method work?
It produces deterministic numbers that appear random. The linear congruential rule is xn+1=(axn+c)modm, using a modulus, multiplier, increment, and seed.
What is the period of a pseudorandom sequence, and why must it eventually repeat?
The period is the number of terms before the sequence repeats. With only m possible residues, some value must recur; because the next value depends only on the current one, the sequence then cycles.
What is a pure multiplicative generator, and what problem occurs with a zero seed?
It is a linear congruential generator with c=0. A zero seed remains zero forever because each next value is a multiple of the current value modulo m.
How do check digits detect errors using modular arithmetic?
An extra digit is chosen so a specified weighted sum of the digits is congruent to 0 modulo a chosen number. A typing error often changes the sum and makes the check fail.
What is the UPC check-digit rule?
For a twelve-digit UPC, multiply digits in odd positions by 3, leave digits in even positions unchanged, and require the total to be 0 modulo 10.
What does a failed UPC weighted-sum check establish?
If the weighted sum of all twelve digits is not congruent to 0(mod10), the code fails validation.
What is the ISBN-10 check-digit rule?
Multiply the ten digits by their positions 1 through 10 and require the weighted sum to be 0 modulo 11; equivalently, the check digit is the first nine digits' weighted sum modulo 11.
Why can the ISBN-10 check detect every single-digit error and every transposition error?
Its position-weighted sum is computed modulo the prime 11. A single-digit change or a swap of two unequal digits changes the weighted sum by a nonzero amount modulo 11.
What is cryptography, and how do encryption and decryption differ?
Cryptography studies methods for secret messages. Encryption transforms plaintext into ciphertext; decryption recovers the plaintext.
How does the Caesar cipher encode letters and encrypt them?
Represent A through Z by 0 through 25, then encrypt p as (p+3)mod26.
How is a Caesar-cipher message decrypted?
Shift each ciphertext letter back by 3, using p↦(p−3)mod26.
What is a shift cipher and why is it weak?
A shift cipher uses a key k, encrypting by (p+k)mod26 and decrypting by (c−k)mod26. It has only 26 possible keys.
What defines an affine cipher, and when is it decryptable?
An affine cipher encrypts p as (ap+b)mod26. It is decryptable exactly when gcd(a,26)=1.
How do you decrypt an affine cipher c≡ap+b(mod26)?
If aˉ is the inverse of a modulo 26, then p≡aˉ(c−b)(mod26).
How can letter-frequency analysis break a shift cipher?
Count ciphertext letters, guess that the most frequent represents English E, infer the shift, and decrypt. If the result is not English, try another frequent-letter guess.
What is a monoalphabetic cipher, and what weakness do such ciphers share?
It consistently replaces each plaintext letter with one ciphertext letter. Because the same letter always maps to the same one, letter-frequency patterns remain available to an attacker.
How does a transposition cipher encrypt a message?
Split the message into blocks and rearrange positions within each block using a permutation; pad a short final block if needed. Decrypt using the inverse permutation.
Does transposition alone hide single-letter frequencies?
No. It only rearranges letters, so every single-letter frequency is preserved exactly.
What five components define a cryptosystem?
A cryptosystem consists of the plaintext set P, ciphertext set C, keyspace K, encryption functions E, and decryption functions D.
How does the shift cipher fit the general cryptosystem definition?
Plaintext and ciphertext are strings over Z26; the keyspace is Z26; encryption adds the key modulo 26, and decryption subtracts it.
What distinguishes private-key cryptography from public-key cryptography?
Private-key systems require communicating parties to share a secret key. Public-key systems publish the encryption key while keeping a separate decryption key secret.
What numbers make up an RSA public key, and how are they chosen?
The public key is (n,e), where n=pq for distinct large primes p,q, and e is relatively prime to (p−1)(q−1).
Why is RSA designed around multiplying primes but hiding their factors?
Multiplying large primes is easy, while factoring their product into the primes is believed to be difficult.
How is a text message prepared and encrypted with RSA?
Encode each letter as a two-digit number, join the numbers, split into blocks smaller than n, and encrypt each block by c≡Me(modn).
How is an RSA message decrypted?
Find d such that ed≡1(mod(p−1)(q−1)), then recover each block with M≡cd(modn).
Why can an RSA sender encrypt using a public key while only the receiver can decrypt?
Computing the private exponent d requires (p−1)(q−1), which requires knowing p and q; recovering them from n=pq requires factoring n.
What is a cryptographic protocol, and what is the goal of Diffie–Hellman key exchange?
A protocol is a set of messages exchanged to achieve a goal. Diffie–Hellman lets two parties establish a shared secret key over a channel an eavesdropper can observe.
What are the steps of Diffie–Hellman key exchange?
Publicly agree on a prime p and primitive root a. Alice sends ak1(modp) and Bob sends ak2(modp); each raises the received value to their own secret exponent.
Why is a Diffie–Hellman eavesdropper unable to compute the shared key from the public messages?
The eavesdropper sees ak1 and ak2 but would need to recover a secret exponent, which is a discrete logarithm problem.
What does a digital signature establish, and how does the RSA signing idea work?
A digital signature provides evidence of authorship, not secrecy. The sender applies the private RSA transform to the message blocks; anyone can apply the public transform to recover and verify them.
What weakness does raw RSA signing have, and how do real systems address it?
With raw RSA, an attacker can choose a number s and define the corresponding message as se(modn), producing a pair that passes the check. Real systems sign a hash of the message instead.

Ask anything
We've read this whole study set, so questions about it get the best answers.