Kaydırma şifrelemesi(shift cipher) ile benzer bir yapıya sahiptir. Affine cipher da alfabedeki harf değerini bir a sayısıyla çarpıp b sayısıyla topluyoruz. 26 harften oluşan İngiliz alfabesi için a ve b nin alabileceği değerler şu şekildedir.

\begin{align*}
a&=26\\
b&=\varphi(26)=12
\end{align*}

bu durumda a ve b nin çarpımı sonucu olarak oluşan key space (anahtar uzayı) :

\mathcal{K}=a*b=26*12=312

Here, the letters of an alphabet of size m are first mapped to the integers in the range 0 … m − 1. It then uses modular arithmetic to transform the integer that each plaintext letter corresponds to into another integer that correspond to a ciphertext letter. The encryption function for a single letter is
{\displaystyle E(x)=(ax+b){\bmod {m}}}

where modulus m is the size of the alphabet and a and b are the keys of the cipher. The value a must be chosen such that a and m are coprime. The decryption function is
{\displaystyle D(x)=a^{-1}(x-b){\bmod {m}}}

where a−1 is the modular multiplicative inverse of a modulo m. I.e., it satisfies the equation
{\displaystyle 1=aa^{-1}{\bmod {m}}}

The multiplicative inverse of a only exists if a and m are coprime. Hence without the restriction on a, decryption might not be possible. It can be shown as follows that decryption function is the inverse of the encryption function,
{\displaystyle {\begin{aligned}D(E(x))&=a^{-1}(E(x)-b){\bmod {m}}\\&=a^{-1}(((ax+b){\bmod {m}})-b){\bmod {m}}\\&=a^{-1}(ax+b-b){\bmod {m}}\\&=a^{-1}ax{\bmod {m}}\\&=x{\bmod {m}}\end{aligned}}}


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *