├── .github ├── FUNDING.yml └── workflows │ └── cmake-single-platform.yml ├── .gitignore ├── CMakeLists.txt ├── LICENSE ├── README.md ├── docs ├── 4-DES.pdf ├── DES-f-function.png ├── DES-ip.svg ├── DES-key-schedule.png ├── DES-main-network.png ├── Data_Encription_Standard_Flow_Diagram.svg ├── Riv85.txt ├── The DES Algorithm Illustrated.html └── fips46-3.pdf ├── include └── cppdes │ ├── des.h │ ├── des3.h │ ├── des3cbc.h │ └── descbc.h ├── lib ├── des.cpp ├── des3.cpp ├── des3cbc.cpp ├── des_key.h ├── des_lookup.h └── descbc.cpp ├── src ├── fileencryption.cpp ├── fileencryption.h └── main.cpp └── test └── main.cpp /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: [fffaraz] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry 12 | polar: # Replace with a single Polar username 13 | buy_me_a_coffee: # Replace with a single Buy Me a Coffee username 14 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 15 | -------------------------------------------------------------------------------- /.github/workflows/cmake-single-platform.yml: -------------------------------------------------------------------------------- 1 | # This starter workflow is for a CMake project running on a single platform. There is a different starter workflow if you need cross-platform coverage. 2 | # See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-multi-platform.yml 3 | name: CMake on a single platform 4 | 5 | on: 6 | push: 7 | branches: [ "master" ] 8 | pull_request: 9 | branches: [ "master" ] 10 | 11 | env: 12 | # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) 13 | BUILD_TYPE: Release 14 | 15 | jobs: 16 | build: 17 | # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. 18 | # You can convert this to a matrix build if you need cross-platform coverage. 19 | # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix 20 | runs-on: ubuntu-latest 21 | 22 | steps: 23 | - uses: actions/checkout@v4 24 | 25 | - name: Configure CMake 26 | # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. 27 | # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type 28 | run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} 29 | 30 | - name: Build 31 | # Build your program with the given configuration 32 | run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} 33 | 34 | - name: Test 35 | working-directory: ${{github.workspace}}/build 36 | # Execute tests defined by the CMake configuration. 37 | # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail 38 | run: ctest -C ${{env.BUILD_TYPE}} 39 | 40 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | .vscode/ 3 | build/ 4 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | project(cppDES) 3 | 4 | set(CMAKE_CXX_STANDARD 14) 5 | set(CMAKE_CXX_STANDARD_REQUIRED ON) 6 | 7 | add_library( 8 | libcppdes 9 | include/cppdes/des.h 10 | include/cppdes/des3.h 11 | include/cppdes/des3cbc.h 12 | include/cppdes/descbc.h 13 | lib/des_key.h 14 | lib/des_lookup.h 15 | lib/des.cpp 16 | lib/des3.cpp 17 | lib/des3cbc.cpp 18 | lib/descbc.cpp) 19 | target_include_directories(libcppdes PUBLIC include) 20 | 21 | add_executable(cppDES src/main.cpp src/fileencryption.h src/fileencryption.cpp) 22 | target_link_libraries(cppDES libcppdes) 23 | 24 | include(FetchContent) 25 | FetchContent_Declare( 26 | googletest 27 | URL https://github.com/google/googletest/archive/refs/tags/v1.14.0.tar.gz) 28 | FetchContent_MakeAvailable(googletest) 29 | 30 | enable_testing() 31 | 32 | add_executable(cppDESTest test/main.cpp) 33 | target_link_libraries(cppDESTest libcppdes GTest::gtest_main) 34 | 35 | include(GoogleTest) 36 | gtest_discover_tests(cppDESTest) 37 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Faraz Fallahi 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | cppDES 2 | ====== 3 | 4 | C++ implementation of Data Encryption Standard 5 | 6 | DES, Triple DES (3DES), DES ECB Mode, DES CBC Mode 7 | 8 | The Data Encryption Standard (DES) has been a standard encryption method in the United States for a number of years. It is moderately secure. No easy ways have been found to crack it, although a brute-force approach, using expensive special-purpose equipment, is probably feasible. 9 | 10 | When is compiled as a standalone application, it produces a command-line application that encrypts or decrypts a file using a hexadecimal key taken from the second command-line argument. 11 | 12 | Usage: `cppDES -e/-d key1 key2 key3 [input-file] [output-file]` 13 | 14 | * [benvanik/xenia](https://github.com/benvanik/xenia/tree/master/third_party/crypto/des) - Xbox 360 Emulator Research Project 15 | -------------------------------------------------------------------------------- /docs/4-DES.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fffaraz/cppDES/a9f58e3f97825d44ac0d6a999ce4b6495369d0b6/docs/4-DES.pdf -------------------------------------------------------------------------------- /docs/DES-f-function.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fffaraz/cppDES/a9f58e3f97825d44ac0d6a999ce4b6495369d0b6/docs/DES-f-function.png -------------------------------------------------------------------------------- /docs/DES-ip.svg: -------------------------------------------------------------------------------- 1 | 2 | 5 | ]> 6 | 8 | 9 | 1424 | -------------------------------------------------------------------------------- /docs/DES-key-schedule.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fffaraz/cppDES/a9f58e3f97825d44ac0d6a999ce4b6495369d0b6/docs/DES-key-schedule.png -------------------------------------------------------------------------------- /docs/DES-main-network.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fffaraz/cppDES/a9f58e3f97825d44ac0d6a999ce4b6495369d0b6/docs/DES-main-network.png -------------------------------------------------------------------------------- /docs/Data_Encription_Standard_Flow_Diagram.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 70 | -------------------------------------------------------------------------------- /docs/Riv85.txt: -------------------------------------------------------------------------------- 1 | TESTING IMPLEMENTATIONS OF DES 2 | ------------------------------ 3 | 4 | Ronald L. Rivest 5 | MIT Laboratory for Computer Science 6 | Cambridge, Mass. 02139 7 | 2/23/85 8 | 9 | 10 | ABSTRACT 11 | -------- 12 | 13 | We present a simple way to test the correctness of a DES implementation: 14 | Use the recurrence relation: 15 | 16 | X0 = 9474B8E8C73BCA7D (hexadecimal) 17 | 18 | X(i+1) = IF (i is even) THEN E(Xi,Xi) ELSE D(Xi,Xi) 19 | 20 | to compute a sequence of 64-bit values: X0, X1, X2, ..., X16. Here 21 | E(X,K) denotes the DES encryption of X using key K, and D(X,K) denotes 22 | the DES decryption of X using key K. If you obtain 23 | 24 | X16 = 1B1A2DDB4C642438 25 | 26 | your implementation does not have any of the 36,568 possible single-fault 27 | errors described herein. 28 | 29 | 30 | INTRODUCTION 31 | ------------ 32 | 33 | The Data Encryption Standard (DES) has been approved by a variety of 34 | organizations (e.g. the U.S. government) for use in cryptographic applications. 35 | The DES algorithm was published by the National Bureau of Standards [FIPS46]. 36 | 37 | The National Bureau of Standards has an ongoing program to validate the 38 | correctness of hardware DES implementations. Their testing procedure, 39 | described in [Ga80a], consists of 291 fixed test cases followed by twelve 40 | million randomly chosen test cases. A hardware implementation of DES that 41 | passes this test is awarded a "Validation Certficate". 42 | 43 | The above testing procedure provides good evidence that the DES hardware was 44 | correctly designed and functioning properly at the time of validation. 45 | However, the user of a DES implementation would like to maintain the currency 46 | of this validation -- this would be "maintenance testing" in contrast 47 | to the "validation" service provided by NBS. The purpose of maintenance 48 | testing is to ensure that the DES implementation is still correct, i.e. 49 | that no operational fault has appeared since the last time the the device 50 | was tested. Also note that NBS's validation procedure only inspects single 51 | instances of a hardware device; the user of a DES device wants to ensure that 52 | his device is correctly functioning (even though the design is OK, the device 53 | may have developed faults). 54 | 55 | One way to perform maintenance testing is to use two or more separate 56 | implementations and compare their results after each operation. If they 57 | ever differ, then one of the units has ceased to operate correctly. The 58 | difficulty with this approach is the cost of providing the redundant 59 | implementation. 60 | 61 | If a redundant implementation is infeasible, then the implementation may 62 | be testing by comparing its input-output behaviour with that of a correct 63 | implementation. This paper provides such a procedure. 64 | 65 | It is desired to have a relatively short test procedure, since the 66 | maintenance testing may be taking place in parallel with ordinary operations, 67 | and the cost of the test procedure may affect the unit's overall 68 | efficiency. The test specified in this paper only requires 16 DES operations. 69 | 70 | It is desirable to have an effective test procedure, in the 71 | sense that implementation errors are very likely to be caught. The test 72 | specified here will catch any of the 36,568 single-fault implementation 73 | errors specified later on. 74 | 75 | We next specify the DES implementation and error model, and then describe 76 | the experimental results that yielded the proposed maintenance test. 77 | 78 | 79 | DES IMPLEMENTATION 80 | ------------------ 81 | 82 | Our DES implementation follows the specifications for DES: 83 | 84 | DES(X,K,E) 85 | -- X is a 64-bit input value 86 | -- K is a 64-bit key 87 | -- E is TRUE if we are encrypting, else FALSE 88 | (1) Apply permutation IP to X, resulting in value LR (64 bits). 89 | (2) Apply selector PC1 to K, resulting in value CD (56 bits). 90 | (3) For ROUND = 1, 2, ..., 16: 91 | (3a) if E is TRUE then 92 | if SHIFTS[ROUND] = 1 93 | then apply permutation LSH1 to CD (in place). 94 | else apply permutation LSH2 to CD (in place). 95 | (3b) Apply selector PC2 to CD resulting in value KI (48 bits) 96 | (3c) If E is FALSE then 97 | if SHIFTS[17-ROUND] = 1 98 | then apply permutation RSH1 to CD (in place). 99 | else apply permutation RSH2 to CD (in place). 100 | (3d) Apply selector E to LR, resulting in value RE (48 bits). 101 | (3e) XOR RE with KI, resulting in value RX (48 bits). 102 | (3f) Break RX into 8 6-bit blocks, and replace the i-th block 103 | Yi with the result of looking up Yi in S-box i. 104 | Concatenate these 4-bit results together to get the 32-bit 105 | value SOUT. 106 | (3g) Apply permutation P to SOUT resulting in value FOUT (32 107 | bits). 108 | (3h) Replace the left half of LR with the XOR of FOUT and the 109 | left half of LR. 110 | (3i) If ROUND is not 16, apply permutation SWAP to LR (in 111 | place). 112 | (4) Apply permutation IPINV to LR resulting in value OUT (64 bits). 113 | Return OUT as the result of this DES operation. 114 | 115 | 116 | This implementation makes uses of the following tables and functions (for 117 | the details of these tables see [FIPS46]): 118 | 119 | (1) Permutations and selectors: IP, PC1, PC2, LSH1, LSH2, RSH1, RSH2, 120 | E, P, SWAP, IPINV. 121 | Each permutation or selector Q has a length LENGTH(Q) and a range 122 | 1...RANGE(Q). For permutations LENGTH(Q)=RANGE(Q). As an example, 123 | the selector PC2 = [14, 17, ..., 32] has length 48 and range 56, 124 | while permutation SWAP = [33, 34, ..., 32] has length 64 and range 125 | 64. 126 | 127 | (2) The table SHIFTS = [1, 1, 2, ..., 1] of length 16 specifying the 128 | number of left shifts of the key registers to perform during 129 | each round. 130 | 131 | (3) The XOR (exclusive-OR) functions used in steps (3e) and (3h), on 132 | input vectors of lengths 48 and 32, respectively. 133 | 134 | (4) The S-box tables used in step (3f). 135 | 136 | 137 | 138 | ERROR MODEL 139 | ----------- 140 | 141 | We now describe our model of implementation errors. We consider the following 142 | set of single-fault errors: 143 | 144 | (1) "Wiring errors": For each permutation or selector Q, we consider 145 | the possibility that each of the output elements might 146 | -- be stuck at 0 147 | -- be stuck at 1 148 | -- incorrectly specify some other value in 1...RANGE(Q). 149 | There are thus LENGTH(Q)*(RANGE(Q)+1) possible errors for Q. 150 | 151 | Permutation Number 152 | or of Possible 153 | Selector LENGTH RANGE Errors 154 | ------------ ------- ------ ----------- 155 | IP 64 64 4160 156 | PC1 56 64 3640 157 | PC2 48 56 2736 158 | LSH1 56 56 3192 159 | LSH2 56 56 3192 160 | RSH1 56 56 3192 161 | RHS2 56 56 3192 162 | E 48 32 1584 163 | P 32 32 1056 164 | SWAP 64 64 4160 165 | IPINV 64 64 4160 166 | ----------------------------------------------------------- 167 | Total Number of Possible Wiring Errors........34,264 168 | 169 | (2) Shift Errors: For each of the 16 positions of the SHIFTS table, 170 | one error possibility is that the table entry could be incorrectly 171 | specified (i.e. specify a shift of 1 when a shift of two was 172 | desired, or vice versa). 173 | 174 | Total Number of Possible Shifting Errors..........16 175 | 176 | (3) XOR errors: For each XOR gate (there are 48 used in step (3e) 177 | and 32 used in step (3h)) the following errors are possible: 178 | -- stuck at 0 179 | -- stuck at 1 180 | -- producing the negation of the desired result. 181 | 182 | Total Number of Possible XOR Errors..............240 183 | 184 | (4) SBOX errors: For each of the 8 * 64 * 4 = 2048 bits of the S-box 185 | tables, we consider the possibility that it might be incorrectly 186 | stored (i.e. a 0 is stored instead of a 1, or vice versa). 187 | 188 | Total Number of Possible SBOX Errors............2048 189 | 190 | ------------------------------------------------------------------- 191 | Total Number of Error Possibilities Considered........36,568 192 | 193 | We note that since our implementation is iterative, an error possibility 194 | that can affect one round of encryption can affect every round. 195 | 196 | 197 | DESIGN OF VALIDATION TEST 198 | ------------------------- 199 | 200 | A simple iterative test was desired, so that the only storage 201 | requirements were the desired starting value, the desired ending value, and 202 | the number of DES iterations to perform. Alternation of encryption and 203 | decryption was chosen in order to exercise both modes equally. The initial 204 | value, X0 = 9474B8E8C73BCA7D (hexadecimal) was chosen with a short search, 205 | in order to find a sequence that tested the S-box entries efficiently. 206 | To generate a pseudo-random sequence of test values, the output of 207 | one stage is used as both the key and data inputs for the next stage. 208 | That is, the pseudo-random sequence is defined by: 209 | 210 | X0 = 9474B8E8C73BCA7D 211 | 212 | X(i+1) = E(Xi,Xi) if i is even 213 | X(i+1) = D(Xi,Xi) if i is odd 214 | 215 | where E(X,K) denotes the encryption of the 64-bit value X with 64-bit key 216 | K, and D(X,K) denotes the corresponding decryption. Note that the key is 217 | a 64-bit value as specified in [FIPS46]; the 8 "parity" bits are discarded by 218 | selector PC1. 219 | 220 | DES was implemented in software on an IBM PC. The correctness of this 221 | implementation was checked using the 291 fixed tests given in [Ga77]. 222 | The various error possibilities were implemented, and an experiment was 223 | run to determine the least i such that comparing Xi to its expected value 224 | detected all the proposed single-fault errors. Note that only one comparison 225 | is needed; it is not necessary to compare the intermediate results with their 226 | expected values. The following table was obtained: 227 | 228 | i Xi Number of errors NOT detected 229 | -- ---------------- ----------------------------- 230 | 0 9474B8E8C73BCA7D 36,568 231 | 1 8DA744E0C94E5E17 14,170 232 | 2 0CDB25E3BA3C6D79 4,842 233 | 3 4784C4BA5006081F 2,866 234 | 4 1CF1FC126F2EF842 1,550 235 | 5 E4BE250042098D13 996 236 | 6 7BFC5DC6ADB5797C 652 237 | 7 1AB3B4D82082FB28 458 238 | 8 C1576A14DE707097 274 239 | 9 739B68CD2E26782A 180 240 | 10 2A59F0C464506EDB 126 241 | 11 A5C39D4251F0A81E 94 242 | 12 7239AC9A6107DDB1 72 243 | 13 070CAC8590241233 52 244 | 14 78F87B6E3DFECF61 20 245 | 15 95EC2578C2C433F0 4 246 | 16 1B1A2DDB4C642438 0 247 | 248 | We conclude that at most 16 DES operations suffice to test the correctness 249 | of a DES implementation, under our error model. 250 | 251 | We note that the number of rounds required was determined by the S-box tests. 252 | The other error types were all detected within at most 11 iterations. 253 | The number of DES operations required here is 3 less than in the set of S-box 254 | tests published by NBS[Ga77]; a short search discovered the given starting 255 | value. We leave it as an open problem to devise a test which uses 256 | substantially fewer DES operations. 257 | 258 | We note that the above test may not catch multiple faults, or faults other than 259 | those described in this paper. 260 | 261 | 262 | ACKNOWLEDGEMENTS 263 | ---------------- 264 | 265 | This work was supported by RSA Data Security, Inc. 266 | 267 | 268 | REFERENCES 269 | ---------- 270 | 271 | [FIPS46] "Specifications for the Data Encryption Standard." Federal 272 | Information Processing Standards Publication 46 (January 15, 1977). 273 | 274 | [Ga80a] Gait, Jason. "Validating the Correctness of Hardware Implementations 275 | of the NBS Data Encryption Standard". NBS Special Publication 500-20. 276 | (Rev. September 1980). 277 | 278 | [Ga80b] Gait, Jason. "Maintenance Testing for the Data Encryption Standard." 279 | NBS Special Publication 500-61. (August 1980). 280 | 281 | -------------------------------------------------------------------------------- /docs/The DES Algorithm Illustrated.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 |
11 | 12 | The DES (Data Encryption Standard) algorithm is the 13 | most widely used encryption algorithm in the world. For 14 | many years, and among many people, "secret code making" and 15 | DES have been synonymous. And despite the recent coup by 16 | the Electronic Frontier Foundation in creating a $220,000 17 | machine to crack DES-encrypted messages, DES will live on in 18 | government and banking for years to come through a life- 19 | extending version called "triple-DES." 20 | 21 | How does DES work? This article explains the various 22 | steps involved in DES-encryption, illustrating each step by 23 | means of a simple example. Since the creation of DES, many 24 | other algorithms (recipes for changing data) have emerged 25 | which are based on design principles similar to DES. Once 26 | you understand the basic transformations that take place in 27 | DES, you will find it easy to follow the steps involved in 28 | these more recent algorithms. 29 | 30 | But first a bit of history of how DES came about is 31 | appropriate, as well as a look toward the future. 32 | 33 | The National Bureau of Standards Coaxes the Genie from the Bottle34 |35 | On May 15, 1973, during the reign of Richard Nixon, the 36 | National Bureau of Standards (NBS) published a notice in the 37 | Federal Register soliciting proposals for cryptographic 38 | algorithms to protect data during transmission and storage. 39 | The notice explained why encryption was an important issue. 40 | 41 |94 | 95 | NBS waited for the responses to come in. It received 96 | none until August 6, 1974, three days before Nixon's 97 | resignation, when IBM submitted a candidate that it had 98 | developed internally under the name LUCIFER. After 99 | evaluating the algorithm with the help of the National 100 | Security Agency (NSA), the NBS adopted a modification of the 101 | LUCIFER algorithm as the new Data Encryption Standard (DES) 102 | on July 15, 1977. 103 | 104 | DES was quickly adopted for non-digital media, such as 105 | voice-grade public telephone lines. Within a couple of 106 | years, for example, International Flavors and Fragrances was 107 | using DES to protect its valuable formulas transmitted over 108 | the phone ("With Data Encryption, Scents Are Safe at IFF," 109 | Computerworld 14, No. 21, 95 (1980).) 110 | 111 | Meanwhile, the banking industry, which is the largest 112 | user of encryption outside government, adopted DES as a 113 | wholesale banking standard. Standards for the wholesale 114 | banking industry are set by the American National Standards 115 | Institute (ANSI). ANSI X3.92, adopted in 1980, specified 116 | the use of the DES algorithm. 117 | 118 | Some Preliminary Examples of DES119 |120 | DES works on bits, or binary numbers--the 0s and 1s 121 | common to digital computers. Each group of four bits makes 122 | up a hexadecimal, or base 16, number. Binary "0001" is 123 | equal to the hexadecimal number "1", binary "1000" is equal 124 | to the hexadecimal number "8", "1001" is equal to the 125 | hexadecimal number "9", "1010" is equal to the hexadecimal 126 | number "A", and "1111" is equal to the hexadecimal number 127 | "F". 128 | 129 | DES works by encrypting groups of 64 message bits, 130 | which is the same as 16 hexadecimal numbers. To do the 131 | encryption, DES uses "keys" where are also apparently 16 132 | hexadecimal numbers long, or apparently 64 bits long. 133 | However, every 8th key bit is ignored in the DES algorithm, 134 | so that the effective key size is 56 bits. But, in any 135 | case, 64 bits (16 hexadecimal digits) is the round number 136 | upon which DES is organized. 137 | 138 | For example, if we take the plaintext message 139 | "8787878787878787", and encrypt it with the DES key 140 | "0E329232EA6D0D73", we end up with the ciphertext 141 | "0000000000000000". If the ciphertext is decrypted with the 142 | same secret DES key "0E329232EA6D0D73", the result is the 143 | original plaintext "8787878787878787". 144 | 145 | This example is neat and orderly because our plaintext 146 | was exactly 64 bits long. The same would be true if the 147 | plaintext happened to be a multiple of 64 bits. But most 148 | messages will not fall into this category. They will not be 149 | an exact multiple of 64 bits (that is, an exact multiple of 150 | 16 hexadecimal numbers). 151 | 152 | For example, take the message "Your lips are smoother 153 | than vaseline". This plaintext message is 38 bytes (76 154 | hexadecimal digits) long. So this message must be padded 155 | with some extra bytes at the tail end for the encryption. 156 | Once the encrypted message has been decrypted, these extra 157 | bytes are thrown away. There are, of course, different 158 | padding schemes--different ways to add extra bytes. Here we 159 | will just add 0s at the end, so that the total message is a 160 | multiple of 8 bytes (or 16 hexadecimal digits, or 64 bits). 161 | 162 | The plaintext message "Your lips are smoother than 163 | vaseline" is, in hexadecimal, 164 | 165 | "596F7572206C6970 732061726520736D 6F6F746865722074 68616E2076617365 6C696E650D0A". 166 | 167 | (Note here that the first 72 hexadecimal digits represent 168 | the English message, while "0D" is hexadecimal for Carriage 169 | Return, and "0A" is hexadecimal for Line Feed, showing that 170 | the message file has terminated.) We then pad this message 171 | with some 0s on the end, to get a total of 80 hexadecimal 172 | digits: 173 | 174 | "596F7572206C6970 732061726520736D 6F6F746865722074 68616E2076617365 6C696E650D0A0000". 175 | 176 | If we then encrypt this plaintext message 64 bits (16 177 | hexadecimal digits) at a time, using the same DES key 178 | "0E329232EA6D0D73" as before, we get the ciphertext: 179 | 180 | "C0999FDDE378D7ED 727DA00BCA5A84EE 47F269A4D6438190 9DD52F78F5358499 828AC9B453E0E653". 181 | 182 | This is the secret code that can be transmitted or stored. 183 | Decrypting the ciphertext restores the original message 184 | "Your lips are smoother than vaseline". (Think how much 185 | better off Bill Clinton would be today, if Monica Lewinsky 186 | had used encryption on her Pentagon computer!) 187 | 188 | How DES Works in Detail189 |190 | DES is a block cipher--meaning it operates on plaintext 191 | blocks of a given size (64-bits) and returns ciphertext 192 | blocks of the same size. Thus DES results in a permutation 193 | among the 2^64 (read this as: "2 to the 64th power") possible arrangements of 64 bits, each of 194 | which may be either 0 or 1. Each block of 64 bits is divided 195 | into two blocks of 32 bits each, a left half block L and a 196 | right half R. (This division is only used in certain 197 | operations.) 198 | 199 | Example: Let M be the plain text message M = 200 | 0123456789ABCDEF, where M is in hexadecimal (base 16) 201 | format. Rewriting M in binary format, we get the 64-bit 202 | block of text: 203 |
204 | M = 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 208 | The first bit of M is "0". The last bit is "1". We read 209 | from left to right. 210 | 211 | DES operates on the 64-bit blocks using key sizes of 56- 212 | bits. The keys are actually stored as being 64 bits long, 213 | but every 8th bit in the key is not used (i.e. bits numbered 214 | 8, 16, 24, 32, 40, 48, 56, and 64). However, we will 215 | nevertheless number the bits from 1 to 64, going left to 216 | right, in the following calculations. But, as you will see, 217 | the eight bits just mentioned get eliminated when we create 218 | subkeys. 219 | 220 | Example: Let K be the hexadecimal key K = 221 | 133457799BBCDFF1. This gives us as the binary key (setting 222 | 1 = 0001, 3 = 0011, etc., and grouping together every eight 223 | bits, of which the last one in each group will be unused): 224 | 225 | K = 00010011 00110100 01010111 01111001 10011011 10111100 11011111 11110001 226 | 227 | The DES algorithm uses the following steps: 228 | 229 | Step 1: Create 16 subkeys, each of which is 48-bits long.230 |231 | The 64-bit key is permuted according to the following 232 | table, PC-1. Since the first entry in the table is "57", 233 | this means that the 57th bit of the original key K becomes 234 | the first bit of the permuted key K+. The 49th bit of the 235 | original key becomes the second bit of the permuted key. 236 | The 4th bit of the original key is the last bit of the 237 | permuted key. Note only 56 bits of the original key appear 238 | in the permuted key. 239 | 240 | 241 | PC-1 242 | 243 | 57 49 41 33 25 17 9 244 | 1 58 50 42 34 26 18 245 | 10 2 59 51 43 35 27 246 | 19 11 3 60 52 44 36 247 | 63 55 47 39 31 23 15 248 | 7 62 54 46 38 30 22 249 | 14 6 61 53 45 37 29 250 | 21 13 5 28 20 12 4 251 |252 | 253 | Example: From the original 64-bit key 254 | 255 | K = 00010011 00110100 01010111 01111001 10011011 10111100 11011111 11110001 256 | 257 | we get the 56-bit permutation 258 | 259 | K+ = 1111000 0110011 0010101 0101111 0101010 1011001 1001111 0001111 260 | 261 | Next, split this key into left and right halves, C0 and 262 | D0, where each half has 28 bits. 263 | 264 | Example: From the permuted key K+, we get 265 |
266 | C0 = 1111000 0110011 0010101 0101111 269 | With C0 and D0 defined, we now create sixteen blocks Cn 270 | and Dn, 1<=n<=16. Each pair of blocks Cn and Dn is formed 271 | from the previous pair Cn-1 and Dn-1, respectively, for n = 272 | 1, 2, ..., 16, using the following schedule of "left shifts" 273 | of the previous block. To do a left shift, move each bit 274 | one place to the left, except for the first bit, which is 275 | cycled to the end of the block. 276 | 277 | 278 | Iteration Number of 279 | Number Left Shifts 280 | 281 | 1 1 282 | 2 1 283 | 3 2 284 | 4 2 285 | 5 2 286 | 6 2 287 | 7 2 288 | 8 2 289 | 9 1 290 | 10 2 291 | 11 2 292 | 12 2 293 | 13 2 294 | 14 2 295 | 15 2 296 | 16 1 297 |298 | 299 | This means, for example, C3 and D3 are obtained from C2 and 300 | D2, respectively, by two left shifts, and C16 and D16 are 301 | obtained from C15 and D15, respectively, by one left shift. 302 | In all cases, by a single left shift is meant a rotation of 303 | the bits one place to the left, so that after one left shift 304 | the bits in the 28 positions are the bits that were 305 | previously in positions 2, 3,..., 28, 1. 306 | 307 | Example: From original pair pair C0 and D0 we obtain: 308 |
309 | C0 = 1111000011001100101010101111
312 | C1 = 1110000110011001010101011111
315 | C2 = 1100001100110010101010111111
318 | C3 = 0000110011001010101011111111
321 | C4 = 0011001100101010101111111100
324 | C5 = 1100110010101010111111110000
327 | C6 = 0011001010101011111111000011
330 | C7 = 1100101010101111111100001100
333 | C8 = 0010101010111111110000110011
336 | C9 = 0101010101111111100001100110
339 | C10 = 0101010111111110000110011001
342 | C11 = 0101011111111000011001100101
345 | C12 = 0101111111100001100110010101
348 | C13 = 0111111110000110011001010101
351 | C14 = 1111111000011001100101010101
354 | C15 = 1111100001100110010101010111
357 | C16 = 1111000011001100101010101111 360 | We now form the keys Kn, for 1<=n<=16, by applying the 361 | following permutation table to each of the concatenated 362 | pairs CnDn. Each pair has 56 bits, but PC-2 only uses 48 of 363 | these. 364 | 365 | 366 | PC-2 367 | 368 | 14 17 11 24 1 5 369 | 3 28 15 6 21 10 370 | 23 19 12 4 26 8 371 | 16 7 27 20 13 2 372 | 41 52 31 37 47 55 373 | 30 40 51 45 33 48 374 | 44 49 39 56 34 53 375 | 46 42 50 36 29 32 376 |377 | 378 | Therefore, the first bit of Kn is the 14th bit of CnDn, the 379 | second bit the 17th, and so on, ending with the 48th bit of 380 | Kn being the 32th bit of CnDn. 381 | 382 | Example: For the first key we have 383 | 384 | C1D1 = 1110000 1100110 0101010 1011111 1010101 0110011 0011110 0011110 385 | 386 | which, after we apply the permutation PC-2, becomes 387 | 388 | K1 = 000110 110000 001011 101111 111111 000111 000001 110010 389 | 390 | For the other keys we have 391 |
392 | K2 = 011110 011010 111011 011001 110110 111100 100111 100101 408 | So much for the subkeys. Now we look at the message itself. 409 | 410 | Step 2: Encode each 64-bit block of data.411 |412 | There is an initial permutation IP of the 64 bits of 413 | the message data M. This rearranges the bits according to 414 | the following table, where the entries in the table show the 415 | new arrangement of the bits from their initial order. The 416 | 58th bit of M becomes the first bit of IP. The 50th bit of 417 | M becomes the second bit of IP. The 7th bit of M is the 418 | last bit of IP. 419 | 420 | 421 | IP 422 | 423 | 58 50 42 34 26 18 10 2 424 | 60 52 44 36 28 20 12 4 425 | 62 54 46 38 30 22 14 6 426 | 64 56 48 40 32 24 16 8 427 | 57 49 41 33 25 17 9 1 428 | 59 51 43 35 27 19 11 3 429 | 61 53 45 37 29 21 13 5 430 | 63 55 47 39 31 23 15 7 431 |432 | 433 | Example: Applying the initial permutation to the block 434 | of text M, given previously, we get 435 |
436 | M = 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 439 | Here the 58th bit of M is "1", which becomes the first bit 440 | of IP. The 50th bit of M is "1", which becomes the second 441 | bit of IP. The 7th bit of M is "0", which becomes the last 442 | bit of IP. 443 | 444 | Next divide the permuted block IP into a left half L0 445 | of 32 bits, and a right half R0 of 32 bits. 446 | 447 | Example: From IP, we get L0 and R0 448 |
449 | L0 = 1100 1100 0000 0000 1100 1100 1111 1111 452 | We now proceed through 16 iterations, for 1<=n<=16, using 453 | a function f which operates on two blocks--a data block of 454 | 32 bits and a key Kn of 48 bits--to produce a block of 32 455 | bits. Let + denote XOR addition, (bit-by-bit addition 456 | modulo 2). Then for n going from 1 to 16 we calculate 457 | 458 | 459 | Ln = Rn-1462 | 463 | This results in a final block, for n = 16, of L16R16. That 464 | is, in each iteration, we take the right 32 bits of the 465 | previous result and make them the left 32 bits of the 466 | current step. For the right 32 bits in the current step, we 467 | XOR the left 32 bits of the previous step with the 468 | calculation f . 469 | 470 | Example: For n = 1, we have 471 |
472 | K1 = 000110 110000 001011 101111 111111 000111 000001 110010 476 | It remains to explain how the function f works. To 477 | calculate f, we first expand each block Rn-1 from 32 bits to 478 | 48 bits. This is done by using a selection table that 479 | repeats some of the bits in Rn-1 . We'll call the use of 480 | this selection table the function E. Thus E(Rn-1) has a 32 481 | bit input block, and a 48 bit output block. 482 | 483 | Let E be such that the 48 bits of its output, written 484 | as 8 blocks of 6 bits each, are obtained by selecting the 485 | bits in its inputs in order according to the following 486 | table: 487 | 488 | 489 | E BIT-SELECTION TABLE 490 | 491 | 32 1 2 3 4 5 492 | 4 5 6 7 8 9 493 | 8 9 10 11 12 13 494 | 12 13 14 15 16 17 495 | 16 17 18 19 20 21 496 | 20 21 22 23 24 25 497 | 24 25 26 27 28 29 498 | 28 29 30 31 32 1 499 |500 | 501 | Thus the first three bits of E(Rn-1) are the bits in 502 | positions 32, 1 and 2 of Rn-1 while the last 2 bits of E(Rn-1) are the bits in positions 32 and 1. 503 | 504 | Example: We calculate E(R0) from R0 as follows: 505 |
506 | R0 = 1111 0000 1010 1010 1111 0000 1010 1010 509 | (Note that each block of 4 original bits has been 510 | expanded to a block of 6 output bits.) 511 | 512 | Next in the f calculation, we XOR the output 513 | E(Rn-1) with the key Kn: 514 | 517 | Example: For K1 , E(R0), we have 518 |
519 | K1 = 000110 110000 001011 101111 111111 000111 000001 110010 523 | We have not yet finished calculating the function f . 524 | To this point we have expanded Rn-1 from 32 bits to 48 525 | bits, using the selection table, and XORed the result with 526 | the key Kn . We now have 48 bits, or eight groups of six 527 | bits. We now do something strange with each group of six 528 | bits: we use them as addresses in tables called "S boxes". 529 | Each group of six bits will give us an address in a 530 | different S box. Located at that address will be a 4 bit 531 | number. This 4 bit number will replace the original 6 bits. 532 | The net result is that the eight groups of 6 bits are 533 | transformed into eight groups of 4 bits (the 4-bit outputs 534 | from the S boxes) for 32 bits total. 535 | 536 | Write the previous result, which is 48 bits, in 537 | the form: 538 | 541 | where each Bi is a group of six bits. We now calculate 542 | 545 | 546 | where Si(Bi) referres to the output of the i-th S 547 | box. 548 | 549 | To repeat, each of the functions S1, S2,..., S8, takes 550 | a 6-bit block as input and yields a 4-bit block as output. 551 | The table to determine S1 is shown and explained below: 552 | 553 | 554 | 555 | S1 556 | 557 | Column Number 558 | Row 559 | No. 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 560 | 561 | 0 14 4 13 1 2 15 11 8 3 10 6 12 5 9 0 7 562 | 1 0 15 7 4 14 2 13 1 10 6 12 11 9 5 3 8 563 | 2 4 1 14 8 13 6 2 11 15 12 9 7 3 10 5 0 564 | 3 15 12 8 2 4 9 1 7 5 11 3 14 10 0 6 13 565 |566 | 567 | If S1 is the function defined in this table and B is a block 568 | of 6 bits, then S1(B) is determined as follows: The first 569 | and last bits of B represent in base 2 a number in the 570 | decimal range 0 to 3 (or binary 00 to 11). Let that number 571 | be i. The middle 4 bits of B represent in base 2 a number 572 | in the decimal range 0 to 15 (binary 0000 to 1111). Let 573 | that number be j. Look up in the table the number in the i-th row and j-th column. It is a number in the range 0 to 15 574 | and is uniquely represented by a 4 bit block. That block is 575 | the output S1(B) of S1 for the input B. For example, for 576 | input block B = 011011 the first bit is "0" and the last bit 577 | "1" giving 01 as the row. This is row 1. The middle four 578 | bits are "1101". This is the binary equivalent of decimal 579 | 13, so the column is column number 13. In row 1, column 13 580 | appears 5. This determines the output; 5 is binary 0101, so 581 | that the output is 0101. Hence S1(011011) = 0101. 582 | 583 | The tables defining the functions S1,...,S8 are 584 | the following: 585 | 586 | 587 | S1 588 | 589 | 14 4 13 1 2 15 11 8 3 10 6 12 5 9 0 7 590 | 0 15 7 4 14 2 13 1 10 6 12 11 9 5 3 8 591 | 4 1 14 8 13 6 2 11 15 12 9 7 3 10 5 0 592 | 15 12 8 2 4 9 1 7 5 11 3 14 10 0 6 13 593 | 594 | S2 595 | 596 | 15 1 8 14 6 11 3 4 9 7 2 13 12 0 5 10 597 | 3 13 4 7 15 2 8 14 12 0 1 10 6 9 11 5 598 | 0 14 7 11 10 4 13 1 5 8 12 6 9 3 2 15 599 | 13 8 10 1 3 15 4 2 11 6 7 12 0 5 14 9 600 | 601 | S3 602 | 603 | 10 0 9 14 6 3 15 5 1 13 12 7 11 4 2 8 604 | 13 7 0 9 3 4 6 10 2 8 5 14 12 11 15 1 605 | 13 6 4 9 8 15 3 0 11 1 2 12 5 10 14 7 606 | 1 10 13 0 6 9 8 7 4 15 14 3 11 5 2 12 607 | 608 | S4 609 | 610 | 7 13 14 3 0 6 9 10 1 2 8 5 11 12 4 15 611 | 13 8 11 5 6 15 0 3 4 7 2 12 1 10 14 9 612 | 10 6 9 0 12 11 7 13 15 1 3 14 5 2 8 4 613 | 3 15 0 6 10 1 13 8 9 4 5 11 12 7 2 14 614 | 615 | S5 616 | 617 | 2 12 4 1 7 10 11 6 8 5 3 15 13 0 14 9 618 | 14 11 2 12 4 7 13 1 5 0 15 10 3 9 8 6 619 | 4 2 1 11 10 13 7 8 15 9 12 5 6 3 0 14 620 | 11 8 12 7 1 14 2 13 6 15 0 9 10 4 5 3 621 | 622 | S6 623 | 624 | 12 1 10 15 9 2 6 8 0 13 3 4 14 7 5 11 625 | 10 15 4 2 7 12 9 5 6 1 13 14 0 11 3 8 626 | 9 14 15 5 2 8 12 3 7 0 4 10 1 13 11 6 627 | 4 3 2 12 9 5 15 10 11 14 1 7 6 0 8 13 628 | 629 | S7 630 | 631 | 4 11 2 14 15 0 8 13 3 12 9 7 5 10 6 1 632 | 13 0 11 7 4 9 1 10 14 3 5 12 2 15 8 6 633 | 1 4 11 13 12 3 7 14 10 15 6 8 0 5 9 2 634 | 6 11 13 8 1 4 10 7 9 5 0 15 14 2 3 12 635 | 636 | S8 637 | 638 | 13 2 8 4 6 15 11 1 10 9 3 14 5 0 12 7 639 | 1 15 13 8 10 3 7 4 12 5 6 11 0 14 9 2 640 | 7 11 4 1 9 12 14 2 0 6 10 13 15 3 5 8 641 | 2 1 14 7 4 10 8 13 15 12 9 0 3 5 6 11 642 |643 | 644 | Example: For the first round, we obtain as the 645 | output of the eight S boxes: 646 | 647 | K1 + E(R0) = 011000 010001 011110 111010 100001 100110 010100 100111. 648 | 649 | S1(B1)S2(B2)S3(B3)S4(B4)S5(B5)S6(B6)S7(B7)S8(B8) 650 | = 0101 1100 1000 0010 1011 0101 1001 0111 651 | 652 | The final stage in the calculation of f is to do a 653 | permutation P of the S-box output to obtain the final value 654 | of f: 655 | 658 | The permutation P is defined in the following table. P 659 | yields a 32-bit output from a 32-bit input by permuting the 660 | bits of the input block. 661 | 662 | 663 | P 664 | 665 | 16 7 20 21 666 | 29 12 28 17 667 | 1 15 23 26 668 | 5 18 31 10 669 | 2 8 24 14 670 | 32 27 3 9 671 | 19 13 30 6 672 | 22 11 4 25 673 |674 | 675 | Example: From the output of the eight S boxes: 676 | 679 | we get 680 |
683 | R1 = L0 + f(R0 , K1 ) 685 | = 1100 1100 0000 0000 1100 1100 1111 1111689 | 690 | In the next round, we will have L2 = R1, which is the 691 | block we just calculated, and then we must calculate R2 =L1 + f(R1, K2), and so on for 16 rounds. At the end of the 692 | sixteenth round we have the blocks L16 and R16. We then 693 | reverse the order of the two blocks into the 64-bit block 694 | 697 | and apply a final permutation IP-1 as defined by 698 | the following table: 699 | 700 | 701 | IP-1 702 | 703 | 40 8 48 16 56 24 64 32 704 | 39 7 47 15 55 23 63 31 705 | 38 6 46 14 54 22 62 30 706 | 37 5 45 13 53 21 61 29 707 | 36 4 44 12 52 20 60 28 708 | 35 3 43 11 51 19 59 27 709 | 34 2 42 10 50 18 58 26 710 | 33 1 41 9 49 17 57 25 711 |712 | 713 | That is, the output of the algorithm has bit 40 of the 714 | preoutput block as its first bit, bit 8 as its second bit, 715 | and so on, until bit 25 of the preoutput block is the last 716 | bit of the output. 717 | 718 | Example: If we process all 16 blocks using the method 719 | defined previously, we get, on the 16th round, 720 |
721 | L16 = 0100 0011 0100 0010 0011 0010 0011 0100 724 | We reverse the order of these two blocks and apply 725 | the final permutation to 726 | 727 | R16L16 = 00001010 01001100 11011001 10010101 01000011 01000010 00110010 00110100 728 | 729 | IP-1 = 10000101 11101000 00010011 01010100 00001111 00001010 10110100 00000101 730 | 731 | which in hexadecimal format is 732 | 733 | 85E813540F0AB405. 734 | 735 | This is the encrypted form of M = 0123456789ABCDEF: namely, 736 | C = 85E813540F0AB405. 737 | 738 | Decryption is simply the inverse of encryption, 739 | follwing the same steps as above, but reversing the order in 740 | which the subkeys are applied. 741 | 742 | DES Modes of Operation743 |744 | The DES algorithm turns a 64-bit message block M into a 745 | 64-bit cipher block C. If each 64-bit block is encrypted 746 | individually, then the mode of encryption is called 747 | Electronic Code Book (ECB) mode. There are two other modes 748 | of DES encryption, namely Chain Block Coding (CBC) and 749 | Cipher Feedback (CFB), which make each cipher block 750 | dependent on all the previous messages blocks through an 751 | initial XOR operation. 752 | 753 | Cracking DES754 |755 | Before DES was adopted as a national standard, during 756 | the period NBS was soliciting comments on the proposed 757 | algorithm, the creators of public key cryptography, Martin 758 | Hellman and Whitfield Diffie, registered some objections to 759 | the use of DES as an encryption algorithm. Hellman wrote: 760 | "Whit Diffie and I have become concerned that the proposed 761 | data encryption standard, while probably secure against 762 | commercial assault, may be extremely vulnerable to attack by 763 | an intelligence organization" (letter to NBS, October 22, 764 | 1975). 765 | 766 | Diffie and Hellman then outlined a "brute force" attack 767 | on DES. (By "brute force" is meant that you try as many of 768 | the 2^56 possible keys as you have to before decrypting the 769 | ciphertext into a sensible plaintext message.) They 770 | proposed a special purpose "parallel computer using one 771 | million chips to try one million keys each" per second, and 772 | estimated the cost of such a machine at $20 million. 773 | 774 | Fast forward to 1998. Under the direction of John 775 | Gilmore of the EFF, a team spent $220,000 and built a 776 | machine that can go through the entire 56-bit DES key space 777 | in an average of 4.5 days. On July 17, 1998, they announced 778 | they had cracked a 56-bit key in 56 hours. The computer, 779 | called Deep Crack, uses 27 boards each containing 64 chips, 780 | and is capable of testing 90 billion keys a second. 781 | 782 | Despite this, as recently as June 8, 1998, Robert Litt, 783 | principal associate deputy attorney general at the 784 | Department of Justice, denied it was possible for the FBI to 785 | crack DES: "Let me put the technical problem in context: 786 | It took 14,000 Pentium computers working for four months to 787 | decrypt a single message . . . . We are not just talking 788 | FBI and NSA [needing massive computing power], we are 789 | talking about every police department." 790 | 791 | Responded cryptograpy expert Bruce Schneier: " . . . 792 | the FBI is either incompetent or lying, or both." Schneier 793 | went on to say: "The only solution here is to pick an 794 | algorithm with a longer key; there isn't enough silicon in 795 | the galaxy or enough time before the sun burns out to brute- 796 | force triple-DES" (Crypto-Gram, Counterpane Systems, August 797 | 15, 1998). 798 | 799 | Triple-DES800 |801 | Triple-DES is just DES with two 56-bit keys applied. 802 | Given a plaintext message, the first key is used to DES- 803 | encrypt the message. The second key is used to DES-decrypt 804 | the encrypted message. (Since the second key is not the 805 | right key, this decryption just scrambles the data further.) 806 | The twice-scrambled message is then encrypted again with the 807 | first key to yield the final ciphertext. This three-step 808 | procedure is called triple-DES. 809 | 810 | Triple-DES is just DES done three times with two keys 811 | used in a particular order. (Triple-DES can also be done 812 | with three separate keys instead of only two. In either 813 | case the resultant key space is about 2^112.) 814 | 817 | "Cryptographic Algorithms for Protection of Computer Data 818 | During Transmission and Dormant Storage," Federal Register 819 | 38, No. 93 (May 15, 1973). 820 | 821 | Data Encryption Standard, Federal Information Processing 822 | Standard (FIPS) Publication 46, National Bureau of 823 | Standards, U.S. Department of Commerce, Washington D.C. 824 | (January 1977). 825 | 826 | Carl H. Meyer and Stephen M. Matyas, Cryptography: A New 827 | Dimension in Computer Data Security, John Wiley & Sons, New 828 | York, 1982. 829 | 830 | Dorthy Elizabeth Robling Denning, Cryptography and Data 831 | Security, Addison-Wesley Publishing Company, Reading, 832 | Massachusetts, 1982. 833 | 834 | D.W. Davies and W.L. Price, Security for Computer Networks: 835 | An Introduction to Data Security in Teleprocessing and 836 | Electronics Funds Transfer, Second Edition, John Wiley & 837 | Sons, New York, 1984, 1989. 838 | 839 | Miles E. Smid and Dennis K. Branstad, "The Data Encryption 840 | Standard: Past and Future," in Gustavus J. Simmons, ed., 841 | Contemporary Cryptography: The Science of Information 842 | Integrity, IEEE Press, 1992. 843 | 844 | Douglas R. Stinson, Cryptography: Theory and Practice, CRC 845 | Press, Boca Raton, 1995. 846 | 847 | Bruce Schneier, Applied Cryptography, Second Edition, John 848 | Wiley & Sons, New York, 1996. 849 | 850 | Alfred J. Menezes, Paul C. van Oorschot, and Scott A. 851 | Vanstone, Handbook of Applied Cryptography, CRC Press, Boca 852 | Raton, 1997. 853 | 854 | 856 | 857 | This article appeared in Laissez Faire 858 | City Times, Vol 2, No. 28. 859 |
860 | Homepage: http://orlingrabbe.com/ |