NIST SP 800-38G 日本語訳
英語タイトル : Recommendation for Block Cipher Modes of Operation: Methods for Format-Preserving Encryption日本語タイトル : フォーマット保持暗号化の方式
公開日 : 2016-08-04
原文URL : https://csrc.nist.gov/pubs/sp/800/38/g/upd1/final
翻訳編集 : 自動生成(有志による非公式の日本語訳), 原文取得日 : 2026-10-01, 訳文 : 207 / 207 ブロック
[要約] SP 800-38G は、ブロック暗号の運用モードに関する一連の推奨事項の第7部で、フォーマット保持暗号化(FPE)の方式として FF1 と FF3 を規定します。いずれも承認済みの共通鍵ブロック暗号アルゴリズムを基礎とする運用モードで、モードの仕様、適合性、パラメーターの選択とセキュリティ、セキュリティ目標、tweak、例を扱います。従来の運用モードがビット列を変換するのに対し、本書は承認済みの FPE 方式を提示することを目的としています。
NIST Special Publication 800-38G
NIST Special Publication 800-38G
Recommendation for Block Cipher
ブロック暗号に関する推奨事項
Modes of Operation:
暗号利用モード:
Methods for Format-Preserving Encryption
フォーマット保持暗号化の方式
Morris Dworkin
Morris Dworkin
This publication is available free of charge from: http://dx.doi.org/10.6028/NIST.SP.800-38G
本書は次のURLから無料で入手できます:http://dx.doi.org/10.6028/NIST.SP.800-38G
C O M P U T E R S E C U R I T Y
コンピューターセキュリティ
[NIST のロゴ。公的な標章のため、この非公式サイトには掲載していません。原本 PDF を参照してください。]
NIST Special Publication 800-38G
NIST Special Publication 800-38G
Recommendation for Block Cipher
ブロック暗号に関する推奨事項
Modes of Operation:
暗号利用モード:
Methods for Format-Preserving Encryption
フォーマット保持暗号化の方式
Morris Dworkin
Morris Dworkin
Computer Security Division Information Technology Laboratory
コンピューターセキュリティ部門、情報技術研究所
This publication is available free of charge from: http://dx.doi.org/10.6028/NIST.SP.800-38G
本書は次のURLから無料で入手できます:http://dx.doi.org/10.6028/NIST.SP.800-38G
March 2016
2016年3月
INCLUDES UPDATES AS OF 08-04-2016: PAGE I
2016年8月4日付更新を含む(iページ)
[米国商務省の紋章。公的な標章のため、この非公式サイトには掲載していません。原本 PDF を参照してください。]
U.S. Department of Commerce Penny Pritzker, Secretary
米国商務省 長官 Penny Pritzker
National Institute of Standards and Technology
米国国立標準技術研究所(NIST)
Willie May, Under Secretary of Commerce for Standards and Technology and Director
標準技術担当商務次官兼所長 Willie May
Authority
権限
This publication has been developed by NIST in accordance with its statutory responsibilities under the Federal Information Security Modernization Act (FISMA) of 2014, 44 U.S.C. § 3541 et seq., Public Law (P.L.) 113-283. NIST is responsible for developing information security standards and guidelines, including minimum requirements for federal information systems, but such standards and guidelines shall not apply to national security systems without the express approval of appropriate federal officials exercising policy authority over such systems. This guideline is consistent with the requirements of the Office of Management and Budget (OMB) Circular A-130.
本書は、2014年連邦情報セキュリティ近代化法(FISMA)、合衆国法典第44編第3541条以下、ならびに公法(P.L.)113-283に基づく法定責任に従ってNISTが作成しました。NISTは、連邦情報システムに対する最低要件を含む情報セキュリティ標準およびガイドラインを策定する責任を負います。ただし、適切な政策権限を行使する連邦政府職員の明示的な承認がない限り、これらの標準およびガイドラインは国家安全保障システムには適用されません。本ガイドラインは、行政管理予算局(OMB)通達A-130の要件に整合しています。
Nothing in this publication should be taken to contradict the standards and guidelines made mandatory and binding on federal agencies by the Secretary of Commerce under statutory authority. Nor should these guidelines be interpreted as altering or superseding the existing authorities of the Secretary of Commerce, Director of the OMB, or any other federal official. This publication may be used by nongovernmental organizations on a voluntary basis and is not subject to copyright in the United States. Attribution would, however, be appreciated by NIST.
本書のいかなる記述も、法定権限に基づき商務長官が連邦機関に義務付け、拘束力を持たせた標準およびガイドラインに反すると解釈してはなりません。また、本ガイドラインは、商務長官、OMB長官、その他の連邦政府職員が既に有する権限を変更または置き換えるものと解釈してはなりません。本書は非政府組織が任意に利用でき、米国内では著作権の対象となりません。ただし、NISTの出典を明記することが望まれます。
National Institute of Standards and Technology Special Publication 800-38G Natl. Inst. Stand. Technol. Spec. Publ. 800-38G, 28 pages (March 2016) CODEN: NSPUE2
米国国立標準技術研究所 特別刊行物800-38G Natl. Inst. Stand. Technol. Spec. Publ. 800-38G、28ページ(2016年3月) CODEN: NSPUE2
This publication is available free of charge from: http://dx.doi.org/10.6028/NIST.SP.800-38G
本書は次のURLから無料で入手できます:http://dx.doi.org/10.6028/NIST.SP.800-38G
原本PDFの抜粋画像

