RFC2040 日本語訳

2040 The RC5, RC5-CBC, RC5-CBC-Pad, and RC5-CTS Algorithms. R.Baldwin, R. Rivest. October 1996. (Format: TXT=54598 bytes) (Status: INFORMATIONAL)

RFC一覧
英語原文

Network Working Group                                         R. Baldwin
Request for Comments: 2040                       RSA Data Security, Inc.
Category: Informational                                        R. Rivest
                                     MIT Laboratory for Computer Science
                                             and RSA Data Security, Inc.
                                                            October 1996


         The RC5, RC5-CBC, RC5-CBC-Pad, and RC5-CTS Algorithms

         RC5, RC5-CBC, RC5-CBC-Pad と RC5-CTS アルゴリズム


Status of this Memo

このメモの位置づけ

   This memo provides information for the Internet community.  This memo
   does not specify an Internet standard of any kind.  Distribution of
   this memo is unlimited.

   このメモは、Internet community のための情報を提供する。このメモは、ど
   んな種類の Internet 標準も明細に述べない。このメモの配布は、無制限であ
   る。

-------------------------------------------------------------------------

Acknowledgments

謝辞

   We would like to thank Steve Dusse, Victor Chang, Tim Mathews, Brett
   Howard, and Burt Kaliski for helpful suggestions.

   われわれは、役立つ提案について Steve Dusse, Victor Chang, Tim Mathews,
   Brett Howard と Burt Kaliski に感謝したい。

-------------------------------------------------------------------------

Table of Contents

目次

     1.        Executive Summary .......................  1
     2.        Overview ................................  2
     3.        Terminology and Notation ................  3
     4.        Description of RC5 Keys .................  4
     5.        Description of RC5 Key Expansion ........  6
     6.        Description of RC5 Block Cipher ......... 10
     7.        Description of RC5-CBC and RC5-CBC-Pad .. 12
     8.        Description of RC5-CTS .................. 18
     9.        Test Program and Vectors ................ 19
     10.       Security Considerations ................. 26
     11.       ASN.1 Identifiers ....................... 28
     References ........................................ 28
     Authors' Addresses ................................ 29


     1.        実行する概要 ............................  1
     2.        概観 ....................................  2
     3.        用語と表記 ..............................  3
     4.        RC5 鍵の記述 ............................  4
     5.        RC5 鍵拡張の記述 ........................  6
     6.        RC5 Block Cipher の記述 ................. 10
     7.        RC5-CBC と RC5-CBC-Pad の記述 ........... 12
     8.        RC5-CTS の記述 .......................... 18
     9.        テストのプログラムとベクトル ............ 19
     10.       セキュリティに関する考察 ................ 26
     11.       ASN.1 識別子 ............................ 28
     参考文献 .......................................... 28
     著者のアドレス .................................... 29

-------------------------------------------------------------------------

1.  Executive Summary

1.  実行する概要

   This document defines four ciphers with enough detail to ensure
   interoperability between different implementations.  The first cipher
   is the raw RC5 block cipher.  The RC5 cipher takes a fixed size input
   block and produces a fixed sized output block using a transformation
   that depends on a key.  The second cipher, RC5-CBC, is the Cipher
   Block Chaining (CBC) mode for RC5.  It can process messages whose
   length is a multiple of the RC5 block size.  The third cipher, RC5-
   CBC-Pad, handles plaintext of any length, though the ciphertext will
   be longer than the plaintext by at most the size of a single RC5
   block.  The RC5-CTS cipher is the Cipher Text Stealing mode of RC5,
   which handles plaintext of any length and the ciphertext length
   matches the plaintext length.

   この文書は、異なった実装間の相互互換性を確実にするため、十分な詳細とと
   もに 4 つの暗号を定義する。最初の暗号は、raw RC5 ブロック暗号である。
   RC5 暗号は、固定サイズの入力ブロックを取り、鍵に依存した変形を使用して
   固定サイズの出力ブロックを作り出す。2 番目の暗号、RC5-CBC は、RC5 のた
   めの Cipher Block Chaining (CBC:暗号ブロック連鎖) モードである。3 番目
   の暗号、RC5-CBC-Pad は、どんな長さの平文も扱う。もっとも暗号文は、多く
   てたった一つの RC5 ブロックのサイズの平文より長いだろうが。RC5-CTS 暗
   号は、RC5 の Cipher Text Stealing モードであり、どんな長さの平文も扱い
   暗号文の長さは平文の長さにマッチする。

   The RC5 cipher was invented by Professor Ronald L. Rivest of the
   Massachusetts Institute of Technology in 1994.  It is a very fast and
   simple algorithm that is parameterized by the block size, the number
   of rounds, and key length.  These parameters can be adjusted to meet
   different goals for security, performance, and exportability.

   RC5 暗号は、1994 年に the Massachusetts Institute of Technology の
   Professor Ronald L. Rivest によって発明された。これはブロックサイズ、
   ラウンド数、鍵長によってパラメータ化された大変速く、単純なアルゴリズム
   である。これらのパラメータは、セキュリティ、パフォーマンス、輸出できる
   ことのために、異なった目的を満たすために調節されることが出来る。

   RSA Data Security Incorporated has filed a patent application on the
   RC5 cipher and for trademark protection for RC5, RC5-CBC, RC5-CBC-
   Pad, RC5-CTS and assorted variations.

   RSA Data Security Incorporated は、RC5 暗号での特許アプリケーションを
   提出、RC5, RC5-CBC, RC5-CBC-Pad, RC5-CTS と各種組み合わせの変形につい
   て登録商標を申請した。

-------------------------------------------------------------------------

2.  Overview

2.  概観

   This memo is a restatement of existing published material.  The
   description of RC5 follows the notation and order of explanation
   found in the original RC5 paper by Professor Rivest [2].  The CBC
   mode appears in reference works such as the one by Bruce Schneier
   [6].  The CBC-Pad mode is the same as in the Public Key Cryptography
   Standard (PKCS) number five [5].  Sample C code [8] is included for
   clarity only and is equivalent to the English language descriptions.

   このメモは、存在する発表された材料の再陳述である。RC5 の記述は、
   Professor Rivest [2] によるオリジナル RC5 論文で見いだされる説明の表記
   と順序に従う。CBC モードは、Bruce Schneier による論文のような参考文献
   作品に載っている。CBC-Pad モードは、Public Key Cryptography Standard
   (PKCS) ナンバー 5 [5] で同一である。サンプル C コード [8] は、明快さの
   みのために含まれ、英語の記述に等しい。

   The ciphers will be explained in a bottom up object-oriented fashion.
   First, RC5 keys will be presented along with the key expansion
   algorithm.  Second, the RC5 block cipher is explained, and finally,
   the RC5-CBC and RC5-CBC-Pad ciphers are specified.  For brevity, only
   the encryption process is described.  Decryption is achieved by
   inverting the steps of encryption.

   (これらの)暗号は、ボトムアップオブジェクト指向方法で説明するつもりであ
   る。最初に、RC5 鍵は鍵拡張アルゴリズムと一緒に示されるだろう。二番目に
   RC5 ブロック暗号が説明され、最後に RC5-CBC と RC5-CBC-Pad 暗号が明細に
   述べられる。簡潔のため、暗号化プロセスのみが記述される。復号は暗号化の
   逆のステップによって成し遂げられる。

   The object-oriented description found here should make it easier to
   implement interoperable systems, though it is not as terse as the
   functional descriptions found in the references.  There are two
   classes of objects, keys and cipher algorithms.  Both classes share
   operations that create and destroy these objects in a manner that
   ensures that secret information is not returned to the memory
   manager.

   ここで見いだされるオブジェクト指向記述は、暗号を相互互換なシステムに実
   装するために、より容易にさせる。もっとも参考文献で見いだされる機能の記
   述ほど簡潔でないが。オブジェクトの二つのクラス、鍵と暗号化アルゴリズム
   がある。両方のクラスは、秘密情報がメモリマネージャに返らないことを確実
   にする、ある意味では、これらオブジェクトを作り出し破壊するオペレーショ
   ンを共有する。

   Keys also have a "set" operation that copies a secret key into the
   object.  The "set" operation for the cipher objects defines the
   number of rounds, and the initialization vector.

   鍵も、秘密鍵をオブジェクトにコピーする "set" オペレーションを持つ。暗
   号オブジェクトのための "set" オペレーションは、ラウンド数と初期ベクト
   ルを定義する。

   There are four operations for the cipher objects described in this
   memo.  There is binding a key to a cipher object, setting a new
   initialization vector for a cipher object without changing the key,
   encrypting part of a message (this would be performed multiple times
   for long messages), and processing the last part of a message which
   may add padding or check the length of the message.

   このメモで記述された暗号オブジェクトのための 4 つのオペレーションがあ
   る。鍵を暗号オブジェクトに結びつけることと、鍵を変更なしに暗号オブジェ
   クトのために新しい初期ベクトルをセットすることと、メッセージの一部分を
   暗号化すること (これは長いメッセージのために多くの要素からなる時間おこ
   なわれるだろう) と、パディングを追加するかもしれないことやメッセージの
   長さをチェックするかもしれないメッセージの最後の部分の処理である。

   In summary, the cipher will be explained in terms of these
   operations:

   要約で、暗号はこれらオペレーションの用語で説明されるつもりである。

   RC5_Key_Create           - Create a key object.

   RC5_Key_Destroy          - Destroy a key object.

   RC5_Key_Set              - Bind a user key to a key object.

   RC5_CBC_Create           - Create a cipher object.

   RC5_CBC_Destroy          - Destroy a cipher object.

   RC5_CBC_Encrypt_Init     - Bind a key object to a cipher object.

   RC5_CBC_SetIV            - Set a new IV without changing the key.

   RC5_CBC_Encrypt_Update   - Process part of a message.

   RC5_CBC_Encrypt_Final    - Process the end of a message.


   RC5_Key_Create           - 鍵オブジェクトの生成。

   RC5_Key_Destroy          - 鍵オブジェクトの破壊。

   RC5_Key_Set              - ユーザ鍵を鍵オブジェクトに結び付ける。

   RC5_CBC_Create           - 暗号オブジェクトの生成。

   RC5_CBC_Destroy          - 暗号オブジェクトの破壊。

   RC5_CBC_Encrypt_Init     - 鍵オブジェクトを暗号オブジェクトに結び付け
                              る。

   RC5_CBC_SetIV            - 鍵を変更なしに新しい IV をセット。

   RC5_CBC_Encrypt_Update   - メッセージの一部分を処理。

   RC5_CBC_Encrypt_Final    - メッセージの最後を処理。

-------------------------------------------------------------------------

3.  Terminology and Notation

