G. Thirunavukkarasu et al., International Journal of Emerging Trends in Engineering Research, 8(6), June 2020, 2913 - 2918 2919 ABSTRACT In this paper, the use of a random seed is integrated to Affine cipher. The random seed is used to generate unique keystream values that dynamically changes the cipher’s additive key for every character encrypted. The modification enables the cipher algorithm to produce ciphertext with no trace of repetitive character despite the advent of repetition of characters in the plaintext. Simulation results revealed that the proposed method produces more randomize ciphertext characters as against the traditional Affine cipher. The new method enhances the cipher’s capability and complexity in masking plaintext which has paved the way to a more secure and dynamic data encryption. Key words: Affine cipher, character repetition, cryptography, dynamic encryption, keystream 1. INTRODUCTION There are numerous ways of securing sensitive information. One method is through encryption or the transformation of data into unintelligible format. Data is secured based on the cryptographic and cipher algorithm [1] used according to the type of data being hidden. Cipher [2] technology can be based on mathematical theories and some are based on classical calculations [3]. In this paper, the classical cipher called Affine cipher [2], [4]–[6] is modified to minimize the production of repetitive characters in the ciphertext. This is realized by introducing a random seed that produces unique encryption keys called keystream for the affine encryption and decryption function. 2. METHODOLOGY 2.1 Affine Cipher The word affine is a term used to refer to the linear function f(x) = (ax + b), where b is a nonzero value. In cryptography, the Affine cipher is a monoalphabetic substitution cipher based on the Caesar cipher and is defined by the formula A j,d : x → y = A j,d (x) = (jx + d) mod m, where m is the range of alphabets, and j and d are the keys [7]. The values for j and m must be coprime so that decryption is possible through the equation A j,d (y) ≡ j 1 (y − d) mod m, where j 1 is the inverse modular multiplicative of modulo m that satisfies that equation 1 = aa 1 mod m [8]–[10]. Affine cipher works by mapping a set of alphabets to a range of integers. Using modular arithmetic, each plaintext character is transformed into an integer and that which is transformed into a ciphertext character [8], [9]. For instance, the plaintext UNNEEDED is encrypted using the traditional Affine cipher. First, each character is converted to its numerical equivalent according to its alphabetical index, such that A is 0 and Z is 25. The alphabets A to Z and their corresponding index values are presented in Table 1. Based on the given, the numerical equivalent of the plaintext UNNEEDED represented as x is 20 13 13 4 4 3 4 3, as shown in Table 2. Table 1: Alphabet indices A B C D E F G H I J K L M 0 1 2 3 4 5 6 7 8 9 10 11 12 N O P Q R S T U V W X Y Z 13 14 15 16 17 18 19 20 21 22 23 24 25 Table 2: Plaintext numerical equivalent Plaintext U N N E E D E D x 20 13 13 4 4 3 4 3 Given the affine encryption function A j,d (x) = (5x + 8) mod 26 where the value 5 is coprime of the modulo, x is the numeric equivalent of the plaintext character, 8 is an arbitrary value for the number of shifts, and modulo 26 is the size of the alphabet, the plaintext is translated to 4 21 21 2 2 23 2 23 as presented in Table 3. These values are converted to ciphertext using the affine table as shown in Table 4. Table 3: Encryption using Affine cipher Plaintext U N N E E D E D x 20 13 13 4 4 3 4 3 (5x + 8) mod 26 4 21 21 2 2 23 2 23 Ciphertext E V V C C X C X The decryption process uses the equation D(y) = 21(y − 8) mod 26 where 21 is the modular multiplicative inverse a 1 of modulo 26, y is numeric equivalent of the ciphertext character, and 8 is the number of shifts. For instance, the ciphertext EVVCCXCX is translated as 4 21 21 2 2 23 2 23 and decrypted as UNNEEDED as presented in Table 5. A Keystream-Based Affine Cipher for Dynamic Encryption Jan Carlo T. Arroyo 1 , Allemar Jhone P. Delima 2 1 College of Computing Education, University of Mindanao, Davao City, Davao del Sur, Philippines 2 College of Engineering, Technology and Management, Cebu Technological University-Barili Campus, Cebu, Philippines jancarlo_arroyo@umindanao.edu.ph 1 , allemarjpdjca@yahoo.com 2 ISSN 2347 - 3983 Volume 8. No. 7, July 2020 International Journal of Emerging Trends in Engineering Research Available Online at http://www.warse.org/IJETER/static/pdf/file/ijeter06872020.pdf https://doi.org/10.30534/ijeter/2020/06872020