Comments on this publication may be submitted to: National Institute of Standards and Technology Attn: Computer Security Division, Information Technology Laboratory 100 Bureau Drive (Mail Stop 8930) Gaithersburg, MD 20899-8930 Email: encryptionmodes@nist.gov
本書に関する意見は、次の宛先に提出できる:米国国立標準技術研究所、情報技術研究所コンピューターセキュリティ部門宛、100 Bureau Drive(Mail Stop 8930), Gaithersburg, MD 20899-8930 メール:encryptionmodes@nist.gov
NOTE: August 4, 2016 – Although it was included in the draft of 800-38G posted for public comment on July 8, 2013, the following statement was unintentionally omitted when the final version was published in March 2016:
注:2016年8月4日 — 2013年7月8日にパブリックコメント用として公開されたSP 800-38Gの草案には含まれていたものの、2016年3月の最終版の公開時に次の記述が誤って欠落していました。
“It is possible that implementation of modes included in this NIST Recommendation may involve an invention covered by patent rights. By publication of this Special Publication, no position is taken with respect to the validity, scope or enforceability of any claim(s) of any such patent rights in connection with such implementation. If a patent holder has filed with NIST a Letter of Assurance (LOA) with respect to any such patent rights, a copy of that LOA may be obtained from NIST.”
「本NIST推奨事項に含まれる方式を実装する際、特許権の対象となる発明が関係する可能性があります。本特別刊行物の公開によって、そのような特許権に関する請求項の有効性、範囲、または執行可能性について、いかなる見解も示すものではありません。特許権者が当該特許権に関する保証書(LOA)をNISTに提出している場合、その写しはNISTから入手できます。」
Reports on Computer Systems Technology
コンピューターシステム技術に関する報告書
The Information Technology Laboratory (ITL) at the National Institute of Standards and Technology (NIST) promotes the U.S. economy and public welfare by providing technical leadership for the Nation’s measurement and standards infrastructure. ITL develops tests, test methods, reference data, proof of concept implementations, and technical analyses to advance the development and productive use of information technology. ITL’s responsibilities include the development of management, administrative, technical, and physical standards and guidelines for the cost-effective security and privacy of other than national security-related information in federal information systems. The Special Publication 800-series reports on ITL’s research, guidelines, and outreach efforts in information system security, and its collaborative activities with industry, government, and academic organizations.
米国国立標準技術研究所(NIST)の情報技術研究所(ITL)は、米国の計測・標準基盤に技術的リーダーシップを提供し、米国経済と社会福祉の向上を促進しています。ITLは、情報技術の発展と有効利用を推進するため、試験、試験方法、参照データ、概念実証実装、技術分析を開発します。ITLの責務には、国家安全保障に関係しない連邦情報システムの情報セキュリティとプライバシーを費用対効果よく確保するための、管理、事務、技術、物理に関する標準およびガイドラインの策定が含まれます。特別刊行物800シリーズは、情報システムセキュリティに関するITLの研究、ガイドライン、普及活動、および産業界、政府、学術機関との協働活動を報告するものです。
Abstract
概要
This Recommendation specifies two methods, called FF1 and FF3, for format-preserving encryption. Both of these methods are modes of operation for an underlying, approved symmetric-key block cipher algorithm.
本推奨事項は、フォーマット保持暗号化の方式としてFF1およびFF3という2つの方式を規定します。いずれも、承認済みの共通鍵ブロック暗号アルゴリズムを基礎とする運用モードです。
Keywords
キーワード
Block cipher; confidentiality; encryption; FF1; FF3; format-preserving encryption; information security; mode of operation.
ブロック暗号、機密性、暗号化、FF1、FF3、フォーマット保持暗号化、情報セキュリティ、運用モード。
Acknowledgements
謝辞
The author gratefully acknowledges the designers of the two algorithms that are specified in this publication: 1) Mihir Bellare, Phil Rogaway, and Terence Spies; and 2) Eric Brier, Thomas Peyrin, and Jacques Stern. The author also wishes to thank his colleagues who reviewed drafts of this publication and contributed to its development, especially Elaine Barker, Lily Chen, John Kelsey, Meltem Somnez Turan, Kerry McKay, Allen Roginsky, Larry Bassham, Ray Perlner, Rene Peralta, Jim Foti, Sara Kerman, Andy Regenscheid, Bill Burr, and Tim Polk. The author also acknowledges the comments from the public and private sectors to improve the quality of this publication.
本書で規定する2つのアルゴリズムの設計者、すなわち1) Mihir Bellare、Phil Rogaway、Terence Spies、および2) Eric Brier、Thomas Peyrin、Jacques Sternに、著者は深く感謝します。また、本書の草案をレビューし、作成に貢献した同僚、とりわけElaine Barker、Lily Chen、John Kelsey、Meltem Somnez Turan、Kerry McKay、Allen Roginsky、Larry Bassham、Ray Perlner、Rene Peralta、Jim Foti、Sara Kerman、Andy Regenscheid、Bill Burr、Tim Polkに謝意を表します。さらに、本書の品質向上に寄せられた官民各部門からの意見にも感謝します。
Conformance Testing
適合性試験
Conformance testing for implementations of the functions that are specified in this publication will be conducted within the framework of the Cryptographic Algorithm Validation Program (CAVP) and the Cryptographic Module Validation Program (CMVP). The requirements on these implementations are indicated by the word “shall.” Some of these requirements may be out-of-scope for CAVP or CMVP validation testing, and thus are the responsibility of entities using, implementing, installing, or configuring applications that incorporate this Recommendation.
本書で規定する関数の実装に対する適合性試験は、暗号アルゴリズム検証プログラム(CAVP)および暗号モジュール検証プログラム(CMVP)の枠組みで実施されます。これらの実装に関する要件は、「shall」という語で示されます。一部の要件はCAVPまたはCMVPの検証試験の対象範囲外である場合があり、その場合は、本推奨事項を組み込んだアプリケーションを使用、実装、インストール、または構成する主体が責任を負います。
Table of Contents
目次
3.2 Acronyms
3.2 略語
List of Figures
図一覧
1 Purpose
1 目的
This publication is the seventh part in a series of Recommendations regarding the modes of operation of block cipher algorithms. The purpose of this part is to provide approved methods for format-preserving encryption (FPE).
本書は、ブロック暗号アルゴリズムの運用モードに関する一連の推奨事項の第7部です。本編の目的は、承認済みのフォーマット保持暗号化(FPE)方式を提示することです。
2 Introduction
2 はじめに
A block cipher mode of operation—or simply, mode—is an algorithm for the cryptographic transformation of data that is based on a block cipher. The previously approved modes for encryption are transformations on binary data, i.e., the inputs and outputs of the modes are bit strings—sequences of ones and zeros. For sequences of non-binary symbols, however, there is no natural and general way for the previously approved modes to produce encrypted data that has the same format.
ブロック暗号の運用モード(単に「モード」ともいう)とは、ブロック暗号に基づくデータの暗号変換アルゴリズムです。従来承認されている暗号化モードは、バイナリデータを変換します。すなわち、モードへの入力と出力は、1と0の並びであるビット列です。一方、非バイナリ記号の列については、従来承認されているモードを使って元と同じ形式の暗号文を生成する一般的かつ自然な方法はありません。
For example, a Social Security number (SSN) consists of nine decimal numerals, so it is an integer that is less than one billion. This integer can be converted to a bit string as input to a previously approved mode, but when the output bit string is converted back to an integer, it may be greater than one billion, which would be too long for an SSN.
たとえば、社会保障番号(SSN)は9個の10進数字で構成されるため、10億未満の整数です。この整数をビット列に変換して従来承認されているモードへの入力にできますが、出力されたビット列を整数に戻すと10億を超える場合があり、その値はSSNとしては桁数が多すぎることになります。
Format-preserving encryption (FPE) is designed for data that is not necessarily binary. In particular, given any finite set of symbols, like the decimal numerals, a method for FPE transforms data that is formatted as a sequence of the symbols in such a way that the encrypted form of the data has the same format, including the length, as the original data. Thus, an FPE-encrypted SSN would be a sequence of nine decimal digits.
フォーマット保持暗号化(FPE)は、必ずしもバイナリ形式ではないデータを対象とします。特に、10進数字のような任意の有限の記号集合が与えられた場合、FPE方式は、その記号列として表現されたデータを変換し、暗号化後のデータが元データと同じ形式(長さを含む)になるようにします。したがって、FPEで暗号化したSSNも9桁の10進数字の列となります。
FPE facilitates the targeting of encryption to sensitive information, as well as the retrofitting of encryption technology to legacy applications, where a conventional encryption mode might not be feasible. For example, database applications may not support changes to the length or format of data fields. FPE has emerged as a useful cryptographic tool, whose applications include financial-information security, data sanitization1, and the transparent encryption of fields in legacy databases.
FPEを利用すると、機密情報を選択的に暗号化できるほか、従来型の暗号化モードを適用できないレガシーアプリケーションにも暗号化技術を後付けしやすくなります。たとえば、データベースアプリケーションによっては、データフィールドの長さや形式の変更をサポートしていません。FPEは有用な暗号技術として普及しており、金融情報のセキュリティ、データサニタイゼーション1、レガシーデータベースにおけるフィールドの透過的な暗号化などに利用されています。
The two FPE modes specified in this publication are abbreviated FF1 and FF3, to indicate that they are format-preserving, Feistel-based encryption modes. FF1 was submitted to NIST under the name FFX[Radix] in [2]. FF3 is a component of the FPE method that was submitted to NIST under the name BPS in [3]. In particular, FF3 is essentially equivalent to the BPS-BC component of BPS, instantiated with a 128-bit block cipher. The full BPS mode—in particular, its chaining mechanism for longer input strings—is not approved in this publication.
本書が規定する2つのFPEモードは、フォーマットを保持するFeistelベースの暗号化モードであることを示す「FF1」および「FF3」と略記します。FF1は[2]においてFFX[Radix]という名称でNISTに提出されました。FF3は、[3]においてBPSという名称でNISTに提出されたFPE方式の構成要素です。具体的には、FF3は、128ビットブロック暗号を適用したBPSの構成要素BPS-BCと実質的に同等です。より長い入力文字列向けの連鎖機構などを含むBPSモード全体は、本書では承認されていません。
A third mode, FF2—submitted to NIST under the name VAES3—was included in the initial draft of this publication. As part of the public review of Draft NIST Special Publication (SP) 800-38G and as part of its routine consultation with other agencies, NIST was advised by the National Security Agency in general terms that the FF2 mode in the draft did not provide the expected 128 bits of security strength. NIST cryptographers confirmed this assessment via the security analysis in [5] and announced the removal of FF2 in [8]. An extension of the VAES3/FF2 proposal [16] was submitted for NIST’s consideration in November 2015.
FF2という第3のモード(VAES3という名称でNISTに提出)は、本書の初版草案に含まれていました。NISTは、NIST特別刊行物(SP)800-38G草案のパブリックレビューおよび他機関との定例協議の一環として、草案のFF2モードが期待される128ビットのセキュリティ強度を提供しない旨を、国家安全保障局から一般的な形で知らされました。NISTの暗号研究者は[5]のセキュリティ分析によってこの評価を確認し、[8]でFF2の削除を公表しました。VAES3/FF2提案の拡張版[16]は、2015年11月にNISTの検討に付されました。
Each of these FPE modes fits within a larger framework, called FFX, for constructing FPE mechanisms; FFX was submitted to NIST in [1]. The “X” indicates the flexibility to instantiate the framework with different parameter sets, as well as FFX’s evolution from its precursor, the Feistel Finite Set Encryption Mode.
これらのFPEモードはそれぞれ、FPE方式を構成するためのFFXと呼ばれる、より広い枠組みに位置付けられます。FFXは[1]でNISTに提出されました。「X」は、異なるパラメーターセットを使ってこの枠組みを具体化できる柔軟性と、その前身であるFeistel有限集合暗号モードからFFXへ発展したことを表します。
The FFX framework itself is not specified in this publication; in fact, FF1 and FF3 are not presented explicitly as instantiations of FFX parameter sets, but rather as separate algorithms, in order to simplify the individual specifications.
FFX枠組み自体は本書で規定していません。実際、個々の仕様を簡潔にするため、FF1およびFF3はFFXのパラメーターセットを具体化したものとして明示するのではなく、別個のアルゴリズムとして提示しています。
FF1 and FF3 each employ the Feistel structure—see Sec. 4.5—which also underlies the Triple Data Encryption Algorithm (TDEA) [12]. At the core of FF1 and FF3 are somewhat different Feistel round functions that are derived from an approved block cipher with 128-bit blocks, i.e., the Advanced Encryption Standard (AES) algorithm [10].
FF1およびFF3はいずれも、トリプルデータ暗号化アルゴリズム(TDEA)[12]の基礎でもあるFeistel構造(4.5節参照)を採用しています。FF1およびFF3の中核となるラウンド関数は互いに多少異なりますが、いずれも128ビットブロックを使用する承認済みブロック暗号、すなわちAdvanced Encryption Standard(AES)アルゴリズム[10]から導出されます。
In addition to the formatted data for which the modes provide confidentiality, each mode also takes an additional input called the “tweak,” which is not necessarily secret. The tweak can be regarded as a changeable part of the key, because together they determine the encryption and decryption functions. Tweaks that vary can be especially important for implementations of FPE modes, because the number of possible values for the confidential data is often relatively small, as discussed in Appendix A and Appendix C.
各モードは、機密性を提供するフォーマット付きデータに加え、「ツイーク」と呼ばれる追加入力も受け取ります。ツイークは必ずしも秘密である必要はありません。ツイークは鍵の変更可能な部分とみなすことができ、鍵とツイークが組み合わさって暗号化関数と復号関数を決定します。付録Aおよび付録Cで説明するように、機密データが取り得る値の数は比較的少ないことが多いため、FPEモードの実装では変化するツイークが特に重要となり得ます。
FF1 and FF3 offer somewhat different performance advantages. FF1 supports a greater range of lengths for the protected, formatted data, as well as flexibility in the length of the tweak. FF3 achieves greater throughput, mainly because its round count is eight, compared to ten for FF1.
FF1とFF3は、それぞれ異なる性能上の利点を持ちます。FF1は、保護対象のフォーマット付きデータについて、より幅広い長さに対応し、ツイーク長にも柔軟性があります。FF3は、ラウンド数がFF1の10回に対して8回であるため、主にスループットが高いです。
3 Definitions and Notation
3 定義および表記法
3.1 Definitions
3.1 定義
3.1 定義の用語集(3 分割の 1 番目)。用語と定義を 2 列に並べた一覧である。alphabet(アルファベット): 2 個以上の記号からなる有限集合。approved(承認済み): FIPS 承認済みまたは NIST 推奨。1) FIPS または NIST 勧告で規定されている、または 2) 連邦情報処理標準(FIPS)または NIST 勧告で採用されている、アルゴリズムまたは技法。base(基数): 所与のアルファベットに含まれる文字の個数。基数は radix で表す。bit(ビット): 2 進数字、0 または 1。bit string(ビット列): ビットの有限の順序付き列。block(ブロック): 所与のブロック暗号について、長さがそのブロック暗号のブロックサイズに等しいビット列。
3.1 定義の用語集(3 分割の 2 番目)。用語と定義を 2 列に並べた一覧である。block cipher(ブロック暗号): 固定長のビット列上の置換のパラメーター付き族。置換を決めるパラメーターは鍵と呼ぶビット列である。block cipher mode of operation(ブロック暗号の利用モード): ブロック暗号に基づく、データの暗号学的変換のアルゴリズム。block size(ブロックサイズ): 所与のブロック暗号と鍵について、入力(または出力)ビット列の固定長。block string(ブロック列): 長さが所与のブロックサイズの倍数であり、ブロックの有限列の連結として表せるビット列。byte(バイト): 8 ビットの列。byte string(バイト列): 長さが 8 ビットの倍数であり、バイトの有限列の連結として表せるビット列。character(文字): 所与のアルファベット中の記号。character string(文字列): 所与のアルファベットの文字の有限の順序付き列。ciphertext(暗号文): 本書では、平文数字列を暗号化した形の数字列。decryption function(復号関数): 所与のブロック暗号と鍵について、暗号文数字列と tweak を入力とし、対応する平文数字列を出力として返す FPE モードの関数。designated cipher function(指定暗号関数): 所与のブロック暗号と鍵について、順方向変換と逆変換のいずれかを選んだもの。encryption function(暗号化関数): 所与のブロック暗号と鍵について、平文数字列と tweak を入力とし、暗号文数字列を出力として返す FPE モードの関数。exclusive-OR (XOR)(排他的論理和): 同じ長さの 2 つのビット列の、ビットごとの法 2 の加算。Feistel structure(Feistel 構造): 暗号化モードを構成するための枠組み。ラウンドと呼ぶ複数回の反復からなり、各反復ではラウンド関数と呼ぶ鍵付き関数をデータの一方の部分に適用して他方の部分を変更する。次のラウンドでは 2 つの部分の役割を入れ替える。forward transformation(順方向変換): 所与のブロック暗号について、鍵の選択によって決まるブロックの置換。
3.1 定義の用語集(3 分割の 3 番目)と、それに続く 3.2 略語の前半。inverse transformation(逆変換): 所与のブロック暗号について、鍵の選択によって決まるブロックの置換の逆。key(鍵): 所与のブロック暗号について、置換をパラメーター化する秘密のビット列。mode(モード): ブロック暗号の利用モードを参照。numeral(数字): 所与の基数について、その基数未満の非負整数。numeral string(数字列): 所与の基数について、その基数の数字の有限の順序付き列。plaintext(平文): 本書では、FPE モードによって機密性が保護される数字列。prerequisite(前提条件): アルゴリズムの呼出し前に確立されている、アルゴリズムに必須の入力。shall: 求められていること。要件は適合実装に適用される。should: 推奨されていること。tweak: 暗号化関数と復号関数への入力パラメーターのうち、モードによって機密性が必ずしも保護されないもの。見出し: 3.2 略語。AES: Advanced Encryption Standard(高度暗号化標準)。CAVP: 暗号アルゴリズム検証プログラム。CCN: クレジットカード番号。CMVP: 暗号モジュール検証プログラム。FIPS: 連邦情報処理標準。FISMA: 連邦情報セキュリティマネジメント法。FPE: フォーマット保持暗号化。IETF: Internet Engineering Task Force。ITL: 情報技術研究所。NIST: 米国国立標準技術研究所。
PRF — pseudorandom function.
PRF — 擬似ランダム関数。
RFC — Request For Comment.
RFC — コメント募集。
SSN — Social Security number.
SSN — 社会保障番号。
3.3 Operations and Functions
3.3 演算と関数
Examples of most of the following operations and functions are provided in Sec. 4.2.
以下の演算と関数のほとんどについては、4.2節に例を示します。
3.3 演算と関数の記法一覧(2 分割の 1 番目)。記号と意味を 2 列に並べている。BYTELEN(X): バイト列 X のバイト数。CIPH_K(X): 鍵 K の下でのブロック暗号の指定暗号関数をブロック X に適用した出力。LEN(X): 数字列[またはビット列]X の数字[またはビット]の個数。LOG(x): 実数 x > 0 の底 2 の対数。NUM(X): ビットを有効桁の降順で評価したときにビット列 X が表す整数。NUM_radix(X): 数字を有効桁の降順で評価したときに数字列 X が基数 radix で表す数。PRF(X): 関数 PRF をブロック X に適用した出力。PRF は所与の指定暗号関数によって定義される。REV(X): 数字列 X について、X の数字を逆順に並べた数字列。REVB(X): バイト列 X について、X のバイトを逆順に並べたバイト列。STR^m_radix(x): radix^m 未満の非負整数 x について、x を基数 radix の m 個の数字の列として有効桁の降順で表したもの。⌊x⌋: 実数 x を超えない最大の整数。⌈x⌉: 実数 x 以上の最小の整数。[x]^s: 256^s 未満の非負整数 x について、x を s バイトの列として表したもの。[i..j]: 2 つの整数 i と j の間の整数の集合(i と j を含む)。
3.3 演算と関数の記法一覧(2 分割の 2 番目)。x mod m: 整数 x の正の整数 m を法とする非負の剰余。X[i]: 列 X の i 番目の要素。X[i..j]: 列 X の X[i] から X[j] までの部分列(X[i] と X[j] を含む)。X ⊕ Y: ビット長の等しいビット列 X と Y のビットごとの排他的論理和。X || Y: 数字列 X と Y の連結。0^s: s 個の連続する「0」ビットからなるビット列。
4 Preliminaries
4 予備事項
4.1 Representation of Character Strings
4.1 文字列の表現
The data inputs and outputs for FF1 and FF3 are sequences of numbers that can represent both numeric and non-numeric data, as discussed below.
FF1およびFF3へのデータ入力および出力は、以下で述べるとおり、数値データと非数値データのどちらも表現できる数の列です。
A finite set of two or more symbols is called an alphabet. The symbols in an alphabet are called the characters of the alphabet. The number of characters in an alphabet is called the base, denoted by \(\mathit{radix}\); thus, \(\mathit{radix} \ge 2\).
2個以上の記号からなる有限集合をアルファベットと呼びます。アルファベットに含まれる記号を、そのアルファベットの文字と呼びます。アルファベットに含まれる文字の数を基数と呼び、\(\mathit{radix}\)で表します。したがって、\(\mathit{radix} \ge 2\)です。
A character string is a finite sequence of characters from an alphabet; individual characters may repeat in the string. In this publication, character strings (and bit strings) are presented in the Courier New font.
文字列は、アルファベットに属する文字の有限列であり、個々の文字は列内で繰り返し現れてもよいです。本書では、文字列(およびビット列)をCourier Newフォントで示します。
Thus, for the alphabet of lower-case English letters,
したがって、小文字の英字のアルファベットについては、
hello and cannot are character strings, but Hello and can’t are not, because the symbols “H” and “ ’ ” are not in the alphabet.
hello と cannot は文字列ですが、Hello と can’t は、記号「H」および「 ’ 」がアルファベットに含まれないため、文字列ではありません。
SSNs or CCNs can be regarded as character strings in the alphabet of base ten numerals, namely, \(\{0, 1, 2, 3, 4, 5, 6, 7, 8, 9\}\). The notion of numerals is generalized to any given base as follows: the set of base \(\mathit{radix}\) numerals is
SSNまたはCCNは、基数10の数字からなるアルファベット、すなわち\(\{0, 1, 2, 3, 4, 5, 6, 7, 8, 9\}\)の文字列とみなすことができます。数字の概念を任意の基数に一般化すると、基数\(\mathit{radix}\)の数字の集合は次のとおりである:
The data inputs and outputs to the FF1 and FF3 encryption and decryption functions must be finite sequences of numerals, i.e., numeral strings. If the data to be encrypted is formatted in an alphabet that is not already the set of base \(\mathit{radix}\) numerals, then each character must be represented by a distinct numeral in order to apply FF1 or FF3.
FF1およびFF3の暗号化関数と復号関数へのデータ入力および出力は、数字の有限列、すなわち数字列でなければなりません。暗号化対象のデータが、基数\(\mathit{radix}\)の数字集合ではないアルファベットで形式化されている場合、FF1またはFF3を適用するには、各文字をそれぞれ異なる数字で表さなければなりません。
For example, the natural representation of lower-case English letters with base 26 numerals is
例えば、小文字の英字を基数26の数字で自然に表現すると、
The character string hello would then be represented by the numeral string 7 4 11 11 14. Other representations are possible.
この場合、文字列helloは数字列7 4 11 11 14で表されます。他の表現も可能です。
The choice and implementation of a one-to-one correspondence between a given alphabet and the set of base \(\mathit{radix}\) numerals that represents the alphabet is outside the scope of this publication.
所与のアルファベットと、そのアルファベットを表す基数\(\mathit{radix}\)の数字集合との間に一対一対応を選択し、実装することは、本書の適用範囲外です。
In this publication, individual numerals are themselves represented in base ten. In order to display numeral sequences unambiguously when the base is greater than ten, a delimiter between the numerals is required, such as a space (as in the base 26 example above) or a comma.
本書では、個々の数字自体を基数10で表します。基数が10を超える場合に数字列を曖昧さなく表示するには、数字間に区切り文字が必要であり、例えば空白(上述の基数26の例のように)またはコンマを使用します。
FF1 and FF3 use different conventions for interpreting numeral strings as numbers. For FF1, numbers are represented by strings of numerals with decreasing order of significance; for FF3, numbers are represented by strings of numerals in the reverse order, i.e., with increasing order of significance. Algorithms for the functions that convert numeral strings to numbers and vice versa are given in Sec. 4.6.
FF1とFF3では、数字列を数値として解釈する規約が異なります。FF1では、数値は有効桁の降順で並ぶ数字列で表されます。FF3では、逆順、すなわち有効桁の昇順で並ぶ数字列で表されます。数字列を数値に変換する関数およびその逆変換を行う関数のアルゴリズムを4.6節に示します。
4.2 Examples of Basic Operations and Functions
4.2 基本演算および関数の例
Given a positive real number \(x\), the base 2 logarithm of \(x\), denoted by \(\mathrm{LOG}(x)\), is the unique real number for which \(2^{\mathrm{LOG}(x)} = x\). For example, \(\mathrm{LOG}(64) = 6\) and \(\mathrm{LOG}(10) \approx 3.32\).
正の実数\(x\)に対して、\(x\)の底2の対数を\(\mathrm{LOG}(x)\)で表し、\(2^{\mathrm{LOG}(x)} = x\)を満たす一意の実数とします。例えば、\(\mathrm{LOG}(64) = 6\)および\(\mathrm{LOG}(10) \approx 3.32\)です。
Given a real number \(x\), the floor function, denoted by \(\lfloor x \rfloor\), is the greatest integer that does not exceed \(x\). For example, \(\lfloor 2.1 \rfloor = 2\), and \(\lfloor 4 \rfloor = 4\).
実数\(x\)に対して、床関数を\(\lfloor x \rfloor\)で表し、\(x\)を超えない最大の整数とします。例えば、\(\lfloor 2.1 \rfloor = 2\)および\(\lfloor 4 \rfloor = 4\)です。
Given a real number \(x\), the ceiling function, denoted by \(\lceil x \rceil\), is the least integer that is not less than \(x\). For example, \(\lceil 2.1 \rceil = 3\), and \(\lceil 4 \rceil = 4\).
実数\(x\)に対して、天井関数を\(\lceil x \rceil\)で表し、\(x\)以上となる最小の整数とします。例えば、\(\lceil 2.1 \rceil = 3\)および\(\lceil 4 \rceil = 4\)です。
Given two integers \(i\) and \(j\) with \(i \le j\), the set of integers between \(i\) and \(j\), including \(i\) and \(j\), is denoted by \([i\mathrel{..}j]\). For example, \([2\mathrel{..}5] = \{2, 3, 4, 5\}\).
2つの整数\(i\)および\(j\)が\(i \le j\)を満たすとき、\(i\)と\(j\)の間の整数の集合(\(i\)と\(j\)を含む)を\([i\mathrel{..}j]\)で表します。例えば、\([2\mathrel{..}5] = \{2, 3, 4, 5\}\)です。
Given a real number \(x\) and a positive integer \(m\), the remainder of \(x\) modulo \(m\), denoted by \(x \bmod m\), is \(x - m\lfloor x/m \rfloor\). For example, \(-3 \bmod 7 = 4\), and \(13 \bmod 7 = 6\).
実数\(x\)および正の整数\(m\)に対して、\(x\)の\(m\)を法とする剰余を\(x \bmod m\)で表し、\(x - m\lfloor x/m \rfloor\)とします。例えば、\(-3 \bmod 7 = 4\)および\(13 \bmod 7 = 6\)です。
Given a positive integer \(s\), \(\mathtt{0}^s\) denotes the string that consists of \(s\) ‘\(\mathtt{0}\)’ bits. For example, \(\mathtt{0}^8 = \mathtt{00000000}\).
正の整数\(s\)に対し、\(\mathtt{0}^s\)は\(s\)個の「\(\mathtt{0}\)」ビットからなる列を表します。例えば、\(\mathtt{0}^8 = \mathtt{00000000}\)です。
The concatenation operation on bit strings or numeral strings is denoted by \(\parallel\). For example, \(\mathtt{001} \parallel \mathtt{1011} = \mathtt{0011011}\), and \(\mathtt{3\ 1} \parallel \mathtt{31\ 8\ 10} = \mathtt{3\ 1\ 31\ 8\ 10}\).
ビット列または数字列の連結演算を\(\parallel\)で表します。例えば、\(\mathtt{001} \parallel \mathtt{1011} = \mathtt{0011011}\)、および\(\mathtt{3\ 1} \parallel \mathtt{31\ 8\ 10} = \mathtt{3\ 1\ 31\ 8\ 10}\)です。
Given bit strings of equal length, the exclusive-OR (XOR) operation, denoted by \(\oplus\), specifies the addition, modulo 2, of the bits in corresponding bit positions. For example, \(\mathtt{10011} \oplus \mathtt{10101} = \mathtt{00110}\).
同じ長さのビット列に対する排他的論理和(XOR)演算を\(\oplus\)で表し、対応するビット位置のビットを法2で加算する演算とします。例えば、\(\mathtt{10011} \oplus \mathtt{10101} = \mathtt{00110}\)です。
Given a numeral or bit string \(X\), its length is denoted by \(\mathrm{LEN}(X)\). For example, \(\mathrm{LEN}(\mathtt{010}) = 3\).
数字列またはビット列\(X\)の長さを\(\mathrm{LEN}(X)\)で表します。例えば、\(\mathrm{LEN}(\mathtt{010}) = 3\)です。
Given a byte string \(X\)—i.e., a bit string that could be represented as the concatenation of a sequence of bytes—the length of \(X\) in bytes, i.e., \(\mathrm{LEN}(X)/8\), is denoted by \(\mathrm{BYTELEN}(X)\). For example, \(\mathrm{BYTELEN}(\mathtt{1011100110101100}) = 2\).
バイト列\(X\)、すなわちバイトの並びの連結として表現できるビット列に対して、\(X\)のバイト単位の長さ、すなわち\(\mathrm{LEN}(X)/8\)を\(\mathrm{BYTELEN}(X)\)で表します。例えば、\(\mathrm{BYTELEN}(\mathtt{1011100110101100}) = 2\)です。
4.2 基本演算および関数の例(続き)。画像化された 7 つの段落である。数字[ビット]列 X と 1 ≤ i ≤ LEN(X) を満たす添字 i に対して、X の i 番目の数字[ビット]を X[i] で表す。1 ≤ i ≤ j ≤ LEN(X) を満たす添字の組 (i, j) に対して、X[i] から X[j] までの数字[ビット]の部分列を X[i..j] で表す。例えば基数 10 で X = 798137 ならば、X[2] = 9、X[3..5] = 813 である。基数 radix と長さ m が与えられると、radix^m 個の異なる数字列がある。0 ≤ x < radix^m を満たす整数 x に対して、整数から列への関数 STR^m_radix(x) は、数字を有効桁の降順に並べたとき x を表す、基数 radix で長さ m の数字列である。例えば STR^4_12(559) は 559 を表す基数 12 の 4 個の数字の列、すなわち 0 3 10 7 である。STR^m_radix(x) を計算するアルゴリズムを 4.6 節に示す。整数からバイト列への変換には別の記法を用いる。すなわち [x]^s = STR^8s_2(x) である。例えば [1]^1 = 00000001 である。基数 radix で長さ m の(空でない)数字列 X に対して、列から整数への関数 NUM_radix(X) は、X が表す整数 x であり、STR^m_radix(x) = X を満たす。例えば NUM_5(00011010) = 755 である。NUM_radix(X) を計算するアルゴリズムを 4.6 節に示す。ビット列を整数に変換する関数にも同様の記法を用いる。すなわちバイト列 X に対して、NUM(X) は X が表す整数 x であり、[NUM(X)]^BYTELEN(X) = X を満たす。例えば NUM(10000000) = 128 である。NUM(X) を計算するアルゴリズムを 4.6 節に示す。数字列 X に対して、列 REV(X) は X の数字を逆順に並べた列である。例えば基数 10 で REV(13579) = 97531 である。バイト列 X に対して、列 REVB(X) は X のバイトを逆順に並べた列である。例えば REVB([1] || [2] || [3]) = [3] || [2] || [1] である。
4.3 Underlying Block Cipher and Key
4.3 基礎となるブロック暗号および鍵
The encryption and decryption functions of FF1 and FF3 feature a block cipher as the main component; thus, each of these FPE mechanisms is a mode of operation (mode, for short) of the block cipher.
FF1およびFF3の暗号化関数と復号関数では、ブロック暗号が主要な構成要素となります。したがって、各FPE方式は、そのブロック暗号の動作モード(以下、モード)です。
For any given key, \(K\), the underlying block cipher of the mode is a permutation, i.e., an invertible transformation on bit strings of a fixed length; the fixed-length bit strings are called blocks, and the length of a block is called the block size. For an FPE mode, as part of the choice of the underlying block cipher with the key, either the forward transformation or the inverse transformation2 is specified as the designated cipher function, denoted by \(\mathrm{CIPH}_K\). The inverse of \(\mathrm{CIPH}_K\) is not needed for the modes that are specified in this publication.
任意の鍵\(K\)に対して、モードの基礎となるブロック暗号は置換、すなわち固定長ビット列上の可逆変換です。固定長ビット列をブロックと呼び、その長さをブロックサイズと呼びます。FPEモードでは、鍵と基礎となるブロック暗号を選択する際、順変換または逆変換2のいずれかを指定暗号関数として指定し、\(\mathrm{CIPH}_K\)で表します。\(\mathrm{CIPH}_K\)の逆関数は、本書で規定するモードでは必要ありません。
For both of the modes, the underlying block cipher shall be approved, and the block size shall be 128 bits. Currently, the AES block cipher [10], with key lengths of 128, 192, or 256 bits, is the only block cipher that fits this profile.
両モードにおいて、基礎となるブロック暗号は承認済みでなければならず、ブロックサイズは128ビットでなければなりません。現在、この要件に適合するブロック暗号は、鍵長が128、192または256ビットのAESブロック暗号[10]のみです。
The choice of the key length affects the security of the FPE modes, e.g., against brute-force search, and also affects the details of the implementation of the AES algorithm. Otherwise, the key length does not affect the implementation of FF1 and FF3, and the choice of the key length is not explicitly indicated in their specifications. Methods for generating cryptographic keys are discussed in [13]; the goal is to select the keys uniformly at random, i.e., for each possible key to occur with equal probability.
鍵長の選択は、例えば総当たり探索に対するFPEモードの安全性に影響し、AESアルゴリズムの実装の詳細にも影響します。それ以外では、鍵長はFF1およびFF3の実装に影響せず、鍵長の選択はそれらの仕様に明示されていません。暗号鍵の生成方法は[13]で論じられています。目的は鍵を一様ランダムに選択すること、すなわち、各鍵が等しい確率で選ばれるようにすることです。
The key shall be kept secret, i.e., disclosed only to parties that are authorized to know the protected information. Compliance with this requirement is the responsibility of the entities using, implementing, installing, or configuring applications that incorporate the functions that are specified in this publication. The management of cryptographic keys is outside the scope of this publication.
鍵は秘密に保たなければなりません。すなわち、保護対象情報を知る権限を与えられた当事者にのみ開示します。本要件への準拠は、本書に規定された関数を組み込むアプリケーションを使用、実装、設置または構成するエンティティの責任です。暗号鍵の管理は本書の適用範囲外です。
4.4 Encryption and Decryption Functions
4.4 暗号化関数および復号関数
For a given key, denoted by \(K\), for the designated block cipher, FF1 and FF3 each consist of two related functions: encryption and decryption. The inputs to the encryption function are a numeral string called the plaintext, denoted by \(X\), and a byte string, called the tweak, denoted by \(T\); the function returns a numeral string called the ciphertext, denoted by \(Y\), with the same length as \(X\). Similarly, the inputs to the decryption function are a numeral string \(X\) and a tweak \(T\); the output is a numeral string \(Y\) of the same length as \(X\).
指定ブロック暗号の所与の鍵\(K\)に対して、FF1およびFF3はそれぞれ、相互に関連する2つの関数、すなわち暗号化と復号からなります。暗号化関数への入力は、平文と呼ばれ\(X\)で表される数字列、およびtweakと呼ばれ\(T\)で表されるバイト列です。この関数は数字列を返します。これを暗号文と呼び\(Y\)で表し、その長さは\(X\)と同じです。同様に、復号関数への入力は数字列\(X\)とtweak \(T\)であり、出力は数字列\(Y\)であり、その長さは\(X\)と同じです。
For FF1, the encryption function is denoted by \(\mathrm{FF1.Encrypt}(K, T, X)\), and the decryption function is denoted by \(\mathrm{FF1.Decrypt}(K, T, X)\), with analogous notation for FF3.
FF1では暗号化関数を\(\mathrm{FF1.Encrypt}(K, T, X)\)、復号関数を\(\mathrm{FF1.Decrypt}(K, T, X)\)で表します。FF3についても同様の表記を用います。
For a given tweak, the decryption function is the inverse of the encryption function, so that
tweakが所与の場合、復号関数は暗号化関数の逆関数です。したがって、次が成り立ちます。
Thus, when a ciphertext is an input to the decryption function, along with the same tweak that was used to generate the ciphertext, the output is the corresponding plaintext.
したがって、暗号文を生成時と同じtweakとともに復号関数に入力すると、対応する平文が出力されます。
The tweak does not need to be kept secret; often, it is some readily available data that is associated with the plaintext. Although implementations may fix the value of the tweak, the use of variable tweaks is strongly recommended as a security enhancement; see Appendix C. In FF1 and FF3, tweaks are byte strings. The specifications in Sec. 5 include the lengths that can be supported for the tweak, as well as for the plaintext/ciphertext.
tweakを秘密にする必要はありません。多くの場合、平文に関連付けられた容易に入手できるデータです。実装でtweakの値を固定してもよいですが、セキュリティ強化のため、可変tweakの使用を強く推奨します。付録Cを参照してください。FF1およびFF3では、tweakはバイト列です。5節の仕様には、tweakおよび平文/暗号文についてサポート可能な長さも含まれます。
The key, K, is indicated in the above notation as an input for the encryption and decryption functions; however, in the specifications in this publication, the key is listed as a prerequisite, i.e., an input that is usually established prior to the invocation of the function.3 Several other prerequisites are omitted from the above notation, such as the underlying block cipher, the designation of CIPH_K, and the base for the numeral strings.
上記の表記では、鍵Kを暗号化関数および復号関数の入力として示しています。ただし、本書の仕様では、鍵は前提条件、すなわち通常は関数の呼出し前に確立される入力として記載します。3基礎となるブロック暗号、CIPH_Kの指定、数字列の基数など、その他いくつかの前提条件は上記表記から省略されています。
4.5 Feistel Structure
4.5 Feistel構造
FFX schemes, including FF1 and FF3, are based on the Feistel structure. The Feistel structure consists of several iterations, called rounds, of a reversible transformation. The transformation consists of three steps: 1) the data is split into two parts; 2) a keyed function, called the round function, is applied to one part of the data in order to modify the other part of the data; and 3) the roles of the two parts are swapped for the next round. The structure is illustrated in Figure 1 below, for both encryption and decryption. Four rounds are shown in Figure 1, but ten rounds are actually specified for FF1, and eight rounds for FF3.
FF1およびFF3を含むFFX方式は、Feistel構造に基づきます。Feistel構造は、可逆変換を複数回反復する構成であり、各反復をラウンドと呼びます。この変換は3つのステップからなる:1) データを2つの部分に分割する、2) ラウンド関数と呼ばれる鍵付き関数をデータの一方の部分に適用し、もう一方の部分を変更する、3) 次のラウンドに向けて2つの部分の役割を入れ替えます。この構造を、暗号化と復号の両方について以下の図1に示します。図1には4ラウンドを示しますが、FF1では実際には10ラウンド、FF3では8ラウンドが規定されています。
図 1: Feistel 構造。左に暗号化(Encryption)、右に復号(Decryption)の 2 列があり、それぞれ 4 ラウンドを示す。各行は黄色の箱 2 つで、左が u 文字、右が v 文字の部分である。暗号化は A0 | B0 から始まる。各ラウンドでは一方の部分と、ラウンドの入力を示す破線の箱 (n, T, 0)、(n, T, 1)、(n, T, 2)、(n, T, 3) がラウンド関数の箱 F_K に入り、その出力が + の箱で他方の部分と組み合わされる。結果 C は次の行に書かれ、2 つの部分の役割が入れ替わる。ラウンド 1 (n, T, 0): B0 が F_K に入り、A0 に + が適用され、B1 ← C0 | A1 ← B0 となる。ラウンド 2 (n, T, 1): B1 が F_K に入り、右側で + が適用され、A2 ← B1 | B2 ← C1 となる。ラウンド 3 (n, T, 2): B3 ← C2 | A3 ← B2 となる。ラウンド 4 (n, T, 3): A4 ← B3 | B4 ← C3 となる。復号は A4 | B4 から始まり、+ の代わりに − の箱を用いてラウンドを逆順にたどる。(n, T, 3): A4 が F_K に入り、B4 に − が適用され、B3 ← A4 | A3 となる。(n, T, 2): A3 が F_K に入り、左側で − が適用され、A2 | B2 ← A3 となる。(n, T, 1): B1 ← A2 | A1 となる。(n, T, 0): A0 | B0 ← A1 となる。
Figure 1: Feistel Structure
図 1: Feistel 構造
For the encryption function in Figure 1, the rounds are indexed from 0 to 3. The input data (and output data) for each round are two strings of characters—which will be numerals for FF1 and FF3. The lengths of the two strings are denoted by \(u\) and \(v\), and the total number of characters is denoted by \(n\), so that \(u+v=n\). During Round \(i\), the round function, denoted by \(\mathrm{F}_K\), is applied to one of the input strings, denoted by \(B_i\), with the length \(n\), the tweak \(T\), and the round number \(i\) as additional inputs. (In Figure 1, this triple \((n, T, i)\) of additional inputs is indicated within the dotted rectangles, with the appropriate values for \(i\)). The result is used to modify the other string, denoted by \(A_i\), via modular addition4, indicated by \(+\), on the numbers that the strings represent5. The string that represents the resulting number is named with a temporary variable, \(C_i\). The names of the two parts are swapped for the next round, so that the modified \(A_i\), i.e., \(C_i\), becomes \(B_{i+1}\), and \(B_i\) becomes \(A_{i+1}\).
図1の暗号化関数では、ラウンドに0から3までの番号が付けられます。各ラウンドの入力データ(および出力データ)は2つの文字列であり、FF1とFF3では数字列となります。2つの文字列の長さを\(u\)および\(v\)、文字の総数を\(n\)と表します。したがって\(u+v=n\)です。ラウンド\(i\)では、\(\mathrm{F}_K\)で表されるラウンド関数が、入力文字列の一方\(B_i\)に適用されます。このとき、長さ\(n\)、tweak \(T\)、およびラウンド番号\(i\)も追加の入力となります(図1では、この追加入力の三つ組\((n, T, i)\)が、\(i\)の適切な値とともに点線の長方形内に示されている)。その結果を使って、もう一方の文字列\(A_i\)を、法加算4(\(+\)で示す)によって変更します。この加算は、文字列が表す数に対して行う5。得られた数を表す文字列には、一時変数\(C_i\)という名前を付けます。次のラウンドでは2つの部分の名前を入れ替え、変更後の\(A_i\)、すなわち\(C_i\)が\(B_{i+1}\)となり、\(B_i\)が\(A_{i+1}\)となります。
The rectangles containing the two parts of the data have different sizes in order to illustrate that, \(u\) cannot equal \(v\) if \(n\) is odd. In such cases, the round function is constructed so that the lengths of its input and output strings depend on whether the round number index, \(i\), is even or odd.
データの2つの部分を含む長方形の大きさが異なるのは、\(u\)と\(v\)は\(n\)が奇数の場合に等しくなり得ないことを示すためです。そのような場合、ラウンド関数は、入力文字列および出力文字列の長さがラウンド番号インデックス\(i\)の偶奇に応じて変わるように構成されます。
The Feistel structure for decryption is almost identical to the Feistel structure for encryption. There are three differences: 1) the order of the round indices is reversed; 2) the roles of the two parts of the data in the round function are swapped as follows: along with \(n\), \(T\), and \(i\), the input to \(F_K\) is \(A_{i+1}\) (not \(B_i\)), and the output is combined with \(B_{i+1}\) (not \(A_i\)) to produce \(A_i\) (not \(B_{i+1}\)); and 3) modular addition (of the output of \(\mathrm{F}_K\) to \(A_i\)) is replaced by modular subtraction (of the output of \(\mathrm{F}_K\) from \(B_{i+1}\)).
復号のFeistel構造は暗号化のFeistel構造とほぼ同じです。相違点は3つあります。1) ラウンド番号の順序が逆になります。2) ラウンド関数におけるデータの2つの部分の役割が次のように入れ替わります。\(n\)、\(T\)、\(i\)に加えて、\(F_K\)への入力は\(A_{i+1}\)(\(B_i\)ではない)となり、その出力を\(B_{i+1}\)(\(A_i\)ではない)と組み合わせて\(A_i\)(\(B_{i+1}\)ではない)を生成します。3) 法加算(\(\mathrm{F}_K\)の出力を\(A_i\)に加える)は、法減算(\(\mathrm{F}_K\)の出力を\(B_{i+1}\)から引く)に置き換わります。
4.6 Component Functions
4.6 構成関数
This section gives algorithms for the component functions that are called in the specifications of FF1 and FF3. The conversion functions \(\mathrm{NUM}_{\mathit{radix}}(X)\), \(\mathrm{NUM}(X)\), and \(\mathrm{STR}^{m}_{\mathit{radix}}(x)\) are defined in Sec. 4.2, including examples, and they are specified in Algorithms 1-3 below. These functions support the ordering convention for the numeral [bit] strings in FF1, namely, that the first (i.e., left-most) numeral [bit] of the string is the most-significant numeral [bit].
この節では、FF1とFF3の仕様から呼び出される構成関数のアルゴリズムを示します。変換関数\(\mathrm{NUM}_{\mathit{radix}}(X)\)、\(\mathrm{NUM}(X)\)、\(\mathrm{STR}^{m}_{\mathit{radix}}(x)\)は例とともに4.2節で定義され、以下のアルゴリズム1~3に規定されます。これらの関数はFF1における数字[ビット]列の順序規約を支えます。すなわち、列の最初(左端)の数字[ビット]が最上位の数字[ビット]です。
In FF3, the numeral strings follow the opposite ordering convention, as do the byte strings for the block cipher. In order to adapt \(\mathrm{NUM}_{\mathit{radix}}(X)\), \(\mathrm{STR}^{m}_{\mathit{radix}}(x)\), and \(\mathrm{CIPH}_K(X)\) for the FF3 specifications, the functions \(\mathrm{REV}(X)\) and \(\mathrm{REVB}(X)\) are defined in Sec. 4.2 and specified in Algorithms 4 and 5.
FF3では数字列が逆の順序規約に従い、ブロック暗号のバイト列も同様です。FF3の仕様に合わせて\(\mathrm{NUM}_{\mathit{radix}}(X)\)、\(\mathrm{STR}^{m}_{\mathit{radix}}(x)\)、\(\mathrm{CIPH}_K(X)\)を適合させるため、関数\(\mathrm{REV}(X)\)および\(\mathrm{REVB}(X)\)を4.2節で定義し、アルゴリズム4および5に規定します。
The \(\mathrm{PRF}(X)\) function, specified in Algorithm 6, essentially invokes the Cipher Block Chaining encryption mode [11] on the input bit string and returns the final block of the ciphertext; this function is the pseudorandom core of the Feistel round function for FF1.Encrypt and FF1.Decrypt.
アルゴリズム6に規定される\(\mathrm{PRF}(X)\)関数は、基本的に入力ビット列に対してCipher Block Chaining暗号化モード[11]を適用し、暗号文の最終ブロックを返します。この関数は、FF1.EncryptおよびFF1.DecryptのFeistelラウンド関数における疑似ランダムの中核です。
In order to simplify the specifications of \(\mathrm{NUM}(X)\), \(\mathrm{REVB}(X)\), and \(\mathrm{PRF}(X)\), the byte or block strings in Algorithms 2, 5, and 6 are represented as bit strings.
\(\mathrm{NUM}(X)\)、\(\mathrm{REVB}(X)\)、および\(\mathrm{PRF}(X)\)の仕様を簡潔にするため、アルゴリズム2、5、および6では、バイト列またはブロック列をビット列として表します。
4 For some applications of the Feistel structure—but not FF1 and FF3—the \(+\) operation may be a different reversible operation on strings that preserves their length; for example, the FFX specification [1] supports an option for character-wise addition.
4 Feistel構造の一部の用途(ただしFF1およびFF3を除く)では、\(+\)演算は、文字列の長さを維持する別の可逆演算であってもよいです。例えば、FFX仕様[1]は文字単位の加算の選択肢をサポートします。
アルゴリズム 1: NUM_radix(X)。前提条件: 基数 radix。入力: 数字列 X。出力: 数 x。手順: 1. x = 0 とする。2. i を 1 から LEN(X) まで、x = x·radix + X[i] とする。3. x を返す。アルゴリズム 2: NUM(X)。入力: ビットで表したバイト列 X。出力: 整数 x。手順: 1. x = 0 とする。2. i を 1 から LEN(X) まで、x = 2x + X[i] とする。3. x を返す。アルゴリズム 3: STR^m_radix(x)。前提条件: 基数 radix、文字列の長さ m。入力: 0 ≤ x < radix^m を満たす整数 x。出力: 数字列 X。手順: 1. i を 1 から m まで繰り返す: i. X[m+1−i] = x mod radix とする。ii. x = ⌊x/radix⌋ とする。2. X を返す。
アルゴリズム 4: REV(X)。入力: 数字列 X。出力: 数字列 Y。手順: 1. i を 1 から LEN(X) まで、Y[i] = X[LEN(X)+1−i] とする。2. Y[1..LEN(X)] を返す。アルゴリズム 5: REVB(X)。入力: ビットで表したバイト列 X。出力: ビットで表したバイト列 Y。手順: 1. i を 0 から BYTELEN(X)−1 まで、また j を 1 から 8 まで、Y[8i+j] = X[8·(BYTELEN(X)−1−i)+j] とする。2. Y[1..8·BYTELEN(X)] を返す。アルゴリズム 6: PRF(X)。前提条件: 承認済み 128 ビットブロック暗号の指定された暗号関数 CIPH、ブロック暗号の鍵 K。入力: ブロック列 X。出力: ブロック Y。手順: 1. m = LEN(X)/128 とする。2. X_1, …, X_m を、X = X_1 || … || X_m となるブロックとする。3. Y_0 = 0^128 とし、j を 1 から m まで、Y_j = CIPH_K(Y_(j−1) ⊕ X_j) とする。4. Y_m を返す。
5 Mode Specifications
5 モードの仕様
The specifications of the encryption and decryption algorithms for FF1 and FF3 are presented in Sections 6.1 and 6.2, organized into prerequisites, inputs, outputs, steps, and descriptions of the steps. In addition to the key and designated cipher function, the prerequisites for each mode are the choices of 1) the base, \(\mathit{radix}\), and 2) the range of lengths, \([\mathit{minlen}\mathrel{..}\mathit{maxlen}]\), for the numeral string inputs that the implementation supports. FF1 also has a prerequisite for the choice of the maximum tweak length, \(\mathit{maxTlen}\), that the implementation supports. For each mode, the requirements on the values for the prerequisites are specified prior to the encryption and decryption algorithms.
FF1およびFF3の暗号化・復号アルゴリズムの仕様は6.1節および6.2節に示し、前提条件、入力、出力、手順、および各手順の説明に分けて構成されています。各モードの前提条件は、鍵および指定暗号関数に加え、1) 基数\(\mathit{radix}\)、および 2) 実装がサポートする数字列入力の長さの範囲\([\mathit{minlen}\mathrel{..}\mathit{maxlen}]\)の選択です。FF1では、実装がサポートする最大tweak長\(\mathit{maxTlen}\)の選択も前提条件となります。各モードについて、暗号化・復号アルゴリズムに先立ち、前提条件の値に関する要件を規定します。
The parameter choices may affect interoperability. The behavior of an implementation when presented with incorrect inputs is outside the scope of this Recommendation.
パラメーターの選択は相互運用性に影響することがあります (may)。不正な入力を与えられた場合の実装の動作は、本勧告の適用範囲外です。
For each specification, the 128-bit input and output blocks of the designated block cipher, \(\mathrm{CIPH}_K\), are represented as strings of 16 bytes.
各仕様では、指定ブロック暗号\(\mathrm{CIPH}_K\)の128ビット入出力ブロックを、16バイトの列として表します。
5.1 FF1
5.1 FF1
The specifications for the FF1.Encrypt and FF1.Decrypt functions are given in Algorithms 7 and 8 below. The tweak, \(T\), is optional, in that it may be the empty string, with byte length \(t=0\).
FF1.EncryptおよびFF1.Decrypt関数の仕様を、以下のアルゴリズム7および8に示します。tweak \(T\)は任意であり、空文字列(バイト長\(t=0\))でもよいです。
The parameters \(\mathit{radix}\), \(\mathit{minlen}\), and \(\mathit{maxlen}\) in FF1.Encrypt and FF1.Decrypt shall meet the following requirements:
FF1.Encrypt および FF1.Decrypt におけるパラメーター \(\mathit{radix}\)、\(\mathit{minlen}\)、および \(\mathit{maxlen}\) は、次の要件を満たさなければならない (shall):
• \(\mathit{radix} \in [2..2^{16}]\),
• \(\mathit{radix} \in [2..2^{16}]\)、
• \(\mathit{radix}^{\mathit{minlen}} \ge 100\), and
• \(\mathit{radix}^{\mathit{minlen}} \ge 100\)、および
• \(2 \le \mathit{minlen} \le \mathit{maxlen} < 2^{32}\).
• \(2 \le \mathit{minlen} \le \mathit{maxlen} < 2^{32}\)。
アルゴリズム 7: FF1.Encrypt(K, T, X) の前半(表題、前提条件、入力、出力。手順は次ページに続く)。前提条件: 承認済み 128 ビットブロック暗号の指定暗号関数 CIPH、ブロック暗号の鍵 K、基数 radix、サポートするメッセージ長の範囲 [minlen..maxlen]、tweak の最大バイト長 maxTlen。入力: 基数 radix で長さ n の数字列 X(n ∈ [minlen..maxlen])、バイト長 t のバイト列である tweak T(t ∈ [0..maxTlen])。出力: LEN(Y) = n を満たす数字列 Y。
アルゴリズム 7: FF1.Encrypt(K, T, X) の続き(手順)。手順: 1. u = ⌊n/2⌋、v = n − u とする。2. A = X[1..u]、B = X[u+1..n] とする。3. b = ⌈⌈v·LOG(radix)⌉/8⌉ とする。4. d = 4⌈b/4⌉ + 4 とする。5. P = [1]^1 || [2]^1 || [1]^1 || [radix]^3 || [10]^1 || [u mod 256]^1 || [n]^4 || [t]^4 とする。6. i を 0 から 9 まで繰り返す: i. Q = T || [0]^((−t−b−1) mod 16) || [i]^1 || [NUM_radix(B)]^b とする。ii. R = PRF(P || Q) とする。iii. S を、次の ⌈d/16⌉ 個のブロックからなる列の先頭 d バイトとする: R || CIPH_K(R ⊕ [1]^16) || CIPH_K(R ⊕ [2]^16) … CIPH_K(R ⊕ [⌈d/16⌉ − 1]^16)。iv. y = NUM(S) とする。v. i が偶数なら m = u、そうでなければ m = v とする。vi. c = (NUM_radix(A) + y) mod radix^m とする。vii. C = STR^m_radix(c) とする。viii. A = B とする。ix. B = C とする。7. A || B を返す。
Description The “split” of the numeral string \(X\) into two substrings, \(A\) and \(B\), is performed in Steps 1 and 2. If \(n\) is even, \(\operatorname{LEN}(A)=\operatorname{LEN}(B)\); otherwise, \(\operatorname{LEN}(A)=\operatorname{LEN}(B)-1\). The byte lengths \(b\) and \(d\), which are used in Steps 6i and 6iii, respectively, are defined in Steps 3 and 4.6 A fixed block, \(P\), used as the initial block for the invocation of the function \(\mathrm{PRF}\) in Step 6ii, is defined in Step 5. An iteration loop for the ten Feistel rounds of FF1 is initiated in Step 6, executing nine substeps for each round, as follows:
説明 数字列 \(X\) を二つの部分文字列 \(A\) および \(B\) に「分割」する処理を Steps 1 および 2 で行います。\(n\) が偶数の場合 \(\operatorname{LEN}(A)=\operatorname{LEN}(B)\)、それ以外の場合 \(\operatorname{LEN}(A)=\operatorname{LEN}(B)-1\) です。Steps 6i および 6iii でそれぞれ使用するバイト長 \(b\) および \(d\) は、Steps 3 および 4 で定義されます。6 固定ブロック \(P\) は、Step 6ii で関数 \(\mathrm{PRF}\) の呼出し時に初期ブロックとして使用するものであり、Step 5 で定義されます。FF1 の十ラウンドの Feistel 反復ループを Step 6 で開始し、各ラウンドで次の九つのサブステップを実行する:
The tweak, T, the substring, B, and the round number, i, are encoded as a binary string, Q, in Step 6i. The function PRF is applied to the concatenation of P and Q in Step 6ii, to produce a block, R, which is either truncated or expanded to a byte string, S, with the appropriate number of bytes, d, in Step 6iii. (In Figure 1, S corresponds to the output of FK.) In Steps 6iv to 6vii, S is combined with the substring A to produce a numeral string C in the same base and with the same length. (In Figure 1, the combining of S with A is indicated by the “+” operation.) In particular, in Step 6iv, S is converted to a number, y. In Step 6v, the length, m, of A for this Feistel round is determined. In Step 6vi, y is added to the number represented by the substring A, and the result is reduced modulo the mth power of radix, yielding a number, c, which is converted to a numeral string in Step 6vii. In Steps 6viii and 6ix, the roles of A and B are swapped for the next round: the substring B is renamed as the substring A, and the modified A (i.e., C) is renamed as B.
Step 6iでは、tweak T、部分文字列B、およびラウンド番号iをバイナリ文字列Qとして符号化します。Step 6iiでは、PとQの連結にPRF関数を適用してブロックRを生成します。Step 6iiiでは、Rを切り詰めるか拡張し、適切なバイト数dのバイト列Sにします(図1では、SはFKの出力に対応します)。Step 6ivから6viiでは、Sを部分文字列Aと組み合わせて、同じ基数・長さの数字列Cを生成します(図1ではこの組み合わせを「+」演算で示します)。具体的には、Step 6ivでSを数値yに変換し、Step 6vでAの長さmを決めます。Step 6viで、Aが表す数値にyを加算し、radixのm乗を法として剰余を取って数値cを得ます。Step 6viiでcを数字列に変換します。Step 6viiiおよび6ixで、次ラウンドに向けてAとBの役割を入れ替え、部分文字列BをAに、変更後のA(すなわちC)をBにします。
This completes one round of the Feistel structure in FF1. After the tenth round, the concatenation of \(A\) and \(B\) is returned as the output in Step 7.
これで FF1 の Feistel 構造の一ラウンドが完了します。第十ラウンド後、\(A\) と \(B\) の連結が Step 7 で出力として返されます。
6 When \(B\) is encoded as a byte string in Step 6i, \(b\) is the number of bytes in the encoding. The definition of \(d\) ensures that the output of the Feistel round function is at least four bytes longer than this encoding of \(B\), which minimizes any bias in the modular reduction in Step 6vi.
6 Step 6i で \(B\) をバイト列として符号化する場合、\(b\) はその符号化のバイト数です。\(d\) の定義により、Feistel ラウンド関数の出力はこの \(B\) の符号化より少なくとも四バイト長くなり、Step 6vi の剰余演算における偏りが最小限に抑えられます。
アルゴリズム 8: FF1.Decrypt(K, T, X)。前提条件: 承認済み 128 ビットブロック暗号の指定暗号関数 CIPH、ブロック暗号の鍵 K、基数 radix、サポートするメッセージ長の範囲 [minlen..maxlen]、tweak の最大バイト長 maxTlen。入力: 基数 radix で長さ n の数字列 X(n ∈ [minlen..maxlen])、バイト長 t のバイト列である tweak T(t ∈ [0..maxTlen])。出力: LEN(Y) = n を満たす数字列 Y。手順: 1. u = ⌊n/2⌋、v = n − u とする。2. A = X[1..u]、B = X[u+1..n] とする。3. b = ⌈⌈v·LOG(radix)⌉/8⌉ とする。4. d = 4⌈b/4⌉ + 4 とする。5. P = [1]^1 || [2]^1 || [1]^1 || [radix]^3 || [10]^1 || [u mod 256]^1 || [n]^4 || [t]^4 とする。6. i を 9 から 0 まで繰り返す: i. Q = T || [0]^((−t−b−1) mod 16) || [i]^1 || [NUM_radix(A)]^b とする。ii. R = PRF(P || Q) とする。iii. S を、次の ⌈d/16⌉ 個のブロックからなる列の先頭 d バイトとする: R || CIPH_K(R ⊕ [1]^16) || CIPH_K(R ⊕ [2]^16) … CIPH_K(R ⊕ [⌈d/16⌉ − 1]^16)。iv. y = NUM(S) とする。v. i が偶数なら m = u、そうでなければ m = v とする。vi. c = (NUM_radix(B) − y) mod radix^m とする。vii. C = STR^m_radix(c) とする。viii. B = A とする。ix. A = C とする。7. A || B を返す。
Description: The FF1.Decrypt algorithm is similar to the FF1.Encrypt algorithm; the differences are in Step 6, where: 1) the order of the indices is reversed, 2) the roles of \(\mathrm{A}\) and \(\mathrm{B}\) are swapped, and 3) modular addition is replaced by modular subtraction, in Step 6vi.
説明: FF1.Decrypt アルゴリズムは FF1.Encrypt アルゴリズムと類似しますが、Step 6 に次の相違がある: 1) 添字の順序が逆になる、2) \(\mathrm{A}\) と \(\mathrm{B}\) の役割が入れ替わる、3) Step 6vi で法加算が法減算に置き換えられます。
5.2 FF3
5.2 FF3
The specifications for the FF3.Encrypt and FF3.Decrypt functions are given in Algorithms 9 and 10 below. The parameters \(\mathit{radix}\), \(\mathit{minlen}\), and \(\mathit{maxlen}\) in FF3.Encrypt and FF3.Decrypt shall meet the following requirements:
FF3.Encrypt および FF3.Decrypt 関数の仕様を、以下の Algorithms 9 および 10 に示します。FF3.Encrypt および FF3.Decrypt のパラメーター \(\mathit{radix}\)、\(\mathit{minlen}\)、および \(\mathit{maxlen}\) は、次の要件を満たさなければならない (shall):
FF3 のパラメーター要件と、アルゴリズム 9: FF3.Encrypt(K, T, X)。要件(箇条書き): radix ∈ [2..2^16]、radix^minlen ≥ 100、2 ≤ minlen ≤ maxlen ≤ 2⌊log_radix(2^96)⌋。アルゴリズム 9: FF3.Encrypt(K, T, X)。前提条件: 承認済み 128 ビットブロック暗号の指定暗号関数 CIPH、ブロック暗号の鍵 K、基数 radix、サポートするメッセージ長の範囲 [minlen..maxlen]。入力: 基数 radix で長さ n の数字列 X(n ∈ [minlen..maxlen])、LEN(T) = 64 を満たす tweak ビット列 T。出力: LEN(Y) = n を満たす数字列 Y。手順: 1. u = ⌈n/2⌉、v = n − u とする。2. A = X[1..u]、B = X[u+1..n] とする。3. T_L = T[0..31]、T_R = T[32..63] とする。4. i を 0 から 7 まで繰り返す: i. i が偶数なら m = u、W = T_R、そうでなければ m = v、W = T_L とする。ii. P = W ⊕ [i]^4 || [NUM_radix(REV(B))]^12 とする。iii. S = REVB(CIPH_REVB(K) REVB(P)) とする。iv. y = NUM(S) とする。v. c = (NUM_radix(REV(A)) + y) mod radix^m とする。vi. C = REV(STR^m_radix(c)) とする。vii. A = B とする。viii. B = C とする。5. A || B を返す。
Description: The “split” of the numeral string \(X\) into two substrings, \(A\) and \(B\), is performed in Steps 1 and 2. If \(n\) is even, \(\mathrm{LEN}(A)=\mathrm{LEN}(B)\); otherwise, \(\mathrm{LEN}(A)=\mathrm{LEN}(B)+1\).7 The tweak, \(T\), is partitioned in Step 3 into a 32-bit left tweak, \(T_L\), and a 32-bit right tweak, \(T_R\). An iteration loop for the eight Feistel rounds of FF3 is initiated in Step 4, executing eight substeps for each round, as follows:
説明:数字列\(X\)を2つの部分文字列\(A\)および\(B\)に分割する操作はStep 1および2で行います。\(n\)が偶数の場合、\(\mathrm{LEN}(A)=\mathrm{LEN}(B)\)であり、そうでない場合は\(\mathrm{LEN}(A)=\mathrm{LEN}(B)+1\)となります。7 tweak \(T\)はStep 3で32ビットの左tweak \(T_L\)と32ビットの右tweak \(T_R\)に分割されます。FF3の8回のFeistelラウンドに対する反復ループをStep 4で開始し、各ラウンドで次の8つのサブステップを実行する:
In Step 4i, the parity of the round number, i, determines the length, m, of the substring A, and whether TL or TR will be used as W in Step 4ii, in which a 32-bit encoding of i, XORed with W, is concatenated with a 96-bit encoding of B to produce a block, P. In Step 4iii, the block cipher under the key is applied to P using the byte-reversed ordering convention, to produce a block, S. (In Figure 1, S corresponds to the output of FK.) In Steps 4iv to 4vi, S is combined with the substring A to produce a numeral string C in the same base and with the same length. (In Figure 1, the combining of S with A is indicated by the “+” operation, although this operation differs from that for FF1 because FF3 uses the opposite ordering convention for converting strings to numbers and vice versa.) In particular, in Step 4iv, S is converted to a number, y. In Step 4v, y is added to the number represented by substring A, and the result is reduced modulo the mth power of radix, yielding a number, c, which is converted to a numeral string in Step 4vi. In Steps 4vii and 4viii, the roles of A and B are swapped for the next round: substring B is renamed as substring A, and the modified A (i.e., C) is renamed as B.
Step 4iでは、ラウンド番号iの偶奇によって部分文字列Aの長さmと、Step 4iiでWとして使用するTLまたはTRが決まります。Step 4iiでは、iの32ビット表現とWとのXORをBの96ビット表現に連結してブロックPを生成します。Step 4iiiでは、鍵の下でバイト逆順の規約を用いてPにブロック暗号を適用し、ブロックSを生成します(図1ではSはFKの出力に対応します)。Step 4ivから4viでは、Sと部分文字列Aを組み合わせ、同じ基数・長さの数字列Cを生成する(図1ではこの組み合わせを「+」演算で示します。ただしFF3は文字列と数値の変換に逆の順序規約を用いるため、FF1とは異なります)。具体的には、Step 4ivでSを数値yに変換し、Step 4vでyをAが表す数値に加算してradixのm乗を法として剰余を取り、数値cを得ます。Step 4viでcを数字列に変換します。Step 4viiおよび4viiiで次ラウンドに向けてAとBの役割を交換し、BをAに、変更後のA(すなわちC)をBにします。
7 If \(n\) is odd, \(A\) is one numeral longer than \(B\), in contrast to FF1, where \(B\) is one numeral longer than \(A\).
7 \(n\) が奇数の場合、\(A\) は \(B\) より数字が一つ長い。これは FF1 と対照的であり、FF1 では \(B\) が \(A\) より数字が一つ長い。
This completes one round of the Feistel structure in FF3. After the eighth round, the concatenation of \(A\) and \(B\) is returned as the output in Step 5.
これで FF3 の Feistel 構造の一ラウンドが完了します。第八ラウンド後、\(A\) と \(B\) の連結が Step 5 で出力として返されます。
アルゴリズム 10: FF3.Decrypt(K, T, X)。前提条件: 承認済み 128 ビットブロック暗号の指定暗号関数 CIPH、ブロック暗号の鍵 K、基数 radix、サポートするメッセージ長の範囲 [minlen..maxlen]。入力: 基数 radix で長さ n の数字列 X(n ∈ [minlen..maxlen])、LEN(T) = 64 を満たす tweak ビット列 T。出力: LEN(Y) = n を満たす数字列 Y。手順: 1. u = ⌈n/2⌉、v = n − u とする。2. A = X[1..u]、B = X[u+1..n] とする。3. T_L = T[0..31]、T_R = T[32..63] とする。4. i を 7 から 0 まで繰り返す: i. i が偶数なら m = u、W = T_R、そうでなければ m = v、W = T_L とする。ii. P = W ⊕ [i]^4 || [NUM_radix(REV(A))]^12。iii. S = REVB(CIPH_REVB(K) REVB(P)) とする。iv. y = NUM(S) とする。v. c = (NUM_radix(REV(B)) − y) mod radix^m とする。vi. C = REV(STR^m_radix(c)) とする。vii. B = A とする。viii. A = C とする。5. A || B を返す。
Description: The FF3.Decrypt algorithm is similar to the FF3.Encrypt algorithm; the differences are in Step 4, where: 1) the order of the indices is reversed, 2) the roles of \(\mathrm{A}\) and \(\mathrm{B}\) are swapped, and 3) modular addition is replaced by modular subtraction, in Step 4v.
説明: FF3.Decrypt アルゴリズムは FF3.Encrypt アルゴリズムと類似しますが、Step 4 に次の相違がある: 1) 添字の順序が逆になる、2) \(\mathrm{A}\) と \(\mathrm{B}\) の役割が入れ替わる、3) Step 4v で法加算が法減算に置き換えられます。
6 Conformance
6 適合性
Implementations of FF1.Encrypt, FF1.Decrypt, FF3.Encrypt, or FF3.Decrypt may be tested for conformance to this Recommendation under the auspices of NIST’s Cryptographic Algorithm Validation Program [9].
FF1.Encrypt、FF1.Decrypt、FF3.EncryptまたはFF3.Decryptの実装は、NISTの暗号アルゴリズム検証プログラム[9]の下で、本勧告への適合性試験を受けてもよいです。
Component functions such as \(\mathrm{PRF}\) are not approved for use independent of these four functions.
\(\mathrm{PRF}\) などの構成関数は、これら四つの関数から独立して使用することは承認されていません。
In order to claim conformance with this Recommendation, an implementation of FF1 or FF3 may support as few as one value for the base.
本勧告への適合を主張するために、FF1またはFF3の実装がサポートする基数は1つだけでもよいです。
Two implementations can only interoperate when they support common values for the base. Moreover, FF1 and FF3 have two parameters, \(\mathit{minlen}\) and \(\mathit{maxlen}\), that determine the lengths for the numeral strings that are supported by an implementation of the encryption or decryption function for the mode. FF1 also has a parameter, \(\mathit{maxTlen}\), that indicates the maximum supported length of a tweak string. The selection of these parameters may also affect interoperability.
二つの実装が相互運用できるのは、共通の基数値をサポートする場合に限られます。さらに、FF1 および FF3 には \(\mathit{minlen}\) と \(\mathit{maxlen}\) という二つのパラメーターがあり、そのモードの暗号化関数または復号関数の実装がサポートする数字列の長さを決定します。FF1 には、tweak 文字列についてサポートされる最大長を示すパラメーター \(\mathit{maxTlen}\) もあります。これらのパラメーターの選択も相互運用性に影響する場合があります。
For every algorithm that is specified in this Recommendation, a conforming implementation may replace the given set of steps with any mathematically equivalent set of steps. In other words, different procedures that produce the correct output for any input are permitted.
本勧告で規定される各アルゴリズムについて、適合実装は、提示されたステップ群を数学的に等価な任意のステップ群に置き換えてもよいです。すなわち、任意の入力に対して正しい出力を生成する異なる手順が許容されます。
Appendix A: Parameter Choices and Security
付録A:パラメーターの選択とセキュリティ
The values of the parameters, e.g., \(\mathit{radix}\), \(\mathit{minlen}\), and \(\mathit{maxlen}\) affect the security that FF1 and FF3 can offer, because, as for any FPE method, encrypted data may be vulnerable to guessing attacks when the number of possible inputs is sufficiently small.
パラメーターの値、例えば \(\mathit{radix}\)、\(\mathit{minlen}\)、および \(\mathit{maxlen}\) は、FF1 および FF3 が提供できるセキュリティに影響します。これは、あらゆる FPE 方式と同様に、可能な入力数が十分に少ない場合、暗号化データが推測攻撃に対して脆弱となり得るためです。
In particular, for a base \(\mathit{radix}\) numeral string \(S\), there are \(\mathit{radix}^{\operatorname{LEN}(S)}\) possible values. For any ciphertext \(C\), the corresponding plaintext has the same length; therefore, an attacker can guess the plaintext with probability \(1/\mathit{radix}^{\operatorname{LEN}(C)}\) by selecting a numeral string of \(\operatorname{LEN}(C)\) at random. Repeated guesses increase the attacker’s probability of success proportionately: with \(g\) distinct guesses, the probability is \(g/\mathit{radix}^{\operatorname{LEN}(C)}\).
特に、基数 \(\mathit{radix}\) の数字列 \(S\) について、\(\mathit{radix}^{\operatorname{LEN}(S)}\) 個の値があり得ます。任意の暗号文 \(C\) について、対応する平文は同じ長さです。したがって、攻撃者は確率 \(1/\mathit{radix}^{\operatorname{LEN}(C)}\) で平文を推測できます。そのためには、長さ \(\operatorname{LEN}(C)\) の数字列をランダムに選択すればよい。推測を繰り返すと、攻撃者の成功確率は比例して増加します。異なる推測が \(g\) 個ある場合、その確率は \(g/\mathit{radix}^{\operatorname{LEN}(C)}\) です。
For example, SSNs are base 10 numeral strings of length 9, so there are one billion possibilities. If an attacker could guess a thousand different values for an SSN, one of the guesses would be correct with probability \(1000/10^{9}\), i.e., one in a million.
例えば、SSN は長さ 9 の基数 10 の数字列であり、可能な値は十億通りあります。攻撃者が SSN について異なる値を千個推測できる場合、そのうち一つが正しい確率は \(1000/10^{9}\)、すなわち百万分の一です。
The specifications of FF1 and FF3 only impose a modest absolute minimum on the number of possible inputs; in particular, \(\mathit{radix}^{\mathit{minlen}} \ge 100\), in order to preclude a generic meet-in-the-middle attack on the Feistel structure [14].
FF1 および FF3 の仕様は、可能な入力数について控えめな絶対最小値だけを課しています。具体的には、Feistel 構造に対する汎用的な中間一致攻撃を防ぐため、\(\mathit{radix}^{\mathit{minlen}} \ge 100\) です [14]。
However, in order to limit the effectiveness of guessing attacks, the value \(\mathit{radix}^{\mathit{minlen}}\) should generally be at least one million, and, depending on that value, the implementation should also limit the number of guesses that an attacker can mount, if possible. The minimum of one million is suggested rather than required, in recognition that \(\mathit{radix}\) and \(\mathit{minlen}\) are usually determined by the needs of the implementation.
ただし、推測攻撃の有効性を制限するため、値 \(\mathit{radix}^{\mathit{minlen}}\) は一般に少なくとも百万とすべきであり、その値に応じて、可能であれば実装は攻撃者が実行できる推測回数も制限すべきです。百万という最小値は、要求ではなく提案です。これは、\(\mathit{radix}\) および \(\mathit{minlen}\) が通常、実装の必要性によって決まることを考慮したものです。
In order to prevent attacks against one instance of encryption from applying to other instances, implementations should enforce the use of different tweaks for different instances, as discussed in Appendix C. Usually, tweaks are non-secret information that can be associated with instances of encryption. For FF3, the tweak length is fixed, but for FF1 the maximum tweak length parameter, \(\mathit{maxTlen}\), should be chosen to accommodate the desired tweaks for the implementation.
ある暗号化インスタンスに対する攻撃が他のインスタンスにも適用されることを防ぐため、実装は付録 C で説明するとおり、インスタンスごとに異なる tweak の使用を強制すべきです。通常、tweak は暗号化インスタンスに関連付けることのできる非秘密情報です。FF3 では tweak の長さは固定されていますが、FF1 では、実装で必要とする tweak に対応できるよう、最大 tweak 長パラメーター \(\mathit{maxTlen}\) を選択すべきです。
Two other potential parameters of the Feistel structure are fixed for FF1 and FF3, namely, the number of Feistel rounds and the imbalance, i.e., the values of the lengths \(u\) and \(v\) in Figure 1. Both of these parameters were set with consideration to both performance and security requirements. See Appendix H of [1] for a discussion.
Feistel 構造のほかの二つのパラメーター、すなわち Feistel ラウンド数および不均衡 (図 1 の長さ \(u\) と \(v\) の値) は、FF1 と FF3 で固定されます。これらのパラメーターはいずれも性能要件とセキュリティ要件の両方を考慮して設定されました。考察については [1] の Appendix H を参照してください。
Appendix B: Security Goal
付録 B: セキュリティ目標
The designers of FFX aimed to achieve strong-pseudorandom permutation (PRP) security for a conventional block cipher [7]. In the FFX proposal to NIST [1], the designers of FFX cite the history of cryptographic results concerning Feistel networks as underlying their selection of the FFX mechanism. They assert that, under the assumption that the underlying round function is a good pseudorandom function (PRF), contemporary cryptographic results and experience indicate that FFX achieves several cryptographic goals, including nonadaptive message-recovery security, chosen-plaintext security, and even PRP-security against an adaptive chosen-ciphertext attack. The quantitative security depends on the number of rounds used, the imbalance, and the adversary's access to plaintext-ciphertext pairs. See [1] for details.
FFX の設計者は、従来型ブロック暗号に対する強い擬似ランダム置換 (PRP) セキュリティの達成を目指しました [7]。NIST への FFX 提案 [1] で、設計者は FFX の方式選択の根拠として、Feistel ネットワークに関する暗号研究の経緯を挙げています。基礎となるラウンド関数が優れた擬似ランダム関数 (PRF) であるという前提の下で、現代の暗号研究の成果と経験は、FFX が非適応的なメッセージ復元セキュリティ、選択平文セキュリティ、さらには適応的選択暗号文攻撃に対する PRP セキュリティを含む複数の暗号学的目標を達成すると示している、と設計者は主張します。定量的な安全性は、使用するラウンド数、不均衡、および攻撃者の平文・暗号文ペアへのアクセス度合いに依存します。詳細は [1] を参照してください。
Appendix C: Tweaks
付録 C: tweak
Tweaks have been supported in stand-alone block ciphers, such as Schroeppel’s Hasty Pudding [15], and the notion was later formalized and investigated by Liskov, Rivest, and Wagner [6]. Tweaks are important for FPE modes, because FPE may be used in settings where the number of possible character strings is relatively small. In such settings, the tweak should vary with each instance of the encryption whenever possible.
tweak は Schroeppel の Hasty Pudding [15] などの単独型ブロック暗号でサポートされており、この概念は後に Liskov、Rivest、Wagner によって形式化され、検討されました [6]。FPE モードでは、可能な文字列の数が比較的少ない状況で使用されることがあるため、tweak が重要となります。そのような状況では、可能な限り、暗号化の各インスタンスで tweak を変えるべきです (should)。
For example, suppose that in an application for CCNs, the leading six digits and the trailing four digits need to be available to the application, so that only the remaining six digits in the middle of the CCNs are encrypted. There are a million different possibilities for these middle-six digits, so, in a database of 100 million CCNs, about a hundred distinct CCNs would be expected to share each possible value for these six digits. If the hundred CCNs that shared a given value for the middle-six digits were encrypted with the same tweak, then their ciphertexts would be the same. If, however, the other ten digits had been the tweak for the encryption of the middle-six digits, then the hundred ciphertexts would almost certainly be different.
例えば、CCN 用アプリケーションで、先頭の六桁と末尾の四桁をアプリケーションから利用できるようにし、CCN の中央にある残りの六桁のみを暗号化する必要があるとします。中央の六桁には百万通りの値があるため、1億件の CCN を含むデータベースでは、各値を共有する異なる CCN が約百件ずつあると予想されます。中央の六桁が同じ百件の CCN を同じ tweak で暗号化すると、それらの暗号文は同一になります。一方、他の十桁を中央の六桁の暗号化に用いる tweak とした場合、百件の暗号文はほぼ確実に異なります。
Similarly, in the encrypted database, about a hundred CCNs would be expected to share each possible value for the ciphertext, i.e., the middle-six digits. If the hundred CCNs that produce a given ciphertext had been encrypted with the same tweak, then the corresponding plaintexts would also be the same. This outcome would be undesirable because the compromise of the confidentiality of any of the hundred CCNs would reveal the others.
同様に、暗号化データベースでは、暗号文、すなわち中央の六桁の値ごとに、約百件の CCN が同じ値を共有すると予想されます。同じ暗号文を生成する百件の CCN が同じ tweak で暗号化されていた場合、対応する平文も同一となります。この結果は望ましくありません。百件の CCN のいずれかの機密性が侵害されれば、残りの CCN も明らかになるためです。
If, however, the leading six digits and the trailing four digits of the CCN had been used as the tweak, then the corresponding plaintexts would almost certainly be different. Therefore, for example, learning that the decryption of 111111-770611-1111 is 111111-123456-1111 would not reveal any information about the decryption of 999999-770611-9999, because the tweak in that case was different.
しかし、CCN の先頭六桁と末尾四桁を tweak として使用していた場合、対応する平文はほぼ確実に異なります。したがって、例えば、111111-770611-1111 の復号結果が 111111-123456-1111 であると知っても、999999-770611-9999 の復号に関する情報は明らかになりません。そのケースでは tweak が異なるためです。
In general, if there is information that is available and statically associated with a plaintext, it is recommended to use that information as a tweak for the plaintext. Ideally, the non-secret tweak associated with a plaintext is associated only with that plaintext.
一般に、平文と静的に関連付けられ、利用可能な情報がある場合、その情報を当該平文の tweak として使用することが推奨されます。理想的には、平文に関連付けられた非秘密の tweak は、その平文だけに関連付けられます。
Extensive tweaking means that fewer plaintexts are encrypted under any given tweak. This corresponds, in the security model that is described in [1], to fewer queries to the target instance of the encryption.
広範に tweak を利用すると、所与の tweak の下で暗号化される平文の数が減ります。これは、[1] に記載されたセキュリティモデルにおいて、暗号化の対象インスタンスへのクエリが少なくなることに相当します。
Appendix D: Examples
付録 D: 例
Examples for FF1 and FF3 are available at the examples page on NIST’s Computer Security Resource Center website: http://csrc.nist.gov/groups/ST/toolkit/examples.html.
FF1 および FF3 の例は、NIST の Computer Security Resource Center ウェブサイトにある例のページで参照できる: http://csrc.nist.gov/groups/ST/toolkit/examples.html.
Appendix E: References
付録 E: 参考文献
付録 E: 参考文献の [1]〜[13]。書誌は原文のまま示す。[1] M. Bellare, P. Rogaway, and T. Spies, The FFX Mode of Operation for Format-Preserving Encryption, Draft 1.1, February 20, 2010, http://csrc.nist.gov/groups/ST/toolkit/BCM/documents/proposedmodes/ffx/ffx-spec.pdf [accessed 2/18/2016]. [2] M. Bellare, P. Rogaway, and T. Spies, Addendum to “The FFX Mode of Operation for Format-Preserving Encryption”: A parameter collection for enciphering strings of arbitrary radix and length, Draft 1.0, September 3, 2010, http://csrc.nist.gov/groups/ST/toolkit/BCM/documents/proposedmodes/ffx/ffx-spec2.pdf [accessed 2/18/2016]. [3] E. Brier, T. Peyrin, and J. Stern, BPS: a Format-Preserving Encryption Proposal, [April 2010], http://csrc.nist.gov/groups/ST/toolkit/BCM/documents/proposedmodes/bps/bps-spec.pdf [accessed 2/18/2016]. [4] Y-A. de Montjoye, L. Radaelli, V. Kumar Singh, and A. Pentland, “Unique in the shopping mall: On the reidentifiability of credit card metadata,” Science, vol. 347 no. 6221 (January 30, 2016), pp. 536-539, http://dx.doi.org/10.1126/science.1256297. [5] M. Dworkin and R. Perlner, Analysis of VAES3 (FF2), Report no. 2015/306, IACR Cryptology ePrint Archive, April 2, 2015, http://eprint.iacr.org/2015/306 [accessed 2/18/2016]. [6] M. Liskov, R. Rivest, and D. Wagner, “Tweakable block ciphers,” in Advances in Cryptology—CRYPTO 2002, Lecture Notes in Computer Science 2442, Berlin: Springer, pp. 31–46, September 13, 2002, http://dx.doi.org/10.1007/3-540-45708-9_3. [7] M. Luby and C. Rackoff, “How to construct pseudorandom permutations from pseudorandom functions,” SIAM Journal on Computing, vol. 17 no. 2 (1988), pp. 373–386, http://dx.doi.org/10.1137/0217022. [8] National Institute of Standards and Technology, Explanation of changes to Draft SP 800-38G, June 27, 2014, http://csrc.nist.gov/news_events/news_archive/news_archive_2014.html#june27 [accessed 2/18/2016]. [9] National Institute of Standards and Technology, Cryptographic Algorithm Validation Program (CAVP), http://csrc.nist.gov/groups/STM/cavp/index.html [accessed 2/18/2016]. [10] National Institute of Standards and Technology, Federal Information Processing Standard (FIPS) 197, The Advanced Encryption Standard (AES), November 2001, http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf [accessed 2/18/2016]. [11] National Institute of Standards and Technology. NIST Special Publication (SP) 800-38A, Recommendation for Block Cipher Modes of Operation—Methods and Techniques, December 2001, http://dx.doi.org/10.6028/NIST.SP.800-38A. [12] National Institute of Standards and Technology. NIST Special Publication (SP) 800-67 Revision 1, Recommendation for the Triple Data Encryption Algorithm (TDEA) Block Cipher, January 2012, http://dx.doi.org/10.6028/NIST.SP.800-67r1. [13] National Institute of Standards and Technology. NIST Special Publication (SP) 800-133, Recommendation for Cryptographic Key Generation, December 2012, http://dx.doi.org/10.6028/NIST.SP.800-133.
付録 E: 参考文献(続き)の [14]〜[16]。書誌は原文のまま示す。[14] J. Patarin, Generic attacks on Feistel schemes, Report no. 2008/036, IACR Cryptology ePrint Archive, January 24, 2008, http://eprint.iacr.org/2008/036 [accessed 2/18/2016]. [15] R. Schroeppel, Hasty Pudding Cipher specification [Web page], June 1998 (revised May 1999), http://richard.schroeppel.name:8015/hpc/hpc-spec [accessed 2/18/2016]. [16] J. Vance and M. Bellare, An extension of the FF2 FPE Scheme: Submission to NIST, July 2, 2014, http://csrc.nist.gov/groups/ST/toolkit/BCM/documents/proposedmodes/dff/dff-ff2-fpe-scheme-update.pdf [accessed 2/18/2016].