3.  用語と表記

   The term "word" refers to a string of bits of a particular length
   that can be operated on as either an unsigned integer or as a bit
   vector.  For example a "word" might be 32 or 64 bits long depending
   on the desired block size for the RC5 cipher.  A 32 bit word will
   produce a 64 bit block size.  For best performance the RC5 word size
   should match the register size of the CPU.  The term "byte" refers to
   eight bits.

   用語 "word" は、符合なし整数かビットベクトルでオペレートされることが出
   来る特定の長さのビット文字列を指して言う。たとえば、"word" は、RC5 暗
   号のために、望まれるブロックサイズに依存した 32 か 64 bits 長であるか
   もしれない。32 bit word は、64 bit ブロックサイズを生み出すかもしれな
   い。最もよいパフォーマンスのために、RC5 word サイズは、CPU のレジスタサ
   イズにマッチすべきである。用語 "byte" は、8 bits を指して言う。

   The following variables will be used throughout this memo with these
   meanings:

   次の変数は、これら(下)の意味を持つこのメモを通じて使用されるだろう。

  W  This is the word size for RC5 measured in bits.  It is half the
      block size.  The word sizes covered by this memo are 32 and 64.

  WW This is the word size for RC5 measured in bytes.

  B  This is the block size for RC5 measured in bits.  It is twice
      the word size.  When RC5 is used as a 64 bit block cipher, B is
      64 and W is 32. 0 < B < 257.  In the sample code, B, is used as
      a variable instead of a cipher system parameter, but this usage
      should be obvious from context.

  BB This is the block size for RC5 measured in bytes.  BB = B / 8.

  b  This is the byte length of the secret key.  0 <= b < 256.

  K  This is the secret key which is treated as a sequence of b
      bytes indexed by: K[0], ..., K[b-1].

  R  This is the number of rounds of the inner RC5 transform.
      0 <= R < 256.

  T  This is the number of words in the expanded key table.  It is
      always 2*(R + 1).  1 < T < 513.

  S  This is the expanded key table which is treated as a sequence
      of words indexed by: S[0], ..., S[T-1].

  N  This is the byte length of the plaintext message.

  P  This is the plaintext message which is treated as a sequence of
      N bytes indexed by: P[0], ..., P[N-1].

  C  This is the ciphertext output which is treated as a sequence of
      bytes indexed by: C[0], C[1], ...

  I  This is the initialization vector for the CBC mode which is
      treated as a sequence of bytes indexed by: I[0], ..., I[BB-1].


  W  これは、bits で表される RC5 のための word サイズ。ブロックサイズの半
      分である。このメモで扱われる word サイズは、34 と 64 である。

  WW これは、bytes で表される RC5 のための word サイズである。

  B  これは、bits で表される RC5 のためのブロックサイズである。これは、
      word サイズの 2 倍である。RC5 が 64 bit ブロック暗号として使用され
      る時、B は 64 で、W は 32 である。0 < B < 257。サンプルコードで、B
      は暗号システムパラメータの代わりに変数として使用されるが、しかしこ
      の使用法は前後関係から明白であるべきである。

  BB これは、bytes で表される RC5 のためのブロックサイズである。
      BB = B / 8。

  b  これは、暗号鍵のバイト長である。0 <= b < 256。

  K  これは、K[0], ..., k[b-1] でインデックスされた b bytes の連続として
      扱われる暗号鍵である。

  R  これは、内側の RC5 変換のラウンド数である。0 <= R < 256。

  T  これは、拡張された鍵テーブルの words 数。いつも 2*(R + 1) である。
      1 < T < 513。

  S  これは、S[0], ..., S[T-1] でインデックスされた words の連続として扱
      われる拡張された鍵テーブルである。

  N  これは、平文メッセージのバイト長である。

  P  これは、P[0], ..., P[N-1] でインデックスされた N bteys の連続として
      扱われる平文メッセージである。

  C  これは、C[0], C[1], ... でインデックスされた bytes の連続として扱わ
      れる暗号文出力である。

  I  これは、I[0], ..., I[BB-1] でインデックスされた bytes の連続として扱
      われる CBC モードのための初期ベクトルである。

-------------------------------------------------------------------------

4.  Description of RC5 Keys

4.  RC5 鍵の記述

   Like most block ciphers, RC5 expands a small user key into a table of
   internal keys.  The byte length of the user key is one of the
   parameters of the cipher, so the RC5 user key object must be able to
   hold variable length keys.  A possible structure for this in C is:

   たいていのブロック暗号のように、RC5 は小さいユーザ鍵を内部の鍵テーブル
   に拡張する。ユーザ鍵のバイト長は、暗号のパラメータの一つであって、RC5
   ユーザ鍵オブジェクトは可変長鍵を保つことが出来なければならない。C で、
   このための可能な構造体は (次の通りである) :

  /* Definition of RC5 user key object. */
  /* RC5 ユーザ鍵オブジェクトの定義 */
  typedef struct rc5UserKey
  {
    int          keyLength; /* In Bytes. (Bytes での) */
    unsigned char   *keyBytes;
  } rc5UserKey;

   The basic operations on a key are to create, destroy and set.  To
   avoid exposing key material to other parts of an application, the
   destroy operation zeros the memory allocated for the key before
   releasing it to the memory manager.  A general key object may support
   other operations such as generating a new random key and deriving a
   key from key-agreement information.

   鍵の基本オペレーションは、生成と破壊とセットすることである。アプリケー
   ションの他の部分に鍵材料をさらすことを避けるために、破壊オペレーション
   は、それをメモリマネージャに解放する前に、鍵のために割り当てたメモリを
   ゼロにする。全体的な鍵オブジェクトは、新しいランダム鍵を生み出すことと
   鍵一致情報からの鍵を派生するような他のオペレーションをサポートするかも
   しれない。

4.1 Creating an RC5 Key

4.1 RC5 鍵の作成

   To create a key, the memory for the key object must be allocated and
   initialized.  The C code below assumes that a function called
   "malloc" will return a block of uninitialized memory from the heap,
   or zero indicating an error.

   鍵を作成するために、鍵オブジェクトのためのメモリは、割り当てられなけれ
   ばならなく初期化されなければならない。下の C コードは、"malloc" を呼ぶ
   関数はヒープから初期化されていないメモリのブロックかエラーを指し示して
   いるゼロを返すだろうと当然思われる。

  /* Allocate and initialize an RC5 user key.
   * Return 0 if problems.
   */
  /* RC5 ユーザ鍵を割り当て、初期化する。
   * もし問題なら、0 を返す。
   */
  rc5UserKey *RC5_Key_Create ()
  {
    rc5UserKey *pKey;

    pKey = (rc5UserKey *) malloc (sizeof(*pKey));
    if (pKey != ((rc5UserKey *) 0))
    {
        pKey->keyLength = 0;
        pKey->keyBytes = (unsigned char *) 0;
    }
    return (pKey);
  }

4.2 Destroying an RC5 Key

4.2 RC5 鍵の破壊

   To destroy a key, the memory must be zeroed and released to the
   memory manager.  The C code below assumes that a function called
   "free" will return a block of memory to the heap.

   鍵を破壊するために、メモリはゼロにされなければならなく、メモリにマネー
   ジャに解放されなければならない。下の C コードは、"free" を呼ぶ関数が、
   ヒープにメモリのブロックを返すだろうと当然思われる。

  /* Zero and free an RC5 user key.
   */
  /* RC5 ユーザ鍵をゼロにし解放する。
   */
  void RC5_Key_Destroy (pKey)
    rc5UserKey      *pKey;
  {
    unsigned char   *to;
    int          count;

    if (pKey == ((rc5UserKey *) 0))
        return;
    if (pKey->keyBytes == ((unsigned char *) 0))
        return;
    to = pKey->keyBytes;
    for (count = 0 ; count < pKey->keyLength ; count++)
        *to++ = (unsigned char) 0;
    free (pKey->keyBytes);
    pKey->keyBytes = (unsigned char *) 0;
    pKey->keyLength = 0;
    free (pKey);
  }

4.3 Setting an RC5 Key

4.2 RC5 鍵のセット

   Setting the key object makes a copy of the secret key into a block of
   memory allocated from the heap.

   鍵オブジェクトをセットすることは、暗号鍵のコピーをヒープから割り当てら
   れたメモリのブロックに作る。

  /* Set the value of an RC5 user key.
   * Copy the key bytes so the caller can zero and
   * free the original.
   * Return zero if problems
   */
  /* RC5 ユーザ鍵の値をセット。
   * 呼び出し側がオリジナルをゼロにし解放できるために、
   * 鍵 bytes コピー。
   * もし問題があるなら、ゼロを返す。
   */
  int RC5_Key_Set (pKey, keyLength, keyBytes)
    rc5UserKey  *pKey;
    int          keyLength;
    unsigned char   *keyBytes;
  {
    unsigned char   *keyBytesCopy;
    unsigned char   *from, *to;
    int          count;

    keyBytesCopy = (unsigned char *) malloc (keyLength);
    if (keyBytesCopy == ((unsigned char *) 0))
        return (0);
    from = keyBytes;
    to = keyBytesCopy;
    for (count = 0 ; count < keyLength ; count++)
        *to++ = *from++;
    pKey->keyLength = count;
    pKey->keyBytes = keyBytesCopy;
    return (1);
  }

-------------------------------------------------------------------------

5.  Description of RC5 Key Expansion

5.  RC5 鍵拡張の記述

   This section describes the key expansion algorithm.  To be specific,
   the sample code assumes that the block size is 64 bits.  Several
   programming parameters depend on the block size.

   このセクションは、鍵拡張アルゴリズムを記述する。明確であるために、サン
   プルコードは、ブロックサイズが 64 bits であると当然思う。いくつかのプ
   ログラミングパラメータは、ブロックサイズに依存する。

  /* Definitions for RC5 as a 64 bit block cipher. */
  /* The "unsigned int" will be 32 bits on all but */
  /* the oldest compilers, which will make it 16 bits. */
  /* On a DEC Alpha "unsigned long" is 64 bits, not 32. */
  /* 64 bit ブロック暗号として RC5 のための定義。*/
  /* "unsigned int" は、ほとんど 32 bits であろう。*/
  /* 最も古いコンパイラは、それを 16 bits にさせるだろう。*/
  /* DEC Alpha で、"unsigned long" は、32 ではなく 64 bits である。*/
  #define RC5_WORD     unsigned int
  #define W            (32)
  #define WW           (W / 8)
  #define ROT_MASK     (W - 1)
  #define BB           ((2 * W) / 8) /* Bytes per block */
                                     /* ブロックごとの Bytes */

  /* Define macros used in multiple procedures. */
  /* These macros assumes ">>" is an unsigned operation, */
  /* and that x and s are of type RC5_WORD. */
  /* 複数の手続きで使用されるマクロの定義。*/
  /* これらのマクロは、">>" が符合なしオペレーションであることが当然思わ
     れ、*/
  /* x と s は、型 RC5_WORD である。*/
  #define SHL(x,s)    ((RC5_WORD)((x)<<((s)&ROT_MASK)))
  #define SHR(x,s,w)  ((RC5_WORD)((x)>>((w)-((s)&ROT_MASK))))
  #define ROTL(x,s,w) ((RC5_WORD)(SHL((x),(s))|SHR((x),(s),(w))))

5.1 Definition of initialization constants

5.1 初期定数の定義

   Two constants, Pw and Qw, are defined for any word size W by the
   expressions:

   二つの定数、Pw と Qw が、式によってどんな word サイズ W のついても定義
   される:

        Pw = Odd((e-2)*2**W)

        Qw = Odd((phi-1)*2**W)

   where e is the base of the natural logarithm (2.71828 ...), and phi
   is the golden ratio (1.61803 ...), and 2**W is 2 raised to the power
   of W, and Odd(x) is equal to x if x is odd, or equal to x plus one if
   x is even.  For W equal to 16, 32, and 64, the Pw and Qw constants
   are the following hexadecimal values:

   ここで、e は自然対数 (2.71828 ...) の底であり、phi は黄金比
   (1.61803 ...) である。2**W は 2 を W の階乗に上げられることである。
   Odd(x) は、もし x が奇数なら x に等しく、もし x が偶数なら x + 1 に等
   しい。W が 16, 32 と 64 に等しくあるために、Pw と Qw 定数は次の 16 進
   数値である。

  #define P16  0xb7e1
  #define Q16  0x9e37
  #define P32  0xb7e15163
  #define Q32  0x9e3779b9
  #define P64  0xb7e151628aed2a6b
  #define Q64  0x9e3779b97f4a7c15
  #if W == 16
  #define Pw   P16 /* Select 16 bit word size */
                   /* 16 bit word サイズを選択 */
  #define Qw   Q16
  #endif
  #if W == 32
  #define Pw   P32 /* Select 32 bit word size */
                   /* 32 bit word サイズを選択 */
  #define Qw   Q32
  #endif
  #if W == 64
  #define Pw   P64 /* Select 64 bit word size */
                   /* 64 bit word サイズを選択 */
  #define Qw   Q64
  #endif

5.2 Interface definition

5.2 インターフェイス定義

   The key expansion routine converts the b-byte secret key, K, into an
   expanded key, S, which is a sequence of T = 2*(R+1) words.  The
   expansion algorithm uses two constants that are derived from the
   constants, e, and phi.  These are used to initialize S, which is then
   modified using K.  A C code procedure header for this routine could
   be:

   鍵拡張ルーチンは、b-byte 暗号鍵 K を拡張鍵 S に変化させ、それは
   一連の T = 2*(R+1) words である。拡張アルゴリズムは、定数 e と phi か
   ら派生された二つの定数を使用する。これらは、S を初期化するために使用さ
   れ、それから K を使用するように変更される。このルーチンのための C コー
   ド手続きヘッダは (次のように出来る):

  /* Expand an RC5 user key.
   */
  /* RC5 ユーザ鍵を拡張する。
   */
  void RC5_Key_Expand (b, K, R, S)
    int      b; /* Byte length of secret key (暗号鍵の Byte 長) */
    char        *K; /* Secret key (暗号鍵) */
    int      R; /* Number of rounds (ラウンド数) */
    RC5_WORD *S;    /* Expanded key buffer, 2*(R+1) words */
                    /* 拡張鍵バッファ、2*(R+1) words */
  {

5.3 Convert secret key from bytes to words

5.3 暗号鍵を bytes から words に変更

   This step converts the b-byte key into a sequence of words stored in
   the array L.  On a little-endian processor this is accomplished by
   zeroing the L array and copying in the b bytes of K.  The following C
   code will achieve this effect on all processors:

   このステップは、b-byte 鍵を配列 L で格納された一連の words に変更させ
   る。little-endian プロセッサで、これは配列 L の要素をゼロにすることと
   K の b byte をコピーすることによって完成される。次の C コードは、すべ
   てのプロセッサでこの結果を成し遂げるだろう。

    int i, j, k, LL, t, T;
    RC5_WORD    L[256/WW];  /* Based on max key size */
                            /* 最大鍵サイズに基づく */
    RC5_WORD    A, B;

    /* LL is number of elements used in L. */
    /* LL は、L で使用される要素数。*/
    LL = (b + WW - 1) / WW;
    for (i = 0 ; i < LL ; i++)  {
        L[i] = 0;
    }
    for (i = 0 ; i < b ; i++)  {
        t = (K[i] & 0xFF) << (8*(i%4)); /* 0, 8, 16, 24*/
        L[i/WW] = L[i/WW] + t;
    }

5.4 Initialize the expanded key table

5.4 拡張鍵テーブルの初期化

   This step fills in the S table with a fixed (key independent)
   pseudo-random pattern using an arithmetic progression based on Pw and
   Qw modulo 2**W.  The element S[i] equals i*Qw + Pw modulo 2**W.  This
   table could be precomputed and copied as needed or computed on the
   fly.  In C code it can be computed by:

   このステップは、Pw と Qw modulo 2**W に基づく算術系列を使用する固定さ
   れた (鍵非依存) 疑似ランダムパターンで S テーブルを書き込む。要素 S[i]
   は、i*Qw + Pw modulo 2**W に等しい。このテーブルは、大急ぎで必要とされ
   るか計算されるとして、前に計算されるかコピーされることが出来る。C コー
   ドで、これは (次のように) 計算されることが出来る:

    T = 2*(R+1);
    S[0] = Pw;
    for (i = 1 ; i < T ; i++)  {
        S[i] = S[i-1] + Qw;
    }

5.5 Mix in the secret key

5.5 暗号鍵を混合

   This step mixes the secret key, K, into the expanded key, S.  First
   the number of iterations of the mixing function, k, is set to three
   times the maximum of the number of initialized elements of L, called
   LL, and the number of elements in S, called T.  Each iteration is
   similar to an interation of the encryption inner loop in that two
   variables A and B are updated by the first and second halves of the
   iteration.

   このステップは、暗号鍵 K を拡張鍵 S に混合する。最初に、混合機能の反復
   数 k は、LL と呼ばれる L の初期化された要素数と T と呼ばれる S での要
   素数との最大値を三倍にセットされる。それぞれの反復は、二変数 A と B が
   反復の最初と二番目の二等分によって更新される暗号化の内側のループの反復
   と同じようである。

   Initially A and B are zero as are the indexes into the S array, i,
   and the L array, j.  In the first half of the iteration, a partial
   result is computed by summing S[i], A and B.  The new value for A is
   this partial result rotated left three bits.  The A value is then
   placed into S[i].  The second half of the iteration computes a second
   partial result that is the sum of L[j], A and B.  The second partial
   result is then rotated left by A+B bit positions and set to be the
   new value for B.  The new B value is then placed into L[j].  At the
   end of the iteration, i and j are incremented modulo the size of
   their respective arrays.  In C code:

   初めに、S 配列 i へのインデックスと L 配列 j へのインデックスとして A
   と B はゼロにされる。最初の反復の半分で、部分的な結果は S[i]、A と B
   を足すことによって計算される。A についての新しい値は、3 bits 左循環で
   の部分的結果である。A 値は、それから S[i] に置き換えられる。二番目の反
   復の半分は、L[j], A と B の合計である二番目の部分的結果を計算する。二
   番目の部分的結果は、それから A + B bit 位置左循環され、B について新し
   い値にセットされる。新しい B 値は、それから L[j] に置き換えられる。反
   復の最後で、i と j はそれぞれの配列 modulo サイズに増やされる。

    i = j = 0;
    A = B = 0;
    if (LL > T)
        k = 3 * LL; /* Secret key len > expanded key. */
                    /* 暗号鍵長 > 拡張鍵 */
    else
        k = 3 * T;  /* Secret key len < expanded key. */
                    /* 暗号鍵長 < 拡張鍵 */
    for ( ; k > 0 ; k--)  {
        A = ROTL(S[i] + A + B, 3, W);
        S[i] = A;
        B = ROTL(L[j] + A + B, A + B, W);
        L[j] = B;
        i = (i + 1) % T;
        j = (j + 1) % LL;
    }
    return;
  } /* End of RC5_Key_Expand (RC5_Key_Expand の終わり) */

-------------------------------------------------------------------------

6.  Description of RC5 Block Cipher

