Using Quasigroups for Secure Encoding of

Eliška Ochodková, Václav Snášel [email protected], [email protected]

Department of Computer Science Faculty of Electrical Engineering and Computer Science Technical University of Ostrava Ostrava, Czech Republic

Abstract In this article we discuss a method for encoding a file system based upon properties of quasigroups. The presented cipher, due to its simplicity, can be easily implemented, giving in consequence a very fast enci- phering and deciphering. Beside that, the method can be very secure and resisting to any attack.

Keywords: file system, quasigroups, Latin square, cryptography, stream ciphers.

1. Introduction Cryptography deals with the transformation of ordinary text (plaintext) into coded form (cipher text) by encryption, and transformation of cipher text into plaintext by decryption. Three of the most important services provided by cryptosystems are secrecy, authenticity, and integrity. Secrecy refers to a denial of access to information by unauthorized individuals. Authenticity refers to validating the source of a message. Integrity refers to an assurance that a message was not modified accidentally or deliberately in transit, by replacement, insertion or deletion. An ideal system might solve all of problems concurrently, i.e., using public keys; providing secrecy; and providing authenticity. Unfortunately no single technique has met all three criteria. Conventional systems such as DES [7] require management of secret keys; systems using public key components may provide authenticity but are inefficient for bulk encryption of data due to low bandwidths. The aim of this paper is to focus the reader’s attention to the existence of an algebraic system called qua- sigroups and to show that it can be applied in cryptography for constructing stream ciphers. It is demon- strated that it is possible to form a huge number of quasigroups quite easily and to construct stream ciphers over the alphabet of a finite order q, based on quasigroups. The method allows one to form many invertible transformations that may be used to encipher and decipher. Number of these transformation increases very rapidly with respect to q. We remind that quasigroups are equivalent to the more familiar Latin squares. The multiplication table of a quasigroup of order q is a Latin square of order q, and conversely as indicated in [2], every Latin square of order q is the multiplication table of a quasigroup of order q. In section 2 we define a stream cipher based upon the quasigroup, we use modified Hall algorithm (see [12]), section 3 describes some features of file system, in section 4 some results of implementation of our system are presented.

- 175 - 2. Quasigroup Encryption

2.1 Algorithms and Keys Formally, a set of cryptographic algorithms or ciphers is defined as a set of mathematical functions used for encryption and decryption. There are two types of algorithms: 1. Algorithms that use public keys (for example well known RSA algorithm) 2. Algorithms that use secret keys (a typical example is DES). Asymmetric algorithms (public-key algorithms) use two keys: the first one is public and it is used for encryption and the second one is private and it is used for decryption. Secret-keys algorithms, also called symmetric algorithms, are algorithms where the encryption key can be calculated from the decryption key and vice versa. The security of a symmetric algorithm rests in the key, divulging of the key means that anyone could encrypt and decrypt messages. Symmetric algorithms can be divided into two categories: block algorithms (block ciphers) and stream algorithms (stream ciphers). Block ciphers operate on blocks of data and stream ciphers operate on the plaintext a single bit (or byte) at a time. Encryption and decryption with symmetric algorithm are denoted by EK (P) = C, DK (C) = P , where plaintext is denoted by P, cipher text is denoted by C, the encryption function is denoted by E, the decryption function is denoted by

D, the secret key is denoted by K. Clearly, the following relation must hold: DK (EK (P)) = P .

2.2 Some necessary concepts

Definition 1. Let A = {a1,a2 ,..., an}, be an alphabet, a k x n Latin rectangle is a matrix with entries aij Î A,i =1,2,...,k, j =1,2,..., n , such that each row and each column consists of different elements of A. If k =n we say a Latin square instead of a Latin rectangle. A Latin square is called reduced (or in standard form) if both the first row and the left column are in some standard order, alphabetical order being conven- ient.

Definition 2. A grupoid (Q, *) is said to be a quasigroup (i.e. algebra with one binary operation * on the set Q) satisfying the law: (" u, v Î Q) ($! x, y Î Q) (u * x = v Ù y * u = v). (1) This implies: 1. x * y = x * z Ú y * x = z * x Þ y = z 2. the equations a * x = b, y * a = b have unique solutions x, y for each a, b Î Q. As a consequence we have that, when (Q, *) is a finite set, the main part of the Cayley scheme of the qua- sigroup (Q, *) represents a Latin square.

We can associate to the operation * a new operation \ on Q (see [2]), called right inverse of *, by x * y = z Û x \ z = y. (2)

Definition 3. We say that (Q, \) is inverse (or dual) quasigroup to (Q, *). We also say that the grupoid (Q, *, \) is a quasigroup. The quasigroup (Q, *, \) satisfies the following identities: (3) x \ (x * y) = y, x * (x \ y) = y.

- 176 - 2.3 Constructing a stream cipher based upon quasigroups

Let a finite set A = {a1, a2 ,...,an}, n ³1be an alphabet and let (A, *, \) be the quasigroup as defined above. Let A+ is the nonempty words formed by elements of A. The elements of A+ will be denoted by elements of A. Now we define on A+ two transformations as follows:

Definition 4. Let uiÎA, k³1. Then

f * (u1u2 ...uk ) = v1v2 ...vk Û v1 = l * u1 ,vi+1 = vi * ui+1 , i =1,2,...,k -1, (4)

f \ (u1u2 ...uk ) = v1v2 ...vk Û v1 = l \ u1 ,vi+1 = vi \ ui+1 , i =1,2,...,k -1, (5)

We say that the sextuple (A, *, \, f*, f\ ) is a quasigroup cipher over the alphabet A. Now it is possible to + say that f* o f \ = 1A+ , where 1A+ is the identical map on A and ° is the composition of maps. For the + proof see [1]. If u Î A is a plain text, it has been seen that f\ ( f* (u)) = u. Now it is clear that we can use first transformation defined in (4) as an encoding function, and second transformation defined in (5) as a decoding function over an alphabet A. Example 1. Let A ={0, 1, 2} and let the quasigroup (A, *), i.e. (A, \) be defined by Table 1. Let l = 0 and u

=120001120. Then the cipher text of u is v = f* (u) = 220121001. After aplying of decoding function on v we get f\ (220121001) =120001120 = u. Table 1. The quasigroup (A, *, \) * 0 1 2 \ 0 1 2 0 1 2 0 0 2 0 1 1 2 0 1 1 1 2 0 2 0 1 2 2 0 1 2

2.4 Properties of the method It is mentioned in [11] that all reduced Latin squares of order n are enumerated for n £ 10 as it is shown in Tab.2. Let Ln be the number of Latin squares of order n, and let Rn be the number of reduced Latin squares of order n. It is easy to see that Ln = n! (n - 1)! Rn. In [11] there are also mentioned estimates of Latin squares of order up to 15. However, the problem of classification and exact enumeration of quasigroups of order greater than 10 probably still remains unsolved. This method of obtaining quasigroup is based on modified Hall algorithm [12] for generating n x n Latin squares. There is at least n! (n – 1)!…2! Latin squares. If we take an alphabet A={0…255} (i.e. data are represented by 8 bits) there are at least 256! 255! …2!>1058000 quasigroups. Suppose that intruder knows a cipher text v = v1v2 ...vk = f* (u1u2 ...uk ) , where u1u2 ...uk represents the unknown plain text. For recovering the quasigroup (A, *), which is the key of the encoding method he should solve a system of equalities of the form:

v1 = l * u1 ,

v2 = v1 * u2 , ......

vk = vk-1 * uk . But, as mentioned above, this system of equalities has as many solutions as there are quasigroups of order 256. It implies this method to be resist to the brute force attack.

- 177 - n La 1 1 2 1 3 1 4 4 5 56 6 9,408 7 16,942,080 8 535,281,401,856 9 377,597,570,964,258,816 10 7,580,721,483,160,132,811,489,280 Table 2. Numbers of reduced Latin rectangles

Presented method seems to be resisting to statistical attack as it is shown in section 4. As it can be seen, presented method produces a cipher text with the same length as the plaintext, and encryption is of a stream nature. This method is also robust on errors, as it is shown in [1].

3. Installable File Systems A file system is a software component that manages files on a disk or other local storage device, such as CD- drive, tape, and so on. There are two main types of file system drivers: local (media-based) and remote (network-based). A file system driver must access newly exposed system components or additional func- tionality of previously exposed system components. Examples of these components include cache manager, memory manager, security, synchronisation, and locking. Local file systems have their own on-media format and are used on local media by the . These file systems talk to the local storage drivers for I/O. Examples of local file systems include NTFS, FAT, and CDFS. An operating system Linux (see [8]) supports several types of file systems, for example MINIX, XIA, . In addition, it supports several file systems of other operating systems, for example MSDOS is com- patible with FAT file system, HPFS is compatible with OS/2 file system. Windows 98 features a layered file system architecture that supports multiple file systems, including the virtual (VFAT), CD-ROM file system (CDFS), and UDF. The new file system architecture makes the computer easier to use and improves file and disk I/O perform- ance. Features of the new file system architecture include long file name support and a dynamic system cache for file and network I/O. Long file name support improves ease of use because users no longer need to reference files by the MS-DOS 8.3 file name. Instead, users can specify names of up to 255 characters to identify their documents. In addi- tion, file names seem to be less cryptic and easier to read, because Windows 98 hides the file name exten- sions from users. Windows 98 features 32-bit, protected-mode codes for reading information from and writing information to the file system and the disk device. It also includes 32-bit dynamically sizeable caching mechanisms, and a full, 32-bit code path is available from the file system to the disk device. Moreover, it includes open file system architecture for future system support.

- 178 - Figure 1 shows the file system architecture used by Windows 98.

Figure 1. Windows 98 file system architecture

The Windows98 file system architecture is made up of the following components: · Installable File System (IFS) Manager. The IFS Manager is responsible for arbitrating access to different file system components. · File system drivers. The file system driver layer includes access to FAT-based disk devices, CD-ROM file systems, and redirected network device support. · Block I/O subsystem. The block I/O subsystem is responsible for interacting with the physical disk device. Installable File System allows complete protection of data, thus it seems to be very useful complete presented method as a new feature of it. It appears to be especially convenient for laptops.

4. Application We briefly describe the result of an implementation of our system based upon the use of a quasigroup of order 256. The scheme of the encrypting and decrypting procedure is shown in following fragment code. void cQuasigroupCipher::Encoding(const unsigned int Count, const unsigned int Element, const char* Source, char* Destination) { unsigned int tmp = Element; int tmp1 = Element; for(unsigned int i = 0; i < Count; i++) { Destination[i] = tmp = m_Quasigroup->Operation(tmp, (unsigned char)Source[i]); } }

- 179 - void cQuasigroupCipher::Decoding(const unsigned int Count, const unsigned int Element, const char* Source, char* Destination) { unsigned int tmp = Element; for(unsigned int i = 0; i < Count; i++) { Destination[i] = m_Quasigroup->InverseOperation(tmp, (unsigned char)Source[i]); tmp = (unsigned char)Source[i]; } }

Figure 2. Distribution of characters found in text files (solid line) and the distribution of characters found in its cipher text (dot line).

The resistance of the method on statistic attack seems to be very good. In Figure 2 we present the distribu- tion of the characters of a plain text and of its cipher text and the uniform distribution of the characters of cipher text is evident. We use the Documents of the Chamber of Deputies for test.

5. Conclusions and future works Here we presented method of constructing stream cipher based on transformation defined by quasigroups and in future we will proceed with application of presented method. The ciphers, generated as mentioned above, have following properties: · The ciphertext has the same length as the plaintext. · It is robust on errors, the phenomena of propagation of errors do not occur. · The cipher is very secure, because there is no algorithm of the exhaustive search of all quasigroups that can be generated. · Proposed method, being very simple, offers very fast implementation of encrypting and decrypting procedures. Quasigroups, in spite of their simplicity (they are allowed to be a mathematical toy), have various applica- tions, for some see [9, 10]. It can be seen that many other encrypting algorithms can be formed on the basis of quasigroups. Some of them are mentioned in [3, 4]. In future works we can use finite geometry for constructing stream cipher method.

- 180 - 6. References [1] Markovski, S., Gligorodski, D., Andova S.: Using quasigroups for one-one secure encodig, in Proc. of VIII Conf. Logic and Computer Science ”LIRA’97”, Novi Sad, pp. 157-162, 1997. [2] Dénes, J., Keedwell, A. D.: Latin Squares and their Applications, Akadémiai Kiadó, Budapest; Academic Press, New York, 1974. [3] Koscielny, C.: A method of Constructing Quasigroup-Based Stream Cipher, Applied Mathematics and Computer Science, vol. 6 No.1, pp. 109-121, 1996. [4] Koscielny, C., Mullen, G. L.: A Quasigroup-Based Public-Key Cryptosystem, Int. J. Appl. Math. And Comp. Sci, vol. 9 No.2, pp. 101-109, 1999 [5] Baker, A.: The Windows NT Book, Prentice Hall, New Jersey, 1997. [6] Viscarola, P. G., Mason, W. A.: Windows NT Device Driver Development, MacMillan Technical Publishing, Indianapoils, 1999. [7] Schneier, B.: Applied Cryptography, John Wiley & Sons, Inc., New York, 1996. [8] Linux: Documentation Project, Computer Press, Prague, 1998. [9] Smith, J. D. H.: A Class of Quasigroups Solving a Problem of Ergodic Theory, Commentationes Mathematicae Universitatis Carolinae, vol. 41 No. 2, pp. 409-414, 2000. [10] Keedwell, A. D.: Construction, Properties and Applications of Finite Neofields, Commentationes Mathematicae Universitatis Carolinae, vol. 41 No. 2, pp. 283-297, 2000. [11] McKay, B, Rogoyski, E.: Latin Square of Order 10, Electronic Journal of Combinatorics, vol.2, 1995, http://www.combinatorics.org/volume_2/cover.html. [12] Hall, M.: Combinatorial theory, Blaisdell Publishing Company, Massachusetts, 1967.

- 181 -