rfc2268.txt
来自「RFC 的详细文档!」· 文本 代码 · 共 620 行 · 第 1/2 页
TXT
620 行
R[i] = R[i] ror s[i];
R[i] = R[i] - K[j] - (R[i-1] & R[i-2]) - ((~R[i-1]) & R[i-3]);
j = j - 1;
In words: R[i] is rotated right by s[i] bits (bits rotated out the
right end of R[i] are brought back in at the left). Here j is a
"global" variable so that K[j] is always the key word with greatest
index in the expanded key which has not yet been used in a "r-mix"
operation. The key word K[j] is subtracted from R[i], and j is
decremented. R[i-1] is used to create a "composite" word which is
subtracted from R[i]. The composite word is identical with R[i-2] in
those positions where R[i-1] is one, and identical to R[i-3] in those
positions where R[i-1] is zero.
4.2 R-Mixing round
An "r-mixing round" consists of the following operations:
R-Mix up R[3]
R-Mix up R[2]
R-Mix up R[1]
R-Mix up R[0]
Rivest Informational [Page 6]
RFC 2268 RC2(r) Encryption Algorithm March 1998
4.3 R-Mash R[i]
The primitive "R-Mash R[i]" operation is defined as follows (using
the previous conventions regarding subscripts for R):
R[i] = R[i] - K[R[i-1] & 63];
In words: R[i] is "r-mashed" by subtracting from it one of the words
of the expanded key. The key word to be used is determined by looking
at the low-order six bits of R[i-1], and using that as an index into
the key array K.
4.4 R-Mashing round
An "r-mashing round" consists of:
R-Mash R[3]
R-Mash R[2]
R-Mash R[1]
R-Mash R[0]
4.5 Decryption operation
The entire decryption operation can now be described as follows.
Here j is a global integer variable which is affected by the mixing
operations.
1. Initialize words R[0], ..., R[3] to contain the 64-bit
ciphertext value.
2. Expand the key, so that words K[0], ..., K[63] become
defined.
3. Initialize j to 63.
4. Perform five r-mixing rounds.
5. Perform one r-mashing round.
6. Perform six r-mixing rounds.
7. Perform one r-mashing round.
8. Perform five r-mixing rounds.
5. Test vectors
Test vectors for encryption with RC2 are provided below.
Rivest Informational [Page 7]
RFC 2268 RC2(r) Encryption Algorithm March 1998
All quantities are given in hexadecimal notation.
Key length (bytes) = 8
Effective key length (bits) = 63
Key = 00000000 00000000
Plaintext = 00000000 00000000
Ciphertext = ebb773f9 93278eff
Key length (bytes) = 8
Effective key length (bits) = 64
Key = ffffffff ffffffff
Plaintext = ffffffff ffffffff
Ciphertext = 278b27e4 2e2f0d49
Key length (bytes) = 8
Effective key length (bits) = 64
Key = 30000000 00000000
Plaintext = 10000000 00000001
Ciphertext = 30649edf 9be7d2c2
Key length (bytes) = 1
Effective key length (bits) = 64
Key = 88
Plaintext = 00000000 00000000
Ciphertext = 61a8a244 adacccf0
Key length (bytes) = 7
Effective key length (bits) = 64
Key = 88bca90e 90875a
Plaintext = 00000000 00000000
Ciphertext = 6ccf4308 974c267f
Key length (bytes) = 16
Effective key length (bits) = 64
Key = 88bca90e 90875a7f 0f79c384 627bafb2
Plaintext = 00000000 00000000
Ciphertext = 1a807d27 2bbe5db1
Key length (bytes) = 16
Effective key length (bits) = 128
Key = 88bca90e 90875a7f 0f79c384 627bafb2
Plaintext = 00000000 00000000
Ciphertext = 2269552a b0f85ca6
Key length (bytes) = 33
Effective key length (bits) = 129
Key = 88bca90e 90875a7f 0f79c384 627bafb2 16f80a6f 85920584
c42fceb0 be255daf 1e
Rivest Informational [Page 8]
RFC 2268 RC2(r) Encryption Algorithm March 1998
Plaintext = 00000000 00000000
Ciphertext = 5b78d3a4 3dfff1f1
6. RC2 Algorithm Object Identifier
The Object Identifier for RC2 in cipher block chaining mode is
rc2CBC OBJECT IDENTIFIER
::= {iso(1) member-body(2) US(840) rsadsi(113549)
encryptionAlgorithm(3) 2}
RC2-CBC takes parameters
RC2-CBCParameter ::= CHOICE {
iv IV,
params SEQUENCE {
version RC2Version,
iv IV
}
}
where
IV ::= OCTET STRING -- 8 octets
RC2Version ::= INTEGER -- 1-1024
RC2 in CBC mode has two parameters: an 8-byte initialization vector
(IV) and a version number in the range 1-1024 which specifies in a
roundabout manner the number of effective key bits to be used for the
RC2 encryption/decryption.
The correspondence between effective key bits and version number is
as follows:
1. If the number EKB of effective key bits is in the range 1-255,
then the version number is given by Table[EKB], where the 256-byte
translation table Table[] is specified below. Table[] specifies a
permutation on the numbers 0-255; note that it is not the same
table that appears in the key expansion phase of RC2.
2. If the number EKB of effective key bits is in the range
256-1024, then the version number is simply EKB.
The default number of effective key bits for RC2 is 32. If RC2-CBC
is being performed with 32 effective key bits, the parameters
should be supplied as a simple IV, rather than as a SEQUENCE
containing a version and an IV.
Rivest Informational [Page 9]
RFC 2268 RC2(r) Encryption Algorithm March 1998
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: bd 56 ea f2 a2 f1 ac 2a b0 93 d1 9c 1b 33 fd d0
10: 30 04 b6 dc 7d df 32 4b f7 cb 45 9b 31 bb 21 5a
20: 41 9f e1 d9 4a 4d 9e da a0 68 2c c3 27 5f 80 36
30: 3e ee fb 95 1a fe ce a8 34 a9 13 f0 a6 3f d8 0c
40: 78 24 af 23 52 c1 67 17 f5 66 90 e7 e8 07 b8 60
50: 48 e6 1e 53 f3 92 a4 72 8c 08 15 6e 86 00 84 fa
60: f4 7f 8a 42 19 f6 db cd 14 8d 50 12 ba 3c 06 4e
70: ec b3 35 11 a1 88 8e 2b 94 99 b7 71 74 d3 e4 bf
80: 3a de 96 0e bc 0a ed 77 fc 37 6b 03 79 89 62 c6
90: d7 c0 d2 7c 6a 8b 22 a3 5b 05 5d 02 75 d5 61 e3
a0: 18 8f 55 51 ad 1f 0b 5e 85 e5 c2 57 63 ca 3d 6c
b0: b4 c5 cc 70 b2 91 59 0d 47 20 c8 4f 58 e0 01 e2
c0: 16 38 c4 6f 3b 0f 65 46 be 7e 2d 7b 82 f9 40 b5
d0: 1d 73 f8 eb 26 c7 87 97 25 54 b1 28 aa 98 9d a5
e0: 64 6d 7a d4 10 81 44 ef 49 d6 ae 2e dd 76 5c 2f
f0: a7 1c c9 09 69 9a 83 cf 29 39 b9 e9 4c ff 43 ab
A. Intellectual Property Notice
RC2 is a registered trademark of RSA Data Security, Inc. RSA's
copyrighted RC2 software is available under license from RSA Data
Security, Inc.
B. Author's Address
Ron Rivest
RSA Laboratories
100 Marine Parkway, #500
Redwood City, CA 94065 USA
Phone: (650) 595-7703
EMail: rsa-labs@rsa.com
Rivest Informational [Page 10]
RFC 2268 RC2(r) Encryption Algorithm March 1998
C. Full Copyright Statement
Copyright (C) The Internet Society (1998). All Rights Reserved.
This document and translations of it may be copied and furnished to
others, and derivative works that comment on or otherwise explain it
or assist in its implementation may be prepared, copied, published
and distributed, in whole or in part, without restriction of any
kind, provided that the above copyright notice and this paragraph are
included on all such copies and derivative works. However, this
document itself may not be modified in any way, such as by removing
the copyright notice or references to the Internet Society or other
Internet organizations, except as needed for the purpose of
developing Internet standards in which case the procedures for
copyrights defined in the Internet Standards process must be
followed, or as required to translate it into languages other than
English.
The limited permissions granted above are perpetual and will not be
revoked by the Internet Society or its successors or assigns.
This document and the information contained herein is provided on an
"AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
Rivest Informational [Page 11]
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?