⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bdes.ps

📁 早期freebsd实现
💻 PS
📖 第 1 页 / 共 5 页
字号:
V72 32.69 540 42.7 RV0 F0 X(Page 2 of 11) 479.71 34.7 T72 72 540 720 R7 XV0 X0.31 (Block Chaining, ) 72 712 P3 F0.31 (k) 154.25 712 P0 F0.31 (-bit Cipher Feed Back, and ) 159.58 712 P3 F0.31 (k) 293.71 712 P0 F0.31 (-bit Output Feed Back\051 as well as the Alternate ) 299.04 712 P3 F0.31 (k) 530.68 712 P0 F0.31 (-) 536.01 712 P-0.04 (bit Cipher Feed Back mode. Further) 72 692 P-0.04 (, ) 244.52 692 P3 F-0.04 (bdes) 250.48 692 P0 F-0.04 ( supports message authentication code generation based) 272.46 692 P(on both the Cipher Block Chaining mode and the ) 72 672 T3 F(k) 310.86 672 T0 F(-bit Cipher Feed Back mode.) 316.19 672 T0.07 (By default, ) 108 648 P3 F0.07 (bdes) 164.43 648 P0 F0.07 ( encrypts an input \336le using Cipher Block Chaining mode, and is invoked) 186.41 648 P-0.4 (as a \336lter) 72 628 P-0.4 (. The key may be speci\336ed either on the command line or may be typed to the prompt. So,) 114.51 628 P(if the input \336le ) 72 608 T7 F(inputf) 145.96 608 T(ile) 189.14 608 T0 F( contains the message) 210.73 608 T6 F(a) 253.9 584 T8 F(z) 261.1 584 T6 F(test) 266.07 584 T8 F(z) 294.86 584 T6 F(message) 299.83 584 T9 F(\277) 350.21 584 T0 F(then the following command encrypts it using the key ) 72 560 T6 F(abcdefgh) 333.5 560 T0 F(:) 391.07 560 T6 F(bdes -k abcdefgh < ) 158.48 536 T7 F(inputf) 295.21 536 T(ile) 338.38 536 T6 F( > ) 359.97 536 T7 F(outputf) 381.56 536 T(ile) 431.93 536 T0 F(The option ) 72 512 T4 F(-k) 127.3 512 T0 F( indicates the next ar) 137.96 512 T(gument is the key) 237.01 512 T(. Now ) 321.17 512 T7 F(outputf) 353.48 512 T(ile) 403.86 512 T0 F( contains) 425.45 512 T10 F(16 0e eb af 68 a0 d0 19 f1 a2 9b 31 0d 8a 01 c3) 136.89 488 T0 F0.06 (Other modes are speci\336ed using command-line options, as is control of the way the key is) 108 464 P(interpreted. The next sections contain several examples, and the Appendix has the manual page.) 72 444 T4 F(3. Keys and Parity) 72 412 T0 F0.58 (The key consists of 64 bits, and may be presented in any of hex, binary) 108 388 P0.58 (, or as a string of) 456.48 388 P5 F0.12 (ASCII) 72 368 P0 F0.14 ( characters. If the key is given in hex or binary) 98.1 368 P0.14 (, it is used as is with no changes. However) 322.21 368 P0.14 (, if) 526.53 368 P-0.27 (the key is given in ) 72 348 P5 F-0.23 (ASCII) 161.59 348 P0 F-0.27 (, a delicate problem arises: by convention, the parity bit is usually set to 0.) 187.69 348 P-0.47 (This high-order bit is generally ignored by applications; but the DESdoes not do so. Instead, it dis-) 72 328 P-0.14 (cards the low-order bit, ef) 72 308 P-0.14 (fectively reducing the size of the space of possible keys from 2) 195.44 308 P5 F-0.12 (56) 495.97 312.8 P0 F-0.14 ( to 2) 505.97 308 P5 F-0.12 (48) 527.01 312.8 P0 F-0.14 (.) 537 308 P-0.46 ( T) 108 284 P-0.46 (o preserve the size of the key space, the value of the parity bit must be related to the value) 117.03 284 P-0.09 (in the low-order bit, so the program sets the high-order bit to make each character in the key be of) 72 264 P-0.7 (odd parity) 72 244 P-0.7 (. \050Note that the initial value of the parity bit is ) 119.49 244 P3 F-0.7 (not) 334.99 244 P0 F-0.7 ( used in this computation.\051 For example,) 350.31 244 P(if the key is ) 72 224 T6 F(abcdefgh) 131.29 224 T0 F(, the actual key bits used are determined as follows:) 188.86 224 T5 F(ASCII) 99 200 T0 F( key) 125.1 200 T6 F(a) 243 200 T(b) 279 200 T(c) 315 200 T(d) 351 200 T(e) 387 200 T(f) 423 200 T(g) 459 200 T(h) 495 200 T5 F(ASCII) 99 180 T0 F( key bits \050hex\051) 125.1 180 T10 F(61) 243 180 T(62) 279 180 T(63) 315 180 T(64) 351 180 T(65) 387 180 T(66) 423 180 T(67) 459 180 T(68) 495 180 T0 F(parity) 99 160 T(odd) 243 160 T(odd) 279 160 T(even) 315 160 T(odd) 351 160 T(even) 387 160 T(even) 423 160 T(odd) 459 160 T(odd) 495 160 T(key bits used \050hex\051) 99 140 T10 F(61) 243 140 T(62) 279 140 T(e3) 315 140 T(64) 351 140 T(e5) 387 140 T(e6) 423 140 T(67) 459 140 T(68) 495 140 T0 F0.18 (This convention \050as opposed to requiring even parity) 108 120 P0.18 (, or simply copying the low-order bit) 362 120 P-0.41 (to the high-order bit\051 was chosen to provide compatibility with the encryption program ) 72 100 P3 F-0.41 (des) 486.77 100 P0 F-0.41 ( distrib-) 502.76 100 P-0.52 (uted by Sun Microsystems, Inc. [4]. Whether the key is entered on the command line or on the key-) 72 80 PFMENDPAGE%%EndPage: "2" 5%%Page: "3" 5612 792 0 FMBEGINPAGE72 745.99 540 756 R7 X0 KV72 32.69 540 42.7 RV0 F0 X(Page 3 of 11) 479.71 34.7 T72 72 540 720 R7 XV0 X1.89 (board, by default it is processed into the same key schedule generated by Sun\325) 72 712 P1.89 (s ) 471.02 712 P3 F1.89 (des) 480.58 712 P0 F1.89 (, so \336les) 496.56 712 P(encrypted on a Sun can be decrypted using ) 72 692 T3 F(bdes) 280.51 692 T0 F( \050and vice versa\051.) 302.49 692 T-0.3 (If the user does not wish to use the Sun convention, the option \320) 108 668 P4 F-0.3 (p) 411.9 668 P0 F-0.3 ( will disable the parity bit) 418.57 668 P-0.62 (changing; with it, the parity bit is that of the character typed. Thisis useful when the key is a known) 72 648 P5 F(ASCII) 72 628 T0 F( string and the \336le was encrypted on a system which does not alter parity bits.) 98.1 628 T-0.24 (A key may be represented as a bit vector) 108 604 P-0.24 (, rather than an ) 300.74 604 P5 F-0.2 (ASCII) 374.7 604 P0 F-0.24 ( string, in one of two ways. It) 400.8 604 P0.19 (may be represented as a string of up to 16 hexadecimal digits; if fewer than 16 are given, the key) 72 584 P0.16 (is right \336lled with 0 bits. Or) 72 564 P0.16 (, it may be represented as a string of up to 64 binary digits, and again) 206.11 564 P0.15 (if fewer than 64 are given, the key is right-\336lled with 0 bits. Bitvector keys must be given on the) 72 544 P0.51 (command line, and must begin with the characters ) 72 524 P6 F1.24 (0x) 320.28 524 P0 F0.51 ( or ) 334.67 524 P6 F1.24 (0X) 351.69 524 P0 F0.51 ( \050for hexadecimal\051 or ) 366.08 524 P6 F1.24 (0b) 472.71 524 P0 F0.51 ( or ) 487.1 524 P6 F1.24 (0B) 504.12 524 P0 F0.51 ( \050for) 518.51 524 P(binary\051. For example, all of the following strings generate the same key schedule:) 72 504 T5 F(ASCII) 72 480 T0 F( key) 98.1 480 T6 F(abcdefgh) 180 480 T0 F(hexadecimal key) 72 460 T6 F(0x6162e364e5e66768) 180 460 T0 F(binary key) 72 440 T6 F(0b0110000101100010111000110110100011100101111000-) 180 440 T(1100110011101101000) 180 420 T0 F-0.14 ( Note that giving the key on the command line as ) 108 396 P6 F-0.34 (0x6162636465666768) 345.27 396 P0 F-0.14 ( will ) 474.8 396 P3 F-0.14 (not) 499.17 396 P0 F-0.14 ( reset) 514.5 396 P0.25 (the parity bits, because it is interpreted as a sequence of hex digits, not ) 72 376 P5 F0.21 (ASCII) 416.58 376 P0 F0.25 ( characters. The dif-) 442.68 376 P0.69 (ference in interpretation is that here the user can specify all bits of the key exactly) 72 356 P0.69 (, whereas \050on) 474.34 356 P0.25 (most terminals\051 it is not possible to control how the parity bit of ) 72 336 P5 F0.21 (ASCII) 384.76 336 P0 F0.25 ( characters is set. On some) 410.85 336 P0.36 (systems, it is possible to use a \322Meta\323 key to set the parity bit for an ) 72 316 P5 F0.3 (ASCII) 407.23 316 P0 F0.36 ( character; should this) 433.33 316 P-0.3 (be the case and the user desire ) 72 296 P3 F-0.3 (bdes) 218.09 296 P0 F-0.3 ( not to reset the parity bit, the option ) 240.07 296 P4 F-0.3 (\320p) 415.25 296 P0 F-0.3 ( will force the parity bit) 427.92 296 P(to be used as typed.) 72 276 T4 F(4. Encryption Output Repr) 72 244 T(esentation) 211.05 244 T0 F0.01 (All modes of the DES output ciphertext in blocks; the size of the block is 64 bits \0508 bytes\051) 108 220 P-0.25 (for ECB and CBC modes, and ) 72 200 P3 F-0.25 (k) 218.74 200 P0 F-0.25 ( bits for the ) 224.07 200 P3 F-0.25 (k) 281.02 200 P0 F-0.25 (-bit CFB and OFB modes, and there are as many out-) 286.35 200 P-0.5 (put blocks as input blocks. However) 72 180 P-0.5 (, as the length of the input is usually not a multiple of the block) 243.55 180 P-0.35 (size, some padding is necessary; but as padding must be done by appending characters, these char-) 72 160 P0.29 (acters must be distinguished from the input characters somehow) 72 140 P0.29 (. The mechanism used is that the) 381.35 140 P0.31 (last character of the \050decrypted\051 last block is the\050integer\051 number of characters from the input in) 72 120 P(the last block.) 72 100 TFMENDPAGE%%EndPage: "3" 6%%Page: "4" 6612 792 0 FMBEGINPAGE72 745.99 540 756 R7 X0 KV72 32.69 540 42.7 RV0 F0 X(Page 4 of 11) 479.71 34.7 T72 72 540 720 R7 XV0 X-0.59 (For example, suppose ) 108 712 P7 F-1.41 (inputf) 214.16 712 P-1.41 (ile) 257.34 712 P0 F-0.59 ( contains \322) 278.93 712 P6 F-1.41 (This) 329.04 712 P8 F-0.65 (z) 357.83 712 P6 F-1.41 (is) 362.8 712 P8 F-0.65 (z) 377.2 712 P6 F-1.41 (a) 382.17 712 P8 F-0.65 (z) 389.37 712 P6 F-1.41 (test) 394.35 712 P9 F-0.59 (\277) 423.13 712 P0 F-0.59 (\323, and it is encrypted in) 431.02 712 P(CBC mode using the key \322) 72 692 T6 F(abcdef#@) 200.93 692 T0 F(\323 and the initialization vector ) 258.5 692 T6 F(0x0) 401.4 692 T0 F(; the command is) 422.99 692 T6 F(bdes -k abcdef#@ < ) 158.48 668 T7 F(inputf) 295.21 668 T(ile) 338.38 668 T6 F( > ) 359.97 668 T7 F(outputf) 381.56 668 T(ile) 431.93 668 T0 F(as CBC is the default encryption mode and ) 72 644 T6 F(0x0) 281.2 644 T0 F( the default initialization vector:) 302.79 644 T(text) 72 620 T6 F(T) 117 620 T(h) 144 620 T(i) 171 620 T(s) 198 620 T8 F(z) 225 620 T6 F(i) 252 620 T(s) 279 620 T8 F(z) 306 620 T6 F(a) 333 620 T8 F(z) 360 620 T6 F(t) 387 620 T(e) 414 620 T(s) 441 620 T(t) 468 620 T9 F(\277) 495 620 T0 F(hex) 72 600 T10 F(54) 117 600 T(68) 144 600 T(69) 171 600 T(73) 198 600 T(20) 225 600 T(69) 252 600 T(73) 279 600 T(20) 306 600 T(61) 333 600 T(20) 360 600 T(74) 387 600 T(65) 414 600 T(73) 441 600 T(74) 468 600 T(0a) 495 600 T0 F(input) 72 580 T10 F(54) 117 580 T(68) 144 580 T(69) 171 580 T(73) 198 580 T(20) 225 580 T(69) 252 580 T(73) 279 580 T(20) 306 580 T(61) 333 580 T(20) 360 580 T(74) 387 580 T(65) 414 580 T(73) 441 580 T(74) 468 580 T(0a) 495 580 T(07) 522 580 T0 F(output) 72 560 T10 F(a5) 117 560 T(5f) 144 560 T(81) 171 560 T(53) 198 560 T(51) 225 560 T(98) 252 560 T(47) 279 560 T(02) 306 560 T(db) 333 560 T(5a) 360 560 T(c5) 387 560 T(fe) 414 560 T(50) 441 560 T(3d) 468 560 T(40) 495 560 T(ce) 522 560 T0 F0.04 (Notice that the text is 15 characters long, so there are 7 bytes following the last full block.) 108 540 P3 F0.22 (Bdes) 72 520 P0 F0.22 ( pads this to a full block by appending one byte containing the ) 95.32 520 P5 F0.19 (ASCII) 399.67 520 P0 F0.22 ( character with numeric) 425.77 520 P(value 7 \050the ) 72 500 T5 F(ASCII) 131.62 500 T0 F( character <) 157.71 500 T5 F(BEL) 214.42 500 T0 F(>\051. The result is then encrypted.) 233.3 500 T0.44 (As another example, suppose ) 108 476 P7 F1.07 (inputf) 253.34 476 P1.07 (ile) 296.52 476 P0 F0.44 ( contains \322) 318.11 476 P6 F1.07 (test) 370.29 476 P0 F0.44 (\323, and it is encrypted in ECB) 399.08 476 P(mode using the key \322) 72 456 T6 F(abcdef#@) 173.93 456 T0 F(\323; the command is) 231.5 456 T6 F(bdes -b \320k abcdef#@ < ) 147.69 432 T7 F(inputf) 306 432 T(ile) 349.18 432 T6 F( > ) 370.76 432 T7 F(outputf) 392.35 432 T(ile) 442.73 432 T0 F(because the option ) 72 408 T4 F(\320b) 164.26 408 T0 F( signi\336es ECB mode:) 176.93 408 T(text) 72 384 T6 F(t) 144 384 T(e) 171 384 T(s) 198 384 T(t) 225 384 T0 F(hex) 72 364 T10 F(74) 144 364 T(65) 171 364 T(73) 198 364 T(74) 225 364 T0 F(input) 72 344 T10 F(74) 144 344 T(65) 171 344 T(73) 198 344 T(74) 225 344 T(00) 252 344 T(00) 279 344 T(00) 306 344 T(04) 333 344 T0 F(output) 72 324 T10 F(0d) 144 324 T(8a) 171 324 T

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -