1. Field of the Invention
The present invention is related to the field of data encryption. In particular, the present invention is related to a method and apparatus to implement the data encryption standard algorithm.
2. Description of the Related Art
The data encryption standard (DES) specifies a cryptographic algorithm for encrypting and decrypting binary information comprising of 64 bits using a 64-bit key. (Please see the federal information processing standards (FIPS) publication 46-2). The DES specifies both encrypting and decrypting operations, and decrypting is accomplished by using the same key as is used for encrypting but with the schedule for addressing the key bits altered so that decrypting is the reverse of the encrypting process.
A key in the DES consists of 64 binary bits, 56 of these bits are randomly generated and are used by the DES algorithm. The other 8 bits of the key are used for error detection. Users of the encrypted computer data must have the key that was used to encrypt the data in order to decrypt it.
A data block that is to be encrypted is subject to an initial permutation (IP), then to a complex key-dependent computation, and finally to a permutation which is the inverse of the initial permutation (IP−1).
Mathematically, for each DES iteration if the 64 bits of an input block consists of a 32-bit block L followed by a 32-bit block R, then, the input block 105 is LR.
Let K be a block of 48 bits chosen from the 64-bit key. Then the output L′R′ of a single DES iteration with input LR is defined by:
L′=R and R′=L(+)f(R, K) [1]
where (+) in equation [1] denotes bit-by-bit addition modulo 2, i.e., an exclusive-or (XOR) function. The next DES iteration uses as input the output from the previous iteration. For the first DES iteration 181, the input block is the left data block Li-4 120 and the right data block Ri-4 115. After the first DES iteration, the output block is:
Li-3=Ri-4 and Ri-3=Li-4(+)f(Ri-4,Ki-4) [2]
While the first 15 iterations have as their output L′R′, the standard specifies that the output of the 16th iteration is R′L′ (also called the pre-output block), which is input into an inverse permutation to generate an encrypted output L′R′. At each iteration, a different block K of key bits, called a sub key, is chosen from the 64-bit key. For details on choosing a sub key block in each DES iteration [1] please refer to FIPS publication 46-2.
The first DES iteration 181 includes a cipher function f(R, K) that comprises expanding Ri-4 115 from 32 bits to 48 bits using expanding function Ei-4 121. Thus, expanding function Ei-4 121 takes a block of 32 Ri-4 bits as input and generates a block of 48 bits as output. The 48-bit expanded Ri-4 output and a first arrangement of 48 sub key bits Ki-4 125 are exclusive-or'd using an exclusive-or function called the first key exclusive-or function 130. The 48 bit output from the first key XOR function 130 is input into a selection function Si-4 135 to obtain a 32 bit selection function output. Selection function Si-4 135 comprises 8 unique selection sub-functions, each of which take 6 bits of the 48 bit output from the first key exclusive-or function 130 as input and yields a 4-bit output. The 32-bit selection function Si-4 135 output is input into a permutation function Pi-4 140 to yield a 32-bit permuted result. A second exclusive-or function, called the first L component XOR function 145, exclusive-ors the 32-bit permuted result with the 32 bit left data block Li-4 120 to yield a right output block Ri-4 155 of the first DES iteration 181. The left output block, Li-3 150 of the first DES iteration comprises the 32-bits of the right data block Ri-4 115. This completes the first DES iteration 181.
The left output block, Li-3 150 and the right output block Ri-3 155 of the first DES iteration 181 serve as input into the second DES iteration 182 to obtain outputs Li-2 161 and Ri-2 162 respectively as described above. Thus, Ri-3 155 is input into expanding function Ei-3 154, and the output from expanding function Ei-3 154 is exclusive-ord with a second key block Ki-3 157 using a second key XOR function 156. The output from the second key XOR function 156 is input into selection function Si-3 158, and the output from selection function Si-3 158 is input into permutation function Pi-3 159 to yield a 32 bit permuted result. The output from permutation function Pi-3 159 is exclusive-ord with Li-3 150 using a second L component XOR function 160 to form output Ri-2 162. The left output block, Li-2 161 of the second DES iteration 182 comprises the 32-bits of the right data block Ri-3 155.
Subsequent DES iterations are repeated multiple times (e.g., at least 16 times) using the output from the previous iteration, with different key blocks. After the multiple iterations, a left and a right pre-output block is obtained. The pre-output blocks are input into IP−1 (not shown) to obtain an encrypted output.
As illustrated in
Examples of the present invention are illustrated in the accompanying drawings. The accompanying drawings, however, do not limit the scope of the present invention. Similar references in the drawings indicate similar elements.
Described is a method and apparatus for implementing the DES algorithm. In the following description numerous specific details are set forth in order to provide a thorough understanding of the present invention. It will be apparent, however, to one of ordinary skill in the art that the present invention may be practiced without these specific details. In other instances, well-known architectures, steps, and techniques have not been shown to avoid obscuring the present invention.
In addition, it should be understood that the embodiments described herein are not related or limited to any particular hardware technology. Rather, the embodiments described may be constructed using various technologies (e.g., bi-polar technology, complimentary-metal-oxide-semiconductors (cmos) technology, etc.) in accordance with the teachings described herein. Similarly, it may prove advantageous to construct a specialized apparatus to perform the teachings described herein by way of discrete components, or by way of an integrated circuit that uses one or more integrated circuit die that may be interconnected. Lastly, repeated usage of the phrase “in one embodiment” does not necessarily refer to the same embodiment, although it may.
The embodiment of
For each DES cycle, 200, if the 64 bits of an input block is split into a left 32-bit block Li-4 followed by a right 32-bit block Ri-4, then, the permuted input block is Li-4Ri-4.
Let K represent four blocks of 48 bits chosen from the 64-bit key. Then the output LiRi of a single DES cycle 200 with input Li-4Ri-4 is defined by:
Li=Li-4(+)Pi-4(+)Pi-2, and Ri=Ri-4(+)Pi-3(+)Pi-1 [3]
where Pi-4=g(Ri-4,Ki-4) [4]
Pi-3=g(Li-3,Ri-4,Ki-3) [5]
Pi-2=g(Ri-4,Ki-2) [6]
Pi-1=g(Li-4,Ri-4,Ki-1) [7]
For each of the DES iterations in
After expanding the left data block Li-4 220 using expanding function Ei-3 221 and the right data block Ri-4 215 using expanding function Ei-4 222 respectively, the output from expanding function Ei-4 222 is exclusive-ord, using a key XOR function 230, with a first sub-key block Ki-4 225. The output from key XOR function 230 is input into a selection function Si-4 235, and a first output from Si-4 235 is input into a permutation function Pi-4 240.
Details of the permutation function may be found in FIPS publication 46-2. An alternate embodiment of the permutation function P is shown in Table 1.
Table 1 illustrates that permutation function P re-arranges the input to the permutation function P to yield the 32-bit output. For example, bits 16, 25 and 12 at the input of the permutation function yield bits 31, 30 and 29 at the output of the permutation function, and so on. Thus, the output of selection function Si-4 235 is re-arranged by permutation function Pi-4 240. Hence, Pi-4=g(Ri-4,Ki-4) as illustrated in [4].
In addition, a second output from selection function Si-4 235 is input into a merged permutation and expansion (MPE) function MP′i-4E′i-3 245. The MPE function is illustrated in Table 2. (Note: the data in Table 1 and Table 2 is represented in msb:1sb bit format and not in the big endian format).
As illustrated in Table 2, the input to the MPE function is rearranged and expanded to form a 48-bit block of data from a 32-bit data block. For example, bits 7, 16, and 25 at the input of the MPE function, at 245, form bits 47, 46, and 45 at the output of the MEP function.
The MPE function MP′i-4E′i-3 245 combines functions Pi-4 140 and Ei-4 154 of
The MPE function MP′i-3E′i-2 270 combines functions Pi-3 159 and Ei-2 163 of
The MPE function MP′i-2E′i-1 286 combines functions Pi-2 169 and Ei-1 173 of
The 32 bit output from permutation function Pi-1 297, the 32 bit output from permutation function Pi-3 265, and the 32 bit right data block Ri-4 215 are input into a first collected L component XOR function 298 to obtain an intermediate ciphered right data word Ri 299. Specifically, the exclusive-oring of Ri-4 215 (acting as Li-3) with the output of Pi-3 159 generates Ri-2, which is the equivalent of Li-1; the exclusive-oring of this Li-1 with the output of Pi-1 297 produces Ri 299. So also, the 32 bit output from permutation function Pi-4 240, the 32 bit output from permutation function Pi-2 284, and the 32 bit left data block Li-4 220 are input into an XOR function, called the second collected L component XOR function 292 to obtain an intermediate ciphered left data word Li 294. (Specifically, the exclusive-oring of Li-4 with the output of Pi-4 240 generates Ri-3, which is the equivalent of Li-2; the exclusive-oring of this Li-2 with the output of Pi-2 284 produces Li 294).
In one embodiment, the output from Li 294 and Ri 299 is fed back as an input to Li-4 220 and Ri-4 215. This feed back of data is repeated multiple times (e.g., 4 times to complete 16 DES iterations), with different sub key blocks. In one embodiment, after the fourth clock cycle (i.e., after the 16th DES iteration), the outputs from Li 294 and Ri 299 obtained are the pre-output blocks. These pre-output blocks are input into IP−1 (not shown) to obtain a DES encrypted output.
Li 294 and Ri 299 (i.e., the output after 4 DES iterations) in
In one embodiment, Li 294 is calculated concurrently with the input of data into MPE function MP′i-2E′i-4 286, achieving a further increase in efficiency.
In the embodiment illustrated in
While in one embodiment the functions shown in
In one embodiment, the circuit performing the functions shown in
In general, the computer systems illustrated by
Computer system 300 includes mass storage device 307, input devices 306 and display device 305 coupled to processing unit 302 via bus 301. Mass storage device 307 represents a persistent data storage device, such as a floppy disk drive, fixed disk drive (e.g., magnetic, optical, magneto-optical, or the like), or streaming tape drive. Mass storage device stores program data 330, application programs 328, and operating system 326. Application programs 328 may include agent software 322. Processing unit 302 may be any of a wide variety of general purpose processors or microprocessors (such as the Pentium® processor manufactured by Intel® Corporation), a special purpose processor, or even a specifically programmed logic device.
In one embodiment, the processing unit 302 communicates with co-processor 309 and sends co-processor 309 one or more commands to compute an encryption/decryption of a data block. Co-processor 309 encrypts and/or decrypts the data block in accordance with the flow diagram illustrated in
Display device 305 provides graphical output for computer system 300. Input devices 306 such as a keyboard or mouse are coupled to bus 301 for communicating information and command selections to processor 302. Also coupled to processor 302 through bus 301 are one or more network devices 308 that can be used to control and transfer data to electronic devices (printers, other computers, etc.) connected to computer 300. Network device 308 connects computer system 300 to a network 314, and may include Ethernet devices, phone jacks and satellite links. This network 314 can connect computer 300 to another computer 312.
Thus, a method and apparatus have been disclosed for implementing the DES algorithm. While there has been illustrated and described what are presently considered to be example embodiments of the present invention, it will be understood by those skilled in the art that various other modifications may be made, and equivalents may be substituted, without departing from the true scope of the invention. Additionally, many modifications may be made to adapt a particular situation to the teachings of the present invention without departing from the central inventive concept described herein. Therefore, it is intended that the present invention not be limited to the particular embodiments disclosed, but that the invention include all embodiments falling within the scope of the appended claims.
| Number | Name | Date | Kind |
|---|---|---|---|
| 3958081 | Ehrsam et al. | May 1976 | A |
| 3962539 | Ehrsam et al. | Jun 1976 | A |
| 4319079 | Best | Mar 1982 | A |
| 4543646 | Ambrosius et al. | Sep 1985 | A |
| 4947428 | Guillou et al. | Aug 1990 | A |
| 5289542 | Kessler | Feb 1994 | A |
| 5351299 | Matsuzaki et al. | Sep 1994 | A |
| 5442705 | Miyano | Aug 1995 | A |
| 5513262 | van Rumpt et al. | Apr 1996 | A |
| 5539827 | Liu | Jul 1996 | A |
| 5592553 | Guski et al. | Jan 1997 | A |
| 5661807 | Guski et al. | Aug 1997 | A |
| 5675653 | Nelson, Jr. | Oct 1997 | A |
| 5796837 | Kim et al. | Aug 1998 | A |
| 5835599 | Buer | Nov 1998 | A |
| 5949884 | Adams et al. | Sep 1999 | A |
| 6006321 | Abbott | Dec 1999 | A |
| 6108421 | Kurdziel et al. | Aug 2000 | A |
| 6121791 | Abbott | Sep 2000 | A |
| 6150836 | Abbott | Nov 2000 | A |
| 6272221 | Tsunoo | Aug 2001 | B1 |
| 6278783 | Kocher et al. | Aug 2001 | B1 |
| 6298136 | Den Boer | Oct 2001 | B1 |
| 6304658 | Kocher et al. | Oct 2001 | B1 |
| 6351142 | Abbott | Feb 2002 | B1 |
| 6357009 | Giles et al. | Mar 2002 | B1 |
| 6381699 | Kocher et al. | Apr 2002 | B1 |
| 6400824 | Mansoorian et al. | Jun 2002 | B1 |
| 6438569 | Abbott | Aug 2002 | B1 |
| 6442525 | Silverbrook et al. | Aug 2002 | B1 |
| 6466669 | Matsui et al. | Oct 2002 | B1 |
| 6542607 | Euchner et al. | Apr 2003 | B1 |
| 6578150 | Luyster | Jun 2003 | B1 |
| 6704871 | Kaplan et al. | Mar 2004 | B1 |
| 6708273 | Ober et al. | Mar 2004 | B1 |
| 6751319 | Luyster | Jun 2004 | B1 |
| 6816968 | Walmsley | Nov 2004 | B1 |
| 6914984 | Lim | Jul 2005 | B1 |
| 20020003876 | Lim | Jan 2002 | A1 |
| 20020009196 | Lim | Jan 2002 | A1 |
| 20020012430 | Lim | Jan 2002 | A1 |
| 20020018562 | Lim | Feb 2002 | A1 |
| 20020021802 | Muratani et al. | Feb 2002 | A1 |
| 20020106078 | Qi et al. | Aug 2002 | A1 |
| 20020106080 | Qi et al. | Aug 2002 | A1 |
| 20030002664 | Anand | Jan 2003 | A1 |
| 20030023950 | Ma et al. | Jan 2003 | A1 |