![Section 3.3 Operations and Functions, notation list (part 1 of 2), symbol and meaning in two columns. BYTELEN(X): The number of bytes in a byte string, X. CIPH_K(X): The output of the designated cipher function of the block cipher under the key K applied to the block X. LEN(X): The number of numerals [or bits] in a numeral string [or bit string] X. LOG(x): The base 2 logarithm of the real number x > 0. NUM(X): The integer that a bit string X represents when the bits are valued in decreasing order of significance. NUM_radix(X): The number that the numeral string X represents in base radix when the numerals are valued in decreasing order of significance. PRF(X): The output of the function PRF applied to the block X; PRF is defined in terms of a given designated cipher function. REV(X): Given a numeral string, X, the numeral string that consists of the numerals of X in reverse order. REVB(X): Given a byte string, X, the byte string that consists of the bytes of X in reverse order. STR^m_radix(x): Given a nonnegative integer x less than radix^m, the representation of x as a string of m numerals in base radix, in decreasing order of significance. ⌊x⌋: The greatest integer that does not exceed the real number x. ⌈x⌉: The least integer that is not less than the real number x. [x]^s: Given a nonnegative integer x less than 256^s, the representation of x as a string of s bytes. [i..j]: The set of integers between two integers i and j, including i and j.](assets/38g/p0010-operations-functions.png)
![Section 3.3 Operations and Functions, notation list (part 2 of 2). x mod m: The nonnegative remainder of the integer x modulo the positive integer m. X[i]: The i-th element of the string X. X[i..j]: The substring of the string X from X[i] to X[j], including X[i] and X[j]. X ⊕ Y: The bitwise exclusive-OR of bit strings X and Y whose bit lengths are equal. X || Y: The concatenation of numeral strings X and Y. 0^s: The bit string that consists of s consecutive ‘0’ bits.](assets/38g/p0011-notation.png)
![Section 4.2 Examples of Basic Operations and Functions (continued), seven paragraphs set as an image. Given a numeral [bit] string X and an index i such that 1 ≤ i ≤ LEN(X), the i-th numeral [bit] of X is denoted by X[i]. For a pair of indices (i, j), with 1 ≤ i ≤ j ≤ LEN(X), the substring of numerals [bits] from X[i] to X[j] is denoted by X[i..j]. For example, in base ten, if X = 798137, then X[2] = 9, and X[3..5] = 813. Given a base, radix, and a length, m, there are radix^m distinct numeral strings. Given an integer x such that 0 ≤ x < radix^m, the integer-to-string function, denoted by STR^m_radix(x), is the numeral string of length m in base radix that represents x, when the numerals are in decreasing order of significance. For example, STR^4_12(559) is the string of four numerals in base 12 that represents 559, namely, 0 3 10 7. An algorithm for computing STR^m_radix(x) is given in Sec. 4.6. A separate notation is given for the conversion of integers to byte strings, in particular, [x]^s = STR^8s_2(x). For example, [1]^1 = 00000001. Given a (non-empty) numeral string X in base radix of length m, the string-to-integer function, denoted by NUM_radix(X), is the integer x that X represents, so that STR^m_radix(x) = X. For example, NUM_5(00011010) = 755. An algorithm for computing NUM_radix(X) is given in Sec. 4.6. Similar notation is given for the function that converts bit strings to integers. In particular, given a byte string X, NUM(X) is the integer x that X represents, so that [NUM(X)]^BYTELEN(X) = X. For example, NUM(10000000) = 128. An algorithm for computing NUM(X) is given in Sec. 4.6. Given a numeral string, X, the string REV(X) is the sequence of numerals of X in reverse order. For example, in base ten, REV(13579) = 97531. Given a byte string, X, the string REVB(X) is the sequence of bytes of X in reverse order. For example, REVB([1] || [2] || [3]) = [3] || [2] || [1].](assets/38g/p0013-notation-examples.png)

![Algorithm 1: NUM_radix(X). Prerequisite: Base, radix. Input: Numeral string, X. Output: Number, x. Steps: 1. Let x = 0. 2. For i from 1 to LEN(X), let x = x·radix + X[i]. 3. Return x. Algorithm 2: NUM(X). Input: Byte string, X, represented in bits. Output: Integer, x. Steps: 1. Let x = 0. 2. For i from 1 to LEN(X), let x = 2x + X[i]. 3. Return x. Algorithm 3: STR^m_radix(x). Prerequisites: Base, radix; String length, m. Input: Integer, x, such that 0 ≤ x < radix^m. Output: Numeral string, X. Steps: 1. For i from 1 to m: i. X[m+1−i] = x mod radix; ii. x = ⌊x/radix⌋. 2. Return X.](assets/38g/p0017-algorithms-1-3.png)
![Algorithm 4: REV(X). Input: Numeral string, X. Output: Numeral string, Y. Steps: 1. For i from 1 to LEN(X), let Y[i] = X[LEN(X)+1−i]. 2. Return Y[1..LEN(X)]. Algorithm 5: REVB(X). Input: Byte string, X, represented in bits. Output: Byte string, Y, represented in bits. Steps: 1. For i from 0 to BYTELEN(X)−1 and j from 1 to 8, let Y[8i+j] = X[8·(BYTELEN(X)−1−i)+j]. 2. Return Y[1..8·BYTELEN(X)]. Algorithm 6: PRF(X). Prerequisites: Designated cipher function, CIPH, of an approved 128-bit block cipher; Key, K, for the block cipher. Input: Block string, X. Output: Block, Y. Steps: 1. Let m = LEN(X)/128. 2. Let X_1, …, X_m be the blocks for which X = X_1 || … || X_m. 3. Let Y_0 = 0^128, and for j from 1 to m let Y_j = CIPH_K(Y_(j−1) ⊕ X_j). 4. Return Y_m.](assets/38g/p0018-algorithms-4-6.png)
![Algorithm 7: FF1.Encrypt(K, T, X), first part (title, prerequisites, inputs and output; the steps continue on the next page). Prerequisites: Designated cipher function, CIPH, of an approved 128-bit block cipher; Key, K, for the block cipher; Base, radix; Range of supported message lengths, [minlen..maxlen]; Maximum byte length for tweaks, maxTlen. Inputs: Numeral string, X, in base radix of length n, such that n ∈ [minlen..maxlen]; Tweak T, a byte string of byte length t, such that t ∈ [0..maxTlen]. Output: Numeral string, Y, such that LEN(Y) = n.](assets/38g/p0019-algorithm-7-header.png)
![Algorithm 7: FF1.Encrypt(K, T, X), continued: steps. Steps: 1. Let u = ⌊n/2⌋; v = n − u. 2. Let A = X[1..u]; B = X[u+1..n]. 3. Let b = ⌈⌈v·LOG(radix)⌉/8⌉. 4. Let d = 4⌈b/4⌉ + 4. 5. Let P = [1]^1 || [2]^1 || [1]^1 || [radix]^3 || [10]^1 || [u mod 256]^1 || [n]^4 || [t]^4. 6. For i from 0 to 9: i. Let Q = T || [0]^((−t−b−1) mod 16) || [i]^1 || [NUM_radix(B)]^b. ii. Let R = PRF(P || Q). iii. Let S be the first d bytes of the following string of ⌈d/16⌉ blocks: R || CIPH_K(R ⊕ [1]^16) || CIPH_K(R ⊕ [2]^16) … CIPH_K(R ⊕ [⌈d/16⌉ − 1]^16). iv. Let y = NUM(S). v. If i is even, let m = u; else, let m = v. vi. Let c = (NUM_radix(A) + y) mod radix^m. vii. Let C = STR^m_radix(c). viii. Let A = B. ix. Let B = C. 7. Return A || B.](assets/38g/p0020-algorithm-7-steps.png)
![Algorithm 8: FF1.Decrypt(K, T, X). Prerequisites: Designated cipher function, CIPH, of an approved 128-bit block cipher; Key, K, for the block cipher; Base, radix; Range of supported message lengths, [minlen..maxlen]; Maximum byte length for tweaks, maxTlen. Inputs: Numeral string, X, in base radix of length n, such that n ∈ [minlen..maxlen]; Tweak T, a byte string of byte length t, such that t ∈ [0..maxTlen]. Output: Numeral string, Y, such that LEN(Y) = n. Steps: 1. Let u = ⌊n/2⌋; v = n − u. 2. Let A = X[1..u]; B = X[u+1..n]. 3. Let b = ⌈⌈v·LOG(radix)⌉/8⌉. 4. Let d = 4⌈b/4⌉ + 4. 5. Let P = [1]^1 || [2]^1 || [1]^1 || [radix]^3 || [10]^1 || [u mod 256]^1 || [n]^4 || [t]^4. 6. For i from 9 to 0: i. Let Q = T || [0]^((−t−b−1) mod 16) || [i]^1 || [NUM_radix(A)]^b. ii. Let R = PRF(P || Q). iii. Let S be the string of the first d bytes of the following string of ⌈d/16⌉ blocks: R || CIPH_K(R ⊕ [1]^16) || CIPH_K(R ⊕ [2]^16) … CIPH_K(R ⊕ [⌈d/16⌉ − 1]^16). iv. Let y = NUM(S). v. If i is even, let m = u; else, let m = v. vi. Let c = (NUM_radix(B) − y) mod radix^m. vii. Let C = STR^m_radix(c). viii. Let B = A. ix. Let A = C. 7. Return A || B.](assets/38g/p0021-algorithm-8.png)
![FF3 parameter requirements followed by Algorithm 9: FF3.Encrypt(K, T, X). Requirements (bulleted): radix ∈ [2..2^16]; radix^minlen ≥ 100; and 2 ≤ minlen ≤ maxlen ≤ 2⌊log_radix(2^96)⌋. Algorithm 9: FF3.Encrypt(K, T, X). Prerequisites: Designated cipher function, CIPH, of an approved 128-bit block cipher; Key, K, for the block cipher; Base, radix; Range of supported message lengths, [minlen..maxlen]. Inputs: Numeral string, X, in base radix of length n, such that n ∈ [minlen..maxlen]; Tweak bit string, T, such that LEN(T) = 64. Output: Numeral string, Y, such that LEN(Y) = n. Steps: 1. Let u = ⌈n/2⌉; v = n − u. 2. Let A = X[1..u]; B = X[u+1..n]. 3. Let T_L = T[0..31] and T_R = T[32..63]. 4. For i from 0 to 7: i. If i is even, let m = u and W = T_R, else let m = v and W = T_L. ii. Let P = W ⊕ [i]^4 || [NUM_radix(REV(B))]^12. iii. Let S = REVB(CIPH_REVB(K) REVB(P)). iv. Let y = NUM(S). v. Let c = (NUM_radix(REV(A)) + y) mod radix^m. vi. Let C = REV(STR^m_radix(c)). vii. Let A = B. viii. Let B = C. 5. Return A || B.](assets/38g/p0022-algorithm-9.png)
![Algorithm 10: FF3.Decrypt(K, T, X). Prerequisites: Designated cipher function, CIPH, of an approved 128-bit block cipher; Key, K, for the block cipher; Base, radix; Range of supported message lengths, [minlen..maxlen]. Inputs: Numeral string, X, in base radix of length n, such that n ∈ [minlen..maxlen]; Tweak bit string, T, such that LEN(T) = 64. Output: Numeral string, Y, such that LEN(Y) = n. Steps: 1. Let u = ⌈n/2⌉; v = n − u. 2. Let A = X[1..u]; B = X[u+1..n]. 3. Let T_L = T[0..31] and T_R = T[32..63]. 4. For i from 7 to 0: i. If i is even, let m = u and W = T_R, else let m = v and W = T_L. ii. P = W ⊕ [i]^4 || [NUM_radix(REV(A))]^12. iii. Let S = REVB(CIPH_REVB(K) REVB(P)). iv. Let y = NUM(S). v. Let c = (NUM_radix(REV(B)) − y) mod radix^m. vi. Let C = REV(STR^m_radix(c)). vii. Let B = A. viii. Let A = C. 5. Return A || B.](assets/38g/p0023-algorithm-10.png)
![Appendix E: References, entries [1] to [13]. [1] M. Bellare, P. Rogaway, and T. Spies, The FFX Mode of Operation for Format-Preserving Encryption, Draft 1.1, February 20, 2010, http://csrc.nist.gov/groups/ST/toolkit/BCM/documents/proposedmodes/ffx/ffx-spec.pdf [accessed 2/18/2016]. [2] M. Bellare, P. Rogaway, and T. Spies, Addendum to “The FFX Mode of Operation for Format-Preserving Encryption”: A parameter collection for enciphering strings of arbitrary radix and length, Draft 1.0, September 3, 2010, http://csrc.nist.gov/groups/ST/toolkit/BCM/documents/proposedmodes/ffx/ffx-spec2.pdf [accessed 2/18/2016]. [3] E. Brier, T. Peyrin, and J. Stern, BPS: a Format-Preserving Encryption Proposal, [April 2010], http://csrc.nist.gov/groups/ST/toolkit/BCM/documents/proposedmodes/bps/bps-spec.pdf [accessed 2/18/2016]. [4] Y-A. de Montjoye, L. Radaelli, V. Kumar Singh, and A. Pentland, “Unique in the shopping mall: On the reidentifiability of credit card metadata,” Science, vol. 347 no. 6221 (January 30, 2016), pp. 536-539, http://dx.doi.org/10.1126/science.1256297. [5] M. Dworkin and R. Perlner, Analysis of VAES3 (FF2), Report no. 2015/306, IACR Cryptology ePrint Archive, April 2, 2015, http://eprint.iacr.org/2015/306 [accessed 2/18/2016]. [6] M. Liskov, R. Rivest, and D. Wagner, “Tweakable block ciphers,” in Advances in Cryptology—CRYPTO 2002, Lecture Notes in Computer Science 2442, Berlin: Springer, pp. 31–46, September 13, 2002, http://dx.doi.org/10.1007/3-540-45708-9_3. [7] M. Luby and C. Rackoff, “How to construct pseudorandom permutations from pseudorandom functions,” SIAM Journal on Computing, vol. 17 no. 2 (1988), pp. 373–386, http://dx.doi.org/10.1137/0217022. [8] National Institute of Standards and Technology, Explanation of changes to Draft SP 800-38G, June 27, 2014, http://csrc.nist.gov/news_events/news_archive/news_archive_2014.html#june27 [accessed 2/18/2016]. [9] National Institute of Standards and Technology, Cryptographic Algorithm Validation Program (CAVP), http://csrc.nist.gov/groups/STM/cavp/index.html [accessed 2/18/2016]. [10] National Institute of Standards and Technology, Federal Information Processing Standard (FIPS) 197, The Advanced Encryption Standard (AES), November 2001, http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf [accessed 2/18/2016]. [11] National Institute of Standards and Technology. NIST Special Publication (SP) 800-38A, Recommendation for Block Cipher Modes of Operation—Methods and Techniques, December 2001, http://dx.doi.org/10.6028/NIST.SP.800-38A. [12] National Institute of Standards and Technology. NIST Special Publication (SP) 800-67 Revision 1, Recommendation for the Triple Data Encryption Algorithm (TDEA) Block Cipher, January 2012, http://dx.doi.org/10.6028/NIST.SP.800-67r1. [13] National Institute of Standards and Technology. NIST Special Publication (SP) 800-133, Recommendation for Cryptographic Key Generation, December 2012, http://dx.doi.org/10.6028/NIST.SP.800-133.](assets/38g/p0027-references.png)
![Appendix E: References (continued), entries [14] to [16]. [14] J. Patarin, Generic attacks on Feistel schemes, Report no. 2008/036, IACR Cryptology ePrint Archive, January 24, 2008, http://eprint.iacr.org/2008/036 [accessed 2/18/2016]. [15] R. Schroeppel, Hasty Pudding Cipher specification [Web page], June 1998 (revised May 1999), http://richard.schroeppel.name:8015/hpc/hpc-spec [accessed 2/18/2016]. [16] J. Vance and M. Bellare, An extension of the FF2 FPE Scheme: Submission to NIST, July 2, 2014, http://csrc.nist.gov/groups/ST/toolkit/BCM/documents/proposedmodes/dff/dff-ff2-fpe-scheme-update.pdf [accessed 2/18/2016].](assets/38g/p0028-references.png)