m373 shift cipher
DESCRIPTION
Shift ChiperTRANSCRIPT
Shift and affine ciphers,Number with different
bases,Hong-Jian Lai
Department of Mathematics
West Virginia University
Morgantown, WV
– p. 1/??
Decoding Shift-cipher
Alphabet: Z26.
Problem: Decode a ciphertext wklvverxogehtxlwhhdvb
encoded with a shift cipher
allshift(’wklvvkrxogehtxlwhhdvb’)
thisshouldbequiteeasy (plain text can be found in theoutput)
– p. 2/??
Decoding Shift-cipher
Alphabet: Z26.
Problem: Decode a ciphertext wklvverxogehtxlwhhdvb
encoded with a shift cipher
allshift(’wklvvkrxogehtxlwhhdvb’)
thisshouldbequiteeasy (plain text can be found in theoutput)
– p. 2/??
Decoding Shift-cipher
Alphabet: Z26.
Problem: Decode a ciphertext wklvverxogehtxlwhhdvb
encoded with a shift cipher
allshift(’wklvvkrxogehtxlwhhdvb’)
thisshouldbequiteeasy (plain text can be found in theoutput)
– p. 2/??
Decoding Shift-cipher
Alphabet: Z26.
Problem: Decode a ciphertext wklvverxogehtxlwhhdvb
encoded with a shift cipher
allshift(’wklvvkrxogehtxlwhhdvb’)
thisshouldbequiteeasy (plain text can be found in theoutput)
– p. 2/??
Encoding with an affine cipher
Alphabet: Z26.
Problem: Encrypt the plain text ’meetmeinstlouis’ withan affine cipher E3,7(x) ≡ 3x + 7
affinecrypt(’meetmeinstlouis’, 3, 7)ans = rttmrtfujmoxpfj (ciphertext in the output).
– p. 3/??
Encoding with an affine cipher
Alphabet: Z26.
Problem: Encrypt the plain text ’meetmeinstlouis’ withan affine cipher E3,7(x) ≡ 3x + 7
affinecrypt(’meetmeinstlouis’, 3, 7)ans = rttmrtfujmoxpfj (ciphertext in the output).
– p. 3/??
Encoding with an affine cipher
Alphabet: Z26.
Problem: Encrypt the plain text ’meetmeinstlouis’ withan affine cipher E3,7(x) ≡ 3x + 7
affinecrypt(’meetmeinstlouis’, 3, 7)ans = rttmrtfujmoxpfj (ciphertext in the output).
– p. 3/??
Decoding with an affine cipher
Alphabet: Z26.
Problem: The cipher text ’rttmrtfujmoxpfj’ wasencrypted using the affine function f(x) = 3x + 7 inZ26. Decrypt it.
(Step 1: ) Compute the inverse functionf−1(y) ≡ 9y + 15 (mod 26).
(Step 2: ) Decryption using matlab:affinecrypt(’rttmrtfujmoxpfj’, 9, 15)ans = meetmeinstlouis
– p. 4/??
Decoding with an affine cipher
Alphabet: Z26.
Problem: The cipher text ’rttmrtfujmoxpfj’ wasencrypted using the affine function f(x) = 3x + 7 inZ26. Decrypt it.
(Step 1: ) Compute the inverse functionf−1(y) ≡ 9y + 15 (mod 26).
(Step 2: ) Decryption using matlab:affinecrypt(’rttmrtfujmoxpfj’, 9, 15)ans = meetmeinstlouis
– p. 4/??
Decoding with an affine cipher
Alphabet: Z26.
Problem: The cipher text ’rttmrtfujmoxpfj’ wasencrypted using the affine function f(x) = 3x + 7 inZ26. Decrypt it.
(Step 1: ) Compute the inverse functionf−1(y) ≡ 9y + 15 (mod 26).
(Step 2: ) Decryption using matlab:affinecrypt(’rttmrtfujmoxpfj’, 9, 15)ans = meetmeinstlouis
– p. 4/??
Decoding with an affine cipher
Alphabet: Z26.
Problem: The cipher text ’rttmrtfujmoxpfj’ wasencrypted using the affine function f(x) = 3x + 7 inZ26. Decrypt it.
(Step 1: ) Compute the inverse functionf−1(y) ≡ 9y + 15 (mod 26).
(Step 2: ) Decryption using matlab:affinecrypt(’rttmrtfujmoxpfj’, 9, 15)ans = meetmeinstlouis
– p. 4/??
Converting numbers in different bases
Problem: Convert a number-26 number (HPAC)26 tobase-10.
Find the numerical values H = 7, P = 15, A = 0 andC = 2.
Use matlab to compute:n = 7 ∗ 263 + 15 ∗ 262 + 2
n = 133174
– p. 5/??
Converting numbers in different bases
Problem: Convert a number-26 number (HPAC)26 tobase-10.
Find the numerical values H = 7, P = 15, A = 0 andC = 2.
Use matlab to compute:n = 7 ∗ 263 + 15 ∗ 262 + 2
n = 133174
– p. 5/??
Converting numbers in different bases
Problem: Convert a number-26 number (HPAC)26 tobase-10.
Find the numerical values H = 7, P = 15, A = 0 andC = 2.
Use matlab to compute:n = 7 ∗ 263 + 15 ∗ 262 + 2
n = 133174
– p. 5/??
Converting and Base-10 number to a base-b
number
Problem: Convert the base-10 number n = 13245 tobase-26.
n=1325; m=26; d0 = mod(n, m)d0 = 25n1=(n-d0)/m; d1 = mod(n1,m)d1 = 24n2=(n-d1)/m; d2 = mod(n2,m)d2 = 1n3 = (n2-d2)/m; d3 = mod(n3,m)d3 = 0
The answer is n = (1 24 25)26 = (BY Z)26.
– p. 6/??
Converting and Base-10 number to a base-b
number
Problem: Convert the base-10 number n = 13245 tobase-26.
n=1325; m=26; d0 = mod(n, m)d0 = 25n1=(n-d0)/m; d1 = mod(n1,m)d1 = 24n2=(n-d1)/m; d2 = mod(n2,m)d2 = 1n3 = (n2-d2)/m; d3 = mod(n3,m)d3 = 0
The answer is n = (1 24 25)26 = (BY Z)26.
– p. 6/??
Converting and Base-10 number to a base-b
number
Problem: Convert the base-10 number n = 13245 tobase-26.
n=1325; m=26; d0 = mod(n, m)d0 = 25n1=(n-d0)/m; d1 = mod(n1,m)d1 = 24n2=(n-d1)/m; d2 = mod(n2,m)d2 = 1n3 = (n2-d2)/m; d3 = mod(n3,m)d3 = 0
The answer is n = (1 24 25)26 = (BY Z)26. – p. 6/??