6.  RC5 ブロック暗号の記述

   This section describes the RC5 block cipher by explaining the steps
   required to perform an encryption of a single input block.  The
   decryption process is the reverse of these steps so it will not be
   explained.  The RC5 cipher is parameterized by a version number, V, a
   round count, R, and a word size in bits, W.  This description
   corresponds to original version of RC5 (V = 16 decimal) and covers
   any positive value for R and the values 16, 32, and 64 for W.

   このセクションは、たった一つの入力ブロックの暗号化をおこなうために必要
   とされるステップを説明することによって、RC5 ブロック暗号を記述する。復
   号プロセスはこれらのプロセスの逆であるので、説明されない。RC5 暗号は、
   バージョン数 V、ラウンド数 R と bits での word サイズ W によって、パラ
   メータ化される。この記述は、RC5 のオリジナルバージョン (10 進での
   V = 16) に相当し、R のためのどんな正の数や W のための値 16, 32 と 64
   も扱う。

   The inputs to this process are the expanded key table, S, the number
   of rounds, R, the input buffer pointer, in, and the output buffer
   pointer, out.  A possible C code procedure header for this would be:

   このプロセスへの入力は、拡張テーブル S、ラウンド数 R、入力バッファポイ
   ンタ in、出力バッファポインタ out である。このための可能な C コード手
   続きヘッダは:

  void RC5_Block_Encrypt (S, R, in, out)
    RC5_WORD    *S;
    int  R;
    char    *in;
    char    *out;
  {

6.1 Loading A and B values

6.1 A と B 値のロード

   This step converts input bytes into two unsigned integers called A
   and B.  When RC5 is used as a 64 bit block cipher A and B are 32 bit
   values.  The first input byte becomes the least significant byte of
   A, the fourth input byte becomes the most significant byte of A, the
   fifth input byte becomes the least significant byte of B and the last
   input byte becomes the most significant byte of B.  This conversion
   can be very efficient for little-endian processors such as the Intel
   family.  In C code this could be expressed as:

   このステップは、入力 bytes を A と B と呼ぶ二つの符合なし整数に変換す
   る。RC5 が 64 bit ブロック暗号として使用される時、A と B は 32 bit 値
   である。最初の入力 byte は、A の least significant byte になる。五番目
   の入力 byte は、B の least significant byte となり、最後の入力 byte は
   B の most significant byte となる。この変換は、Intel family のような
   little-endian プロセッサのために、たいへん能率的になることが出来る。C
   コードで、これは (次のように) 表現されることが出来る:

    int  i;
    RC5_WORD    A, B;

    A  =  in[0] & 0xFF;
    A += (in[1] & 0xFF) << 8;
    A += (in[2] & 0xFF) << 16;
    A += (in[3] & 0xFF) << 24;
    B  =  in[4] & 0xFF;
    B += (in[5] & 0xFF) << 8;
    B += (in[6] & 0xFF) << 16;
    B += (in[7] & 0xFF) << 24;

6.2 Iterating the round function

6.2 ラウンド機能の繰り返し

   This step mixes the expanded key with the input to perform the
   fundamental encryption operation.  The first two words of the
   expanded key are added to A and B respectively, and then the round
   function is repeated R times.

   このステップは、基本的な暗号化オペレーションをおこなうため、に入力を持
   つ拡張鍵を混合する。最初、拡張鍵の二つの words が A と B それぞれに追
   加され、それからラウンド機能が R 回繰り返される。

   The first half of the round function computes a new value for A based
   on the values of A, B, and the next unused word in the expanded key
   table.  Specifically, A is XOR'ed with B and then this first partial
   result is rotated to the left by an amount specified by B to form the
   second partial result.  The rotation is performed on a W bit boundary
   (i.e., 32 bit rotation for the version of RC5 that has a 64 bit block
   size).  The actual rotation amount only depends on the least
   significant log base-2 of W bits of B.  The next unused word of the
   expanded key table is then added to the second partial result and
   this becomes the new value for A.

   最初のラウンド機能の半分は、A, B と拡張鍵テーブルで次の使用されていな
   い word の値に基づく A について新しい値を計算する。明確に、A は B を用
   いて XOR され、それからこの最初の部分結果は、二番目の部分結果に構成す
   る B によって指定される量によって左に循環される。循環は、W bit 境界で
   おこなわれる (たとえば、64 bit ブロックサイズを持つ RC5 のバージョンの
   ための 32 bit 循環)。実際の循環量は、least significant log base-2 の B
   の W bits のみに依存する。拡張鍵テーブルの次の使用されない word は、そ
   れから二番目の部分結果に追加され、これは A についての新しい値になる。

   The second half of the round function is identical except the roles
   of A and B are switched. Specifically, B is exclusive or'ed with A
   and then this first partial result is rotated to the left by an
   amount specified by A to form the second partial result.  The next
   unused word of the expanded key table is then added to the second
   partial result and this becomes the new value for B.

   二番目のラウンド機能の半分は、スイッチされる A と B の役割を除いて同一
   である。明確に、B は A とexclusive or され、それからこの最初の部分結果
   が二番目の部分結果を構成する A によって指定された量によって左に循環さ
   れる。拡張鍵テーブルの次の使用されない word が、それから二番目の部分結
   果に追加され、これは B についての新しい値になる。

   One way to express this in C code is:

   C でこれを表現するための一つの方法は、(次の通りである):

    A = A + S[0];
    B = B + S[1];
    for (i = 1 ; i <= R ; i++) {
        A = A ^ B;
        A = ROTL(A, B, W) + S[2*i];
        B = B ^ A;
        B = ROTL(B, A, W) + S[(2*i)+1];
    }

6.3 Storing the A and B values

6.3 A と B の値を格納

   The final step is to convert A and B back into a sequence of bytes.
   This is the inverse of the load operation.  An expression of this in
   C code could be:

   最後のステップは、A と B をもとへ一連の bytes に変換することである。こ
   れはロードオペレーションの逆である。C でのこの表現は、(次の通りにする
   ことが出来る):

    out[0] = (A >>  0) & 0xFF;
    out[1] = (A >>  8) & 0xFF;
    out[2] = (A >> 16) & 0xFF;
    out[3] = (A >> 24) & 0xFF;
    out[4] = (B >>  0) & 0xFF;
    out[5] = (B >>  8) & 0xFF;
    out[6] = (B >> 16) & 0xFF;
    out[7] = (B >> 24) & 0xFF;
    return;
  } /* End of RC5_Block_Encrypt (RC5_Block_Encrypt の終わり) */

-------------------------------------------------------------------------

7.  Description of RC5-CBC and RC5-CBC-Pad

7.  RC5-CBC と RC5-CBC-Pad の記述

   This section describes the CBC and CBC-Pad modes of the RC5 cipher.
   This description is based on the RC5 key objects and RC5 block cipher
   described earlier.

   このセクションは、RC5 暗号の CBC と CBC-Pad モードを記述する。この記述
   は、早くに記述された RC5 鍵オブジェクトと RC5 ブロック暗号に基づく。

7.1 Creating cipher objects

7.1 暗号オブジェクトの生成

   The cipher object needs to keep track of the padding mode, the number
   of rounds, the expanded key, the initialization vector, the CBC
   chaining block, and an input buffer.  A possible structure definition
   for this in C code would be:

   暗号オブジェクトは、パディングモード、ラウンド数、拡張された鍵、初期ベ
   クトル、CBC chaining block と入力バッファを保つ必要がある。C でのこの
   ための可能な構造体定義は、(次のようになる):

  /* Definition of the RC5 CBC algorithm object.
   */
  /* RC5 CBC アルゴリズムオブジェクトの定義。
   */
  typedef struct rc5CBCAlg
  {
    int          Pad;   /* 1 = RC5-CBC-Pad, 0 = RC5-CBC. */
    int          R;     /* Number of rounds (ラウンド数). */
    RC5_WORD        *S;     /* Expanded key (拡張された鍵). */
    unsigned char    I[BB]; /* Initialization vector (初期ベクトル). */
    unsigned char    chainBlock[BB];
    unsigned char    inputBlock[BB];
    int          inputBlockIndex; /* Next inputBlock byte. */
                                  /* 次の inputBlock byte。*/
  } rc5CBCAlg;

   To create a cipher algorithm object, the parameters must be checked
   and then space allocated for the expanded key table.  The expanded
   key is initialized using the method described earlier.  Finally, the
   state variables (padding mode, number of rounds, and the input
   buffer) are set to their initial values.  In C this could be
   accomplished by:

   暗号アルゴリズムオブジェクトを作り出すために、パラメータはチェックされ
   なければならなく、それから場所が拡張された鍵テーブルのために割り当てら
   れる。拡張された鍵は、早くに記述された方法を使用して初期化される。最終
   的に、状態変数 (パディングモード、ラウンド数と入力バッファ) は、それら
   の初期値にセットされる。C で、これは (次のように) 成し遂げられることが
   出来る:

  /* Allocate and initialize the RC5 CBC algorithm object.
   * Return 0 if problems.
   */
  /* RC5 CBC アルゴリズムオブジェクトを割り当て、初期化する。
   * もし問題があるなら、0 を返す。
   */
  rc5CBCAlg *RC5_CBC_Create (Pad, R, Version, bb, I)
    int      Pad;       /* 1 = RC5-CBC-Pad, 0 = RC5-CBC. */
    int      R;         /* Number of rounds (ラウンド数). */
    int      Version;   /* RC5 version number (RC5 バージョン番号). */
    int      bb;        /* Bytes per RC5 block == IV len. */
                        /* RC5 ブロックごとの bytes == IV 長。*/
    char     *I;        /* CBC IV, bb bytes long. */
                        /* CBC IV, bb bytes 長。*/
  {
    rc5CBCAlg    *pAlg;
    int           index;

    if ((Version != RC5_FIRST_VERSION) ||
        (bb != BB) ||   (R < 0) || (255 < R))
        return ((rc5CBCAlg *) 0);
    pAlg = (rc5CBCAlg *) malloc (sizeof(*pAlg));
    if (pAlg == ((rc5CBCAlg *) 0))
        return ((rc5CBCAlg *) 0);
    pAlg->S = (RC5_WORD *) malloc (BB * (R + 1));
    if (pAlg->S == ((RC5_WORD *) 0))    {
        free (pAlg);
        return ((rc5CBCAlg *) 0);
    }
    pAlg->Pad = Pad;
    pAlg->R = R;
    pAlg->inputBlockIndex = 0;
    for (index = 0 ; index < BB ; index++)
        pAlg->I[index] = I[index];
    return (pAlg);
  }

7.2 Destroying cipher objects

7.2 暗号オブジェクトの破壊

   Destroying the cipher object is the inverse of creating it with care
   being take to zero memory before returning it to the memory manager.
   In C this could be accomplished by:

   暗号オブジェクトを破壊することは、それをメモリマネージャに返す前に、メ
   モリをゼロにする注意を持つ生成の逆である。C で、これは (次のように) 成
   し遂げられることが出来る:

  /* Zero and free an RC5 algorithm object.
   */
  /* RC5 アルゴリズムオブジェクトをゼロにし解放する。
   */
  void RC5_CBC_Destroy (pAlg)
    rc5CBCAlg   *pAlg;
  {
    RC5_WORD    *to;
    int      count;

    if (pAlg == ((rc5CBCAlg *) 0))
        return;
    if (pAlg->S == ((RC5_WORD *) 0))
        return;
    to = pAlg->S;
    for (count = 0 ; count < (1 + pAlg->R) ; count++)
    {
        *to++ = 0;  /* Two expanded key words per round. */
                    /* ラウンドごとの二つの拡張された鍵 words。*/
        *to++ = 0;
    }
   free (pAlg->S);
    for (count = 0 ; count < BB ; count++)
    {
        pAlg->I[count] = (unsigned char) 0;
        pAlg->inputBlock[count] = (unsigned char) 0;
        pAlg->chainBlock[count] = (unsigned char) 0;
    }
    pAlg->Pad = 0;
    pAlg->R = 0;
    pAlg->inputBlockIndex = 0;
    free (pAlg);
  }

7.3 Setting the IV for cipher objects

7.3 暗号オブジェクトのために IV をセット

   For CBC cipher objects, the state of the algorithm depends on the
   expanded key, the CBC chain block, and any internally buffered input.
   Often the same key is used with many messages that each have a unique
   initialization vector.  To avoid the overhead of creating a new
   cipher object, it makes more sense to provide an operation that
   allows the caller to change the initialization vector for an existing
   cipher object.  In C this could be accomplished by the following
   code:

   CBC 暗号オブジェクトのために、アルゴリズムの状態は、拡張鍵、CBC chain
   block とどんな内部のバッファされた入力に依存する。しばしば、同じ鍵は、
   一意の初期ベクトルを持つそれぞれの多くのメッセージで使用される。新しい
   暗号オブジェクトを生成するオーバヘッドを避けるために、これは多くの場面
   に、呼び出し側に存在する暗号オブジェクトのために初期ベクトル変更するの
   を許すオペレーションを提供させる。C で、これは次のコードによって成し遂
   げられることが出来る:

  /* Setup a new initialization vector for a CBC operation
   * and reset the CBC object.
   * This can be called after Final without needing to
   * call Init or Create again.
   * Return zero if problems.
   */
  /* CBC オペレーションのために、新しい初期ベクトルをセットアップし
   * CBC オブジェクトをリセットする。
   * これは、再び Init や Create を呼ぶ必要なしに Final の後で、呼ばれる
   * ことが出来る。
   */
  int RC5_CBC_SetIV (pAlg, I)
    rc5CBCAlg   *pAlg;
    char        *I;     /* CBC Initialization vector, BB bytes. */
                        /* CBC 初期ベクトル, BB bytes。*/
  {
    int     index;

    pAlg->inputBlockIndex = 0;
    for (index = 0 ; index < BB ; index++)
    {
        pAlg->I[index] = pAlg->chainBlock[index] = I[index];
        pAlg->inputBlock[index] = (unsigned char) 0;
    }
    return (1);
  }

