Cryptography Reference
In-Depth Information
Note that in this program, the BigInteger class (or the Int class) is not used. This is
because it isn't necessary to use large integers when we are only shifting a single byte up
or down by a maximum of 255. Regular Java ints work just fine. In the program, the user
enters a shift value, and then the plaintext. It enciphers this as an array of bytes, and then
converts the enciphered byte array back to a string and displays the ciphertext. Next it
reverses the process and recovers the plaintext.
Note also that the message need not be text. Any type of data can be enciphered and
deciphered, as long as it is first converted into an array of bytes.
5.2
WEAKNESSES OF THE CAESAR CIPHER
The Caesar Cipher is a secret key cryptosystem; that is, revealing the enciphering key makes
decryption simple. In the Caesar cipher, the shift value is the enciphering key. Anyone know-
ing it can immediately decrypt, so it must be protected from unauthorized persons.
Ciphertext Only Attack. Whenever a cryptosystem can be broken by examining
only the ciphertext, we call this a ciphertext only attack. As discussed previously, frequency
analysis of the ciphertext can be used to break the Caesar cipher. Any cipher vulnerable to
ciphertext only attack is considered completely insecure and should never be used.
Exhaustive Key Search. There is yet another method for breaking the Caesar cipher:
simply try all the possible keys! After all, there are only 25 viable keys in the ordinary alpha-
bet, and only 255 useful keys in the ASCII alphabet! This kind of attack is called an exhaus-
tive search. An exhaustive search is rarely effective against all but the simplest of
cryptosystems.
Seeing that the Caesar cipher is so vulnerable, we endeavor to develop stronger cryp-
tosystems.
5.3
AFFINE TRANSFORMATION CIPHERS
After the Caesar cipher, the simplest type of enciphering transformation is the affine trans-
formation, which multiplies each plaintext value by another number and then adds a shift.
This may be represented by the congruence
C mP
+
b
(mod
n
)
where
n
is the size of the alphabet. The multiplier
m
in the above congruence must be rel-
atively prime to
, otherwise decryption is not possible. For in order to decrypt, we must solve
the above congruence for
n
P
. A unique solution exists only if an inverse of
m
modulo
n
(denoted
m
) exists, which further only exists when (
m
,
n
) = 1. The inverse
m
of
m
mod-
ulo
is easily obtained by using the extended Euclidean algorithm, and hence we have the
deciphering transformation
n
P m
(
C b
) (mod
n
).
Search WWH ::




Custom Search