7.4 Binding a key to a cipher object

7.4 鍵を暗号オブジェクトに結び付け

   The operation that binds a key to a cipher object performs the key
   expansion.  Key expansion could be an operation on keys, but that
   would not work correctly for ciphers that modify the expanded key as
   they operate.  After expanding the key, this operation must
   initialize the CBC chain block from the initialization vector and
   prepare the input buffer to receive the first character.  In C this
   could be done by:

   鍵を暗号オブジェクトに結び付けるオペレーションは、鍵拡張をおこなう。鍵
   拡張は、鍵でのオペレーションであることが出来るが、それらの操作として拡
   張鍵を変更する暗号のために正しく働かないだろう。鍵を拡張した後に、この
   オペレーションは、初期ベクトルから CBC chain block を初期化しなければ
   ならなく、最初の文字を受け取るための入力バッファを準備しなければならな
   い。C で、これは (次のように) おこなわれることが出来る:

  /* Initialize the encryption object with the given key.
   * After this routine, the caller frees the key object.
   * The IV for this CBC object can be changed by calling
   * the SetIV routine.  The only way to change the key is
   * to destroy the CBC object and create a new one.
   * Return zero if problems.
   */
  /* 与えられた鍵を持つ暗号オブジェクトを初期化。
   * このルーチンの後、呼び出し側は鍵オブジェクトを解放。
   * この CBC オブジェクトのための IV は、SetIV ルーチンを呼ぶことによっ
   * て変更されることが出来る。鍵を変更する唯一の方法は、CBC オブジェクト
   * を破壊し、新しいオブジェクトを生成することである。
   * もし問題があるなら、ゼロを返す。
   */
  int RC5_CBC_Encrypt_Init (pAlg, pKey)
    rc5CBCAlg       *pAlg;
    rc5UserKey  *pKey;
  {
    if ((pAlg == ((rc5CBCAlg *) 0)) ||
        (pKey == ((rc5UserKey *) 0)))
        return (0);
    RC5_Key_Expand (Key->keyLength, pKey->keyBytes,
                    pAlg->R, pAlg->S);
    return (RC5_CBC_SetIV(pAlg, pAlg->I));
  }

7.5 Processing part of a message

7.5 メッセージの一部分を処理

   The encryption process described here uses the Init-Update-Final
   paradigm.  The update operation can be performed on a sequence of
   message parts in order to incrementally produce the ciphertext.
   After the last part is processed, the Final operation is called to
   pick up any plaintext bytes or padding that are buffered inside the
   cipher object.  An appropriate procedure header for this operation
   would be:

   ここで記述される暗号化プロセスは、Init-Update-Final 枠組を使用する。更
   新オペレーションは、増加して暗号文を作り出すために、一連のメッセージ部
   分でおこなわれる。最後の部分が処理された後、暗号オブジェクト内部でバッ
   ファされたどんな平文 bytes やパディングも拾い上げるために、Final オペ
   レーションが呼ばれる。このオペレーションのための適した手続きヘッダは、
   (次の通りである):

  /* Encrypt a buffer of plaintext.
   * The plaintext and ciphertext buffers can be the same.
   * The byte len of the ciphertext is put in *pCipherLen.
   * Call this multiple times passing successive
   * parts of a large message.
   * After the last part has been passed to Update,
   * call Final.
   * Return zero if problems like output buffer too small.
   */
  /* 平文のバッファを暗号化。
   * 平文と暗号文バッファは、等しく出来る。
   * 暗号文の byte 長は、*pCipherLen に置かれる。
   * 大きいメッセージの連続部分をパスするこれを複数回呼ぶ。
   * 最後の部分が Update するのにパスされたあとで、
   * Final を呼ぶ。
   * もし出力バッファが非常に小さいような問題があるなら、ゼロを返す。
   */
  int RC5_CBC_Encrypt_Update (pAlg, N, P,
                              pCipherLen, maxCipherLen, C)
    rc5CBCAlg   *pAlg;      /* Cipher algorithm object. */
                            /* 暗号アルゴリズムオブジェクト。*/
    int          N;         /* Byte length of P (P の byte 長). */
    char        *P;         /* Plaintext buffer (平文バッファ). */
    int         *pCipherLen;/* Gets byte len of C. */
                            /* C の byte 長を得る。*/
    int          maxCipherLen;  /* Size of C (C のサイズ). */
    char        *C;         /* Ciphertext buffer (暗号文バッファ). */
  {

7.5.1   Output buffer size check.

7.5.1   出力バッファサイズチェック

   The first step of plaintext processing is to make sure that the
   output buffer is big enough hold the ciphertext.  The ciphertext will
   be produced in multiples of the block size and depends on the number
   of plaintext characters passed to this operation plus any characters
   that are in the cipher object's internal buffer.  In C code this
   would be:

   平文処理の最初のステップは、出力バッファが暗号文を持つ大きな量を確かめ
   ることである。暗号文は、ブロックサイズの倍数で作り出されるだろうし、暗
   号オブジェクトの内部バッファであるどんな記号も加えてこのオペレーション
   にパスされる平文記号数に依存するだろう。C で、これは (次の通りになるで
   あろう):

    int      plainIndex, cipherIndex, j;

    /* Check size of the output buffer. */
    /* 出力バッファのサイズをチェック。*/
    if (maxCipherLen < (((pAlg->inputBlockIndex+N)/BB)*BB))
    {
        *pCipherLen = 0;
        return (0);
    }

7.5.2   Divide plaintext into blocks

7.5.2   平文をブロックに分割

   The next step is to add characters to the internal buffer until a
   full block has been constructed.  When that happens, the buffer
   pointers are reset and the input buffer is exclusive-or'ed (XORed)
   with the CBC chaining block.  The byte order of the chaining block is
   the same as the input block.  For example, the ninth input byte is
   XOR'ed with the first ciphertext byte.  The result is then passed to
   the RC5 block cipher which was described earlier.  To reduce data
   movement and byte alignment problems, the output of RC5 can be
   directly written into the CBC chaining block.  Finally, this output
   is copied to the ciphertext buffer provided by the user.  Before
   returning, the actual size of the ciphertext is passed back to the
   caller.  In C, this step can be performed by:

   次のステップは、全部のブロックが構成されるまで、内部バッファに記号を加
   えることである。それが起こった時、バッファポインタはリセットされ、入力
   バッファは CBC chaining block で exclusive-or (XOR) される。chaining
   block のバイトオーダは、入力ブロックと同じである。例えば、9 番目の入力
   byte は最初の暗号文 byte で XOR される。この結果は、それから早くに記述
   された RC5 ブロック暗号に渡される。データ移動とアライメント問題を減ら
   すために、RC5 の出力は CBC chaining block に直接書かれることが出来る。
   最終的に、この出力はユーザによって提供された暗号文バッファにコピーされ
   る。(呼び出し側に) 返す前に、暗号文の実際のサイズをもとの呼び出し側に
   渡される。C で、このステップは (次のように) おこなわれることが出来る:

    plainIndex = cipherIndex = 0;
    while (plainIndex < N)
    {
        if (pAlg->inputBlockIndex < BB)
        {
            pAlg->inputBlock[pAlg->inputBlockIndex]
                    = P[plainIndex];
            pAlg->inputBlockIndex++;
            plainIndex++;
        }

        if (pAlg->inputBlockIndex == BB)
        {   /* Have a complete input block, process it. */
            /* 全部の入力ブロックを持ち、それを処理。*/
            pAlg->inputBlockIndex = 0;
            for (j = 0 ; j < BB ; j++)
            {   /* XOR in the chain block. */
                /* chain block で XOR。*/
                pAlg->inputBlock[j] = pAlg->inputBlock[j]
                                 ^ pAlg->chainBlock[j];
            }
            RC5_Block_Encrypt(pAlg->S, pAlg->R
                             pAlg->inputBlock,
                             pAlg->chainBlock);
            for (j = 0 ; j < BB ; j++)
            {   /* Output the ciphertext. */
                /* 暗号文を出力。*/
                C[cipherIndex] = pAlg->chainBlock[j];
                cipherIndex++;
            }
        }
    }
    *pCipherLen = cipherIndex;
    return (1);
  } /* End of RC5_CBC_Encrypt_Update (RC5_CBC_Encrypt_Update の終わり) */

7.6 Final block processing

7.6 最後のブロック処理

   This step handles the last block of plaintext.  For RC5-CBC, this
   step just performs error checking to ensure that the plaintext length
   was indeed a multiple of the block length.  For RC5-CBC-Pad, padding
   bytes are added to the plaintext.  The pad bytes are all the same and
   are set to a byte that represents the number of bytes of padding.
   For example if there are eight bytes of padding, the bytes will all
   have the hexadecimal value 0x08.  There will be between one and BB
   padding bytes, inclusive.  In C code this would be:

   このステップは、平文最後のブロックを扱う。RC5-CBC について、このステッ
   プは、平文長がほんとうにブロック長の倍数であることを確実にするためにエ
   ラーチェックを、ただおこなう。RC5-CBC-Pad のために、パディング byte は
   平文に追加される。パッド bytes は、すべて同じでパディングの bytes 数を
   表す byte にセットされる。例えば、もしパディングの 8 byte があるなら、
   bytes はすべて 16 進数値 0x08 を持つだろう。1 と BB のパディング bytes
   を含んでの間であろう。C コードで、これは (次のようになるだろう):

  /* Produce the final block of ciphertext including any
   * padding, and then reset the algorithm object.
   * Return zero if problems.
   */
  /* どんなパディングも含んで暗号文の最後のブロックを作り出し、
   * それからアルゴリズムオブジェクトをリセットする。
   * もし問題があるなら、ゼロを返す。
   */
  int RC5_CBC_Encrypt_Final (pAlg, pCipherLen, maxCipherLen, C)
    rc5CBCAlg   *pAlg;
    int         *pCipherLen;    /* Gets byte len of C. */
                                /* C の byte 長を得る。*/
    int          maxCipherLen;  /* Len of C buffer (C バッファ長). */
    char        *C;             /* Ciphertext buffer (暗号文バッファ). */
  {
    int     cipherIndex, j;
    int     padLength;

    /* For non-pad mode error if input bytes buffered. */
    /* もし入力 bytes がバッファされて、パッドなしモードエラーのため */
    *pCipherLen = 0;
    if ((pAlg->Pad == 0) && (pAlg->inputBlockIndex != 0))
        return (0);

    if (pAlg->Pad == 0)
        return (1);
    if (maxCipherLen < BB)
        return (0);

    padLength = BB - pAlg->inputBlockIndex;
    for (j = 0 ; j < padLength ; j++)
    {
        pAlg->inputBlock[pAlg->inputBlockIndex]
               = (unsigned char) padLength;
        pAlg->inputBlockIndex++;
    }
    for (j = 0 ; j < BB ; j++)
    {   /* XOR the chain block into the plaintext block. */
        /* chain block を平文ブロックに XOR。*/
        pAlg->inputBlock[j] = pAlg->inputBlock[j]
                             ^ pAlg->chainBlock[j];
    }
    RC5_Block_Encrypt(pAlg->S, pAlg->R,
                      pAlg->inputBlock, pAlg->chainBlock);
    cipherIndex = 0;
    for (j = 0 ; j < BB ; j++)
    {   /* Output the ciphertext. */
        /* 暗号文を出力。*/
        C[cipherIndex] = pAlg->chainBlock[j];
        cipherIndex++;
    }
    *pCipherLen = cipherIndex;

    /* Reset the CBC algorithm object. */
    return (RC5_CBC_SetIV(pAlg, pAlg->I));
  } /* End of RC5_CBC_Encrypt_Final (RC5_CBC_Encrypt_Final の終わり) */

-------------------------------------------------------------------------

8.  Description of RC5-CTS

8.  RC5-CTS の記述

   The Cipher Text Stealing (CTS) mode for block ciphers is described by
   Schneier on pages 195 and 196 of [6].  This mode handles any length
   of plaintext and produces ciphertext whose length matches the
   plaintext length.  The CTS mode behaves like the CBC mode for all but
   the last two blocks of the plaintext.  The following steps describe
   how to handle the last two portions of the plaintext, called Pn-1 and
   Pn, where the length of Pn-1 equals the block size, BB, and the
   length of the last block, Pn, is Ln bytes.  Notice that Ln ranges
   from 1 to BB, inclusive, so Pn could in fact be a complete block.

   ブロック暗号として Cipher Text Stealing (STL) モードは、[6] の 195 と
   196 ページで Schneier によって記述される。このモードは、どんな平文の長
   さも扱い、平文長にマッチする長さの暗号文を作り出す。CTS モードは、平文
   の最後の二ブロックの他はみな CBC モードのようにふるまう。次のステップ
   は、どのように平文の Pn-1 と Pn と呼ばれる最後の二つの部分を扱うかを記
   述する。Pn-1 の長さはブロックサイズ BB に等しく、最後のブロック Pn の
   長さは Ln bytes である。Ln は 1 から BB のそれを含んでの範囲であり、Pn
   は実際に全部のブロックであることが出来るということに気がつきなさい。

   1. Exclusive-or Pn-1 with the previous ciphertext
      block, Cn-2, to create Xn-1.

   2. Encrypt Xn-1 to create En-1.

   3. Select the first Ln bytes of En-1 to create Cn.

   4. Pad Pn with zeros at the end to create P of length BB.

   5. Exclusive-or En-1 with P to create to create Dn.

   6. Encrypt Dn to create Cn-1

   7. The last two parts of the ciphertext are Cn-1 and
      Cn respectively.


   1. Xn-1 を作り出すために、前の暗号文ブロック Cn-2 と Pn-1 を
      exclusive-or する。

   2. En-1 を作り出すために、Xn-1 を暗号化する。

   3. Cn を作り出すために、En-1 の最初の Ln bytes を選択する。

   4. 長さ BB の P を作り出すために、終わりがゼロの Pn をパッドする。

   5. Dn を作り出すために、P で En-1 を exclusive-or する。

   6. Cn-1 を作り出すために、Dn を暗号化する。

   7. 暗号文の最後の二つの部分が、それぞれ Cn-1 と Cn である。

   To implement CTS encryption, the RC5-CTS object must hold on to
   (buffer) at most 2*BB bytes of plaintext and process them specially
   when the RC5_CTS_Encrypt_Final routine is called.

   CTS 暗号化を実装するために、RC5_CTS_Encrypt_Final ルーチンが呼ばれた時
   RC5-CTS オブジェクトは、平文の多くて 2*BB bytes (バッファに) 持たなけ
   ればならなく、特別にそれらを処理しなければならない。

   The following steps describe how to decrypt Cn-1 and Cn.

   次のステップは、どのように Cn-1 と Cn を復号するかを記述する。

   1. Decrypt Cn-1 to create Dn.

   2. Pad Cn with zeros at the end to create C of length BB.

   3. Exclusive-or Dn with C to create Xn.

   4. Select the first Ln bytes of Xn to create Pn.

   5. Append the tail (BB minus Ln) bytes of Xn to Cn
      to create En.

   6. Decrypt En to create Pn-1.

   7. The last two parts of the plaintext are Pn-1 and
      Pn respectively.


   1. Dn を作り出すために、Cn-1 を復号する。

   2. 長さ BB の C を作り出すために、終わりがゼロの Cn をパッドする。

   3. Xn を作り出すために、C で Dn を exclusive-or する。

   4. Pn を作り出すために、Xn の最初の Ln bytes を選択する。

   5. En を作り出すために、Cn に Xn の後部 (BB 引く Ln) byte を追加。

   6. Pn-1 を作り出すために、En を復号。

   7. 平文の最後の二つの部分が、それぞれ Pn-1 と Pn である。

-------------------------------------------------------------------------

9.  Test Program and Vectors

9.  テストのプログラムとベクトル

   To help confirm the correctness of an implementation, this section
   gives a test program and results from a set of test vectors.

   実装の正確さを確認するのを手伝うために、このセクションはテストプログラ
   ムとテストベクトルのセットからの結果を与える。

9.1 Test Program

9.1 テストプログラム

   The following test program written in C reads test vectors from its
   input stream and writes results on its output stream.  The following
   subsections give a set of test vectors for inputs and the resulting
   outputs.

   C で書かれた次のテストプログラムは、その入力ストリームからテストベクト
   ルを読み込み、その出力ストリームで結果を書き出す。次のサブセクションは
   入力のためのテストベクトルのセットと出力の結果を与える。

  #include 

  #define BLOCK_LENGTH     (8 /* bytes */)
  #define MAX_KEY_LENGTH   (64 /* bytes */)
  #define MAX_PLAIN_LENGTH (128 /* bytes */)
  #define MAX_CIPHER_LENGTH(MAX_PLAIN_LENGTH + BLOCK_LENGTH)
  #define MAX_ROUNDS       (20)
  #define MAX_S_LENGTH     (2 * (MAX_ROUNDS + 1))

  typedef struct test_vector
  {
    int padding_mode;
    int rounds;
    char    keytext[2*MAX_KEY_LENGTH+1];
    int key_length;
    char    key[MAX_KEY_LENGTH];
    char    ivtext[2*BLOCK_LENGTH+1];
    int iv_length;
    char    iv[BLOCK_LENGTH];
    char    plaintext[2*MAX_PLAIN_LENGTH+1];
    int plain_length;
    char    plain[MAX_PLAIN_LENGTH];
    char    ciphertext[2*MAX_CIPHER_LENGTH+1];
    int cipher_length;
    char    cipher[MAX_CIPHER_LENGTH];
    RC5_WORD    S[MAX_S_LENGTH];
  } test_vector;

  void show_banner()
  {
    (void) printf("RC5 CBC Tester.\n");
    (void) printf("Each input line should contain the following\n");
    (void) printf("test parameters separated by a single space:\n");
    (void) printf("- Padding mode flag.  Use 1 for RC5_CBC_Pad, else
  0.\n");
    (void) printf("- Number of rounds for RC5.\n");
    (void) printf("- Key bytes in hexadecimal.  Two characters per
  byte like '01'.\n");
    (void) printf("- IV bytes in hexadecimal.  Must be 16 hex
  characters.\n");
    (void) printf("- Plaintext bytes in hexadecimal.\n");
    (void) printf("An end of file or format error terminates the
  tester.\n");
    (void) printf("\n");
  }

  /* Convert a buffer from ascii hex to bytes.
   * Set pTo_length to the byte length of the result.
   * Return 1 if everything went OK.
   */
  /* ascii hex から bytes に変換する。
   * 結果の byte 長に pTo_length をセットする。
   * もしすべて OK なら、1 を返す。
   */
  int hex_to_bytes (from, to, pTo_length)
    char    *from, *to;
    int     *pTo_length;
  {
    char    *pHex;  /* Ptr to next hex character. */
                    /* 次の hex 記号へのポインタ。*/
    char    *pByte;     /* Ptr to next resulting byte. */
                        /* 次の結果となる byte へのポインタ。*/
    int  byte_length = 0;
    int  value;

    pByte = to;
    for (pHex = from ; *pHex != 0 ; pHex += 2)  {
        if (1 != sscanf(pHex, "%02x", &value))
            return (0);
        *pByte++ = ((char)(value & 0xFF));
        byte_length++;
    }
    *pTo_length = byte_length;
    return (1);
  }

  /* Convert a buffer from bytes to ascii hex.
   * Return 1 if everything went OK.
   */
  int bytes_to_hex (from, from_length, to)
    char    *from, *to;
    int from_length;
  {
    char    *pHex;  /* Ptr to next hex character. */
                    /* 次の hex 記号へのポインタ。 */
    char    *pByte;     /* Ptr to next resulting byte. */
                        /* 次の結果となる byte へのポインタ。*/
    int  value;

    pHex = to;
    for (pByte = from ; from_length > 0 ; from_length--)  {
        value = *pByte++ & 0xFF;
        (void) sprintf(pHex, "%02x", value);
        pHex += 2;
    }
    return (1);
  }

  /* Return 1 if get a valid test vector. */
  /* もし有効なテストベクトルを得たなら、1 を返す。*/
  int get_test_vector(ptv)
    test_vector *ptv;
  {
    if (1 != scanf("%d", &ptv->padding_mode))
        return (0);
    if (1 != scanf("%d", &ptv->rounds))
        return (0);
    if ((ptv->rounds < 0) || (MAX_ROUNDS < ptv->rounds))
        return (0);
    if (1 != scanf("%s", &ptv->keytext))
        return (0);
    if (1 != hex_to_bytes(ptv->keytext, ptv->key,
                         &ptv->key_length))
        return (0);
    if (1 != scanf("%s", &ptv->ivtext))
        return (0);
    if (1 != hex_to_bytes(ptv->ivtext, ptv->iv,
                         &ptv->iv_length))
        return (0);
    if (BLOCK_LENGTH != ptv->iv_length)
        return (0);
    if (1 != scanf("%s", &ptv->plaintext))
        return (0);
    if (1 != hex_to_bytes(ptv->plaintext, ptv->plain,
                         &ptv->plain_length))
        return (0);
    return (1);
  }

  void run_test (ptv)
    test_vector *ptv;
  {
    rc5UserKey  *pKey;
    rc5CBCAlg       *pAlg;
    int          numBytesOut;

    pKey = RC5_Key_Create ();
    RC5_Key_Set (pKey, ptv->key_length, ptv->key);

    pAlg = RC5_CBC_Create (ptv->padding_mode,
                    ptv->rounds,
                    RC5_FIRST_VERSION,
                    BB,
                    ptv->iv);
    (void) RC5_CBC_Encrypt_Init (pAlg, pKey);
    ptv->cipher_length = 0;
    (void) RC5_CBC_Encrypt_Update (pAlg,
                    ptv->plain_length, ptv->plain,
                    &(numBytesOut),
                    MAX_CIPHER_LENGTH - ptv->cipher_length,
                    &(ptv->cipher[ptv->cipher_length]));

    ptv->cipher_length += numBytesOut;
    (void) RC5_CBC_Encrypt_Final (pAlg,
                    &(numBytesOut),
                    MAX_CIPHER_LENGTH - ptv->cipher_length,
                    &(ptv->cipher[ptv->cipher_length]));
    ptv->cipher_length += numBytesOut;
    bytes_to_hex (ptv->cipher, ptv->cipher_length,
                 ptv->ciphertext);
    RC5_Key_Destroy (pKey);
    RC5_CBC_Destroy (pAlg);
  }

  void show_results (ptv)
    test_vector *ptv;
  {
    if (ptv->padding_mode)
        printf ("RC5_CBC_Pad ");
    else
        printf ("RC5_CBC     ");
    printf ("R = %2d ", ptv->rounds);
    printf ("Key = %s ", ptv->keytext);
    printf ("IV = %s ", ptv->ivtext);
    printf ("P = %s ", ptv->plaintext);
    printf ("C = %s", ptv->ciphertext);
    printf ("\n");
  }

  int main(argc, argv)
    int argc;
    char *argv[];
  {
    test_vector tv;
    test_vector *ptv = &tv;

    show_banner();
    while (get_test_vector(ptv))  {
        run_test(ptv);
        show_results(ptv);
    }
    return (0);
  }

9.2 Test vectors

9.2 テストベクトル

   The following text is an input file to the test program presented in
   the previous subsection.  The output is given in the next subsection.

   次のテキストは、前のサブセクションで表された、テストプログラムへの入力
   ファイルである。出力は、次のサブセクションで与えられる。

  0 00 00                 0000000000000000 0000000000000000
  0 00 00                 0000000000000000 ffffffffffffffff
  0 00 00                 0000000000000001 0000000000000000
  0 00 00                 0000000000000000 0000000000000001
  0 00 00                 0102030405060708 1020304050607080
  0 01 11                 0000000000000000 0000000000000000
  0 02 00                 0000000000000000 0000000000000000
  0 02 00000000           0000000000000000 0000000000000000
  0 08 00                 0000000000000000 0000000000000000
  0 08 00                 0102030405060708 1020304050607080
  0 12 00                 0102030405060708 1020304050607080
  0 16 00                 0102030405060708 1020304050607080
  0 08 01020304           0000000000000000 ffffffffffffffff
  0 12 01020304           0000000000000000 ffffffffffffffff
  0 16 01020304           0000000000000000 ffffffffffffffff
  0 12 0102030405060708   0000000000000000 ffffffffffffffff
  0 08 0102030405060708   0102030405060708 1020304050607080
  0 12 0102030405060708   0102030405060708 1020304050607080
  0 16 0102030405060708   0102030405060708 1020304050607080
  0 08 01020304050607081020304050607080
                          0102030405060708 1020304050607080
  0 12 01020304050607081020304050607080
                          0102030405060708 1020304050607080
  0 16 01020304050607081020304050607080
                          0102030405060708 1020304050607080

  0 12 0102030405         0000000000000000 ffffffffffffffff
  0 08 0102030405         0000000000000000 ffffffffffffffff
  0 08 0102030405         7875dbf6738c6478 0808080808080808
  1 08 0102030405         0000000000000000 ffffffffffffffff

  0 08 0102030405         0000000000000000 0000000000000000
  0 08 0102030405         7cb3f1df34f94811 1122334455667701

  1 08 0102030405         0000000000000000
  ffffffffffffffff7875dbf6738c647811223344556677

9.3 Test results

9.3 テスト結果

   The following text is the output produced by the test program run on
   the inputs given in the previous subsection.

   次のテキストは、前のサブセクションで与えられた入力で走る、テストプログ
   ラムによって作り出された出力である。

  RC5 CBC Tester.
  Each input line should contain the following
  test parameters separated by a single space:
  - Padding mode flag.  Use 1 for RC5_CBC_Pad, else 0.
  - Number of rounds for RC5.
  - Key bytes in hexadecimal.  Two characters per byte
    like '01'.
  - IV bytes in hexadecimal.  Must be 16 hex characters.
  - Plaintext bytes in hexadecimal.
  An end of file or format error terminates the tester.

  RC5 CBC テスター。
  それぞれの入力行は、空白文字によって分けられた次のテストパラメータを含
  むべきである。
  - パディングモードフラグ。RC5_CBC_Pad のために 1 を使用し、そうでなけれ
    ば 0。
  - RC5 のためのラウンド数。
  - 16 進数での鍵 bytes。'01' のように byte ごとに二つの記号。
  - 16 進数での IV bytes。16 hex 文字でなければならない。
  - 16 進数での平文 bytes。
  ファイルの終わりや形式エラーは、テスターを終える。

  RC5_CBC     R =  0 Key = 00 IV = 0000000000000000
   P = 0000000000000000 C = 7a7bba4d79111d1e
  RC5_CBC     R =  0 Key = 00 IV = 0000000000000000
   P = ffffffffffffffff C = 797bba4d78111d1e
  RC5_CBC     R =  0 Key = 00 IV = 0000000000000001
   P = 0000000000000000 C = 7a7bba4d79111d1f
  RC5_CBC     R =  0 Key = 00 IV = 0000000000000000
   P = 0000000000000001 C = 7a7bba4d79111d1f
  RC5_CBC     R =  0 Key = 00 IV = 0102030405060708
   P = 1020304050607080 C = 8b9ded91ce7794a6
  RC5_CBC     R =  1 Key = 11 IV = 0000000000000000
   P = 0000000000000000 C = 2f759fe7ad86a378
  RC5_CBC     R =  2 Key = 00 IV = 0000000000000000
   P = 0000000000000000 C = dca2694bf40e0788
  RC5_CBC     R =  2 Key = 00000000 IV = 0000000000000000
   P = 0000000000000000 C = dca2694bf40e0788
  RC5_CBC     R =  8 Key = 00 IV = 0000000000000000
   P = 0000000000000000 C = dcfe098577eca5ff
  RC5_CBC     R =  8 Key = 00 IV = 0102030405060708
   P = 1020304050607080 C = 9646fb77638f9ca8
  RC5_CBC     R = 12 Key = 00 IV = 0102030405060708
   P = 1020304050607080 C = b2b3209db6594da4
  RC5_CBC     R = 16 Key = 00 IV = 0102030405060708
   P = 1020304050607080 C = 545f7f32a5fc3836
  RC5_CBC     R =  8 Key = 01020304 IV = 0000000000000000
   P = ffffffffffffffff C = 8285e7c1b5bc7402
  RC5_CBC     R = 12 Key = 01020304 IV = 0000000000000000
   P = ffffffffffffffff C = fc586f92f7080934
  RC5_CBC     R = 16 Key = 01020304 IV = 0000000000000000
   P = ffffffffffffffff C = cf270ef9717ff7c4
  RC5_CBC     R = 12 Key = 0102030405060708 IV = 0000000000000000
   P = ffffffffffffffff C = e493f1c1bb4d6e8c
  RC5_CBC     R =  8 Key = 0102030405060708 IV = 0102030405060708
   P = 1020304050607080 C = 5c4c041e0f217ac3
  RC5_CBC     R = 12 Key = 0102030405060708 IV = 0102030405060708
   P = 1020304050607080 C = 921f12485373b4f7
  RC5_CBC     R = 16 Key = 0102030405060708 IV = 0102030405060708
   P = 1020304050607080 C = 5ba0ca6bbe7f5fad
  RC5_CBC     R =  8 Key = 01020304050607081020304050607080
   IV = 0102030405060708
   P = 1020304050607080 C = c533771cd0110e63
  RC5_CBC     R = 12 Key = 01020304050607081020304050607080
   IV = 0102030405060708
   P = 1020304050607080 C = 294ddb46b3278d60
  RC5_CBC     R = 16 Key = 01020304050607081020304050607080
   IV = 0102030405060708
   P = 1020304050607080 C = dad6bda9dfe8f7e8
  RC5_CBC     R = 12 Key = 0102030405 IV = 0000000000000000
   P = ffffffffffffffff C = 97e0787837ed317f
  RC5_CBC     R =  8 Key = 0102030405 IV = 0000000000000000
   P = ffffffffffffffff C = 7875dbf6738c6478
  RC5_CBC     R =  8 Key = 0102030405 IV = 7875dbf6738c6478
   P = 0808080808080808 C = 8f34c3c681c99695
  RC5_CBC_Pad R =  8 Key = 0102030405 IV = 0000000000000000
   P = ffffffffffffffff C = 7875dbf6738c64788f34c3c681c99695
  RC5_CBC     R =  8 Key = 0102030405 IV = 0000000000000000
   P = 0000000000000000 C = 7cb3f1df34f94811
  RC5_CBC     R =  8 Key = 0102030405 IV = 7cb3f1df34f94811
   P = 1122334455667701 C = 7fd1a023a5bba217
  RC5_CBC_Pad R =  8 Key = 0102030405 IV = 0000000000000000
   P = ffffffffffffffff7875dbf6738c647811223344556677
   C = 7875dbf6738c64787cb3f1df34f948117fd1a023a5bba217

-------------------------------------------------------------------------

10. Security Considerations

10. セキュリティに関する考察

   <(http://www4.justnet.ne.jp/~sdk/) 吉田さんから頂いた訳>

   The RC5 cipher is relatively new so critical reviews are still being
   performed.  However, the cipher's simple structure makes it easy to
   analyze and hopefully easier to assess its strength.  Reviews so far
   are very promising.

   RC5 暗号は比較的に新しく、入念な review はなお、おこなわれている。しか
   しながら暗号の単純な構造は、解析するのを簡単にさせたり、うまくいけば、
   その強度を評価するのをより簡単にさせる。今までのところでは、展望はたい
   へん見込みがある。

   Early results [1] suggest that for RC5 with a 64 bit block size (32
   bit word size), 12 rounds will suffice to resist linear and
   differential cyptanalysis.  The 128 bit block version has not been
   studied as much as the 64 bit version, but it appears that 16 rounds
   would be an appropriate minimum.  Block sizes less than 64 bits are
   academically interesting but should not be used for cryptographic
   security.  Greater security can be achieved by increasing the number
   of rounds at the cost of decreasing the throughput of the cipher.

   初期の結果 [1] では、64 bit ブロックサイズ (32 bit word サイズ) での
   RC5 について 12 ラウンドは線形と差分暗号解読に耐えるのに十分であると
   提案される。128 bit ブロックバージョンは、64 bit バージョンほど研究さ
   れていないが、しかし 16 ラウンドは適した最小値であろう。64 bits より小
   さいブロックサイズは理論的に興味あるが、しかし暗号学セキュリティのため
   に使用されるべきではない。より強いセキュリティは、ラウンド数を増やすこ
   とによって成し遂げられるが、暗号のスループットを減らすコストにもなる。

   The length of the secret key helps determine the cipher's resistance
   to brute force key searching attacks.  A key length of 128 bits
   should give adequate protection against brute force key searching by
   a well funded opponent for a couple decades [7].  For RC5 with 12
   rounds, the key setup time and data encryption time are the same for
   all key lengths less than 832 bits, so there is no performance reason
   for choosing short keys.  For larger keys, the key expansion step
   will run slower because the user key table, L, will be longer than
   the expanded key table, S.  However, the encryption time will be
   unchanged since it is only a function of the number of rounds.

   暗号鍵の長さは、やみくもな力任せ鍵検索攻撃に対する暗号の抵抗力を決定す
   るのを助ける。128 bits 鍵長は、20 年間 [7]、かなり財源的に余裕がある相
   手によるやみくもな力任せ鍵検索に対して十分な保護を与えるだろう。12 ラ
   ウンドの RC5 について、鍵セットアップ時間とデータ暗号化時間は、832
   bits より小さいすべての鍵長で同じであり、短い鍵を選ぶパフォーマンス上
   の理由はない。より長い鍵のために、鍵拡張ステップはより遅く動作するだろ
   う。なぜならユーザ鍵テーブル L は、拡張された鍵テーブル S より大きいは
   ずだからである。しかしながら、これは全ラウンド数に対して、一度のみの処
   理であるので、暗号化時間は変化されないだろう。

   To comply with export regulations it may be necessary to choose keys
   that only have 40 unknown bits.  A poor way to do this would be to
   choose a simple 5 byte key.  This should be avoided because it would
   be easy for an opponent to pre-compute key searching information.
   Another common mechanism is to pick a 128 bit key and publish the
   first 88 bits.  This method reveals a large number of the entries in
   the user key table, L, and the question of whether RC5 key expansion
   provides adequate security in this situation has not been studied,
   though it may be fine.  A conservative way to conform to a 40 bit
   limitation is to pick a seed value of 128 bits, publish 88 bits of
   this seed, run the entire seed through a hash function like MD5 [4],
   and use the 128 bit output of the hash function as the RC5 key.

   輸出規制に従うために、秘密鍵 40 bits のみを持つ鍵を選ぶことが必要であ
   ろう。これをするための poor な方法は、単純な 5 byte 鍵を選ぶことであろ
   う。これは避けられるべきである。なぜなら鍵検索情報をすでに計算した相手
   にとって、これはやさしいだろうからである。他のありふれたメカニズムは、
   128 bit 鍵を選び、その最初の 88 bits を公開することである。この方法は
   ユーザ鍵テーブルのエントリの大きい数を示し、RC5 鍵拡張がこの状況での十
   分なセキュリティを提供するかどうかという疑問は研究されていないが、もっ
   ともそれは良好だろう。40 bit 制限に従う保守的な方法は、128 bits の
   seed 値を選び、この seed の 88 bits を公開して、MD5[4] のような hash
   関数を通して全体の seed という状態にし、RC5 鍵として hash 関数の 128
   bit 出力を使用することである。

   (訳注: 88 bits は公開して、128 - 88 = 40 bits が秘密鍵となっている。40
          bits の輸出制限に対し、原理的には 128 bits の RC5 暗号鍵を使用
          することが可能となる。)

   In the case of 40 unknown key bits with 88 known key bits (i.e., 88
   salt bits) there should still be 12 or more rounds for the 64 bit
   block version of RC5, otherwise the value of adding salt bits to the
   key is likely to be lost.

   公開鍵 88 bits を持つ秘密鍵 40 bits のケース (すなわち、88 bits をごま
   かして使用する) で、RC5 の 64 bit ブロックバージョンのために、やはり
   12 もしくは多くのラウンドであるべきである。もしそうでなければ、鍵に追
   加する "ごまかしの" bits 値は、価値が失われる可能性がある。

   The lifetime of the key also influences security.  For high security
   applications, the key to any 64 bit block cipher should be changed
   after encrypting 2**32 blocks (2**64 blocks for a 128 bit block
   cipher).  This helps to guard against linear and differential
   cryptanalysis.  For the case of 64 bit blocks, this rule would
   recommend changing the key after 2**40 (i.e. 10**12) bytes are
   encrypted.  See Schneier [6] page 183 for further discussion.

   鍵の生存時間も、セキュリティに影響を与える。高いセキュリティアプリケー
   ションのために、どんな 64 bit ブロック暗号への鍵も、2**32 ブロック
   (128 bit ブロック暗号について 2**64 ブロック) を暗号化した後に変更され
   るべきである。これは、線形と差分暗号解析に対して、防御するのを助ける。
   64 bit ブロックのケースについて、この規則は 2**40 (すなわち、10**12)
   bytes が暗号化された後、鍵を変更することを推奨する。さらに進んだ議論に
   ついて Schneier [6] の 182 ページを参照しなさい。

-------------------------------------------------------------------------

11. ASN.1 Identifiers

   For applications that use ASN.1 descriptions, it is necessary to
   define the algorithm identifier for these ciphers along with their
   parameter block formats.  The ASN.1 definition of an algorithm
   identifier already exists and is listed below for reference.

   ASN.1 記述を使用するアプリケーションのために、パラメータブロック形式と
   一緒にアルゴリズム識別子を定義する必要がある。アルゴリズム識別子 ASN.1
   定義は、すでに存在し参照として下でリストされる。

  AlgorithmIdentifier ::= SEQUENCE {
    algorithm    OBJECT IDENTIFIER,
    parameters   ANY DEFINED BY algorithm OPTIONAL
  }

  The values for the algorithm field are:

  このアルゴリズムフィールドのための値は (次の通りである):

  RC5_CBC  OBJECT IDENTIFIER ::=
    { iso (1) member-body (2) US (840) rsadsi (113549)
      encryptionAlgorithm (3) RC5CBC (8) }

  RC5_CBC_Pad OBJECT IDENTIFIER ::=
  { iso (1) member-body (2) US (840) rsadsi (113549)
    encryptionAlgorithm (3) RC5CBCPAD (9) }

   The structure of the parameters field for these algorithms is given
   below.  NOTE: if the iv field is not included, then the
   initialization vector defaults to a block of zeros whose size depends
   on the blockSizeInBits field.

   これらアルゴリズムのためのパラメータフィールドの構造は、以下のように与
   えられる。注意: もし	iv フィールドが含まれていないなら、それから初期ベ
   クトルは blockSizeInBits フィールドに依存するサイズのゼロのブロックに
   デフォルトとする。

  RC5_CBC_Parameters ::= SEQUENCE {
    version           INTEGER (v1_0(16)),
    rounds            INTEGER (8..127),
    blockSizeInBits   INTEGER (64, 128),
    iv                OCTET STRING OPTIONAL
  }

-------------------------------------------------------------------------

References

参考文献

   [1] Kaliski, Burton S., and Yinqun Lisa Yin, "On Differential and
   Linear Cryptanalysis of the RC5 Encryption Algorithm", In Advances
   in Cryptology - Crypto '95, pages 171-184, Springer-Verlag, New
   York, 1995.

   [2] Rivest, Ronald L., "The RC5 Encryption Algorithm", In
   Proceedings of the Second International Workshop on Fast Software
   Encryption, pages 86-96, Leuven Belgium, December 1994.

   [3] Rivest, Ronald L., "RC5 Encryption Algorithm", In Dr. Dobbs
   Journal, number 226, pages 146-148, January 1995.

   [4] Rivest, Ronald L., "The MD5 Message-Digest Algorithm", RFC
   1321.

   [5] RSA Laboratories, "Public Key Cryptography Standards (PKCS)",
   RSA Data Security Inc.  See ftp.rsa.com.

   [6] Schneier, Bruce, "Applied Cryptography", Second Edition, John
   Wiley and Sons, New York, 1996.  Errata: on page 195, line 13, the
   reference number should be [402].

   [7] Business Software Alliance, Matt Blaze et al., "Minimum Key
   Length for Symmetric Ciphers to Provide Adequate Commercial
   Security", http://www.bsa.org/bsa/cryptologists.html.

   [8] RSA Data Security Inc., "RC5 Reference Code in C", See the web
   site: www.rsa.com, for availability.  Not available with the first
   draft of this document.

-------------------------------------------------------------------------

Authors' Addresses

著者のアドレス

   Robert W. Baldwin
   RSA Data Security, Inc.
   100 Marine Parkway
   Redwood City, CA 94065

   Phone: (415) 595-8782
   Fax:   (415) 595-1873
   EMail: baldwin@rsa.com, or baldwin@lcs.mit.edu


   Ronald L. Rivest
   Massachusetts Institute of Technology
   Laboratory for Computer Science
   NE43-324
   545 Technology Square
   Cambridge, MA 02139-1986

   Phone: (617) 253-5880
   EMail: rivest@theory.lcs.mit.edu

一覧

 RFC 1〜100  RFC 1401〜1500  RFC 2801〜2900  RFC 4201〜4300 
 RFC 101〜200  RFC 1501〜1600  RFC 2901〜3000  RFC 4301〜4400 
 RFC 201〜300  RFC 1601〜1700  RFC 3001〜3100  RFC 4401〜4500 
 RFC 301〜400  RFC 1701〜1800  RFC 3101〜3200  RFC 4501〜4600 
 RFC 401〜500  RFC 1801〜1900  RFC 3201〜3300  RFC 4601〜4700 
 RFC 501〜600  RFC 1901〜2000  RFC 3301〜3400  RFC 4701〜4800 
 RFC 601〜700  RFC 2001〜2100  RFC 3401〜3500  RFC 4801〜4900 
 RFC 701〜800  RFC 2101〜2200  RFC 3501〜3600  RFC 4901〜5000 
 RFC 801〜900  RFC 2201〜2300  RFC 3601〜3700  RFC 5001〜5100 
 RFC 901〜1000  RFC 2301〜2400  RFC 3701〜3800  RFC 5101〜5200 
 RFC 1001〜1100  RFC 2401〜2500  RFC 3801〜3900  RFC 5201〜5300 
 RFC 1101〜1200  RFC 2501〜2600  RFC 3901〜4000  RFC 5301〜5400 
 RFC 1201〜1300  RFC 2601〜2700  RFC 4001〜4100  RFC 5401〜5500 
 RFC 1301〜1400  RFC 2701〜2800  RFC 4101〜4200 

スポンサーリンク

hr要素でwidthプロパティの指定値が正しく反映されない

ホームページ製作・web系アプリ系の製作案件募集中です。

上に戻る