Page 1 Страница 1
NIST Special Publication 800-38G NIST Special 800-38G публикации
Draft Проект
Recommendation for Block Cipher Рекомендация для блочного шифра
Modes of Operation: Режимы работы:
Methods for Format-Preserving Методы Формат сохраняющих
Encryption Шифрование
Morris Dworkin Моррис Дворкин
COMPUTER КОМПЬЮТЕРНЫЕ
SECURITY БЕЗОПАСНОСТЬ

Page 2 Страница 2

Page 3 Page 3
NIST Special Publication 800-38G NIST Special 800-38G публикации
Draft Проект
Recommendation for Block Cipher Рекомендация для блочного шифра
Modes of Operation: Режимы работы:
Methods for Format-Preserving Методы Формат сохраняющих
Encryption Шифрование
Morris Dworkin Моррис Дворкин
Computer Security Division Отдел компьютерной безопасности
Information Technology Laboratory Лаборатория информационных технологий
July, 2013 Июля 2013 г.
US Department of Commerce Министерство торговли США
Cameron F. Kerry, Acting Secretary Камерон Ф. Керри, исполняющий обязанности секретаря
National Institute of Standards and Technology Национальный институт стандартов и технологий
Patrick D. Gallagher, Under Secretary of Commerce for Standards and Technology and Director Патрик Д. Галлахер, заместитель министра торговли для стандартов и технологий и директора

Page 4 Страница 4
NIST Special Publication 800-38G NIST Special 800-38G публикации
DRAFT ПРОЕКТ
ii II
Authority Власть
This publication has been developed by NIST to further its statutory responsibilities under the Эта публикация была разработана NIST для достижения своих уставных обязанностей в соответствии с
Federal Information Security Management Act (FISMA), Public Law (PL) 107-347. Федеральный закон управления информационной безопасностью (FISMA), публичное право (PL) 107-347. NIST is NIST является
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, Section 8b(3), Securing Управления управления и бюджета (OMB) циркуляр-130, Раздел 8b (3), Обеспечение
Agency Information Systems , as analyzed in Circular A-130, Appendix IV: Analysis of Key Агентство информационных систем, как было проанализировано в циркуляр-130, Приложение IV: анализ ключевых
Sections . Разделы. Supplemental information is provided in Circular A-130, Appendix III, Security of Справочная информация предоставляется в циркуляр-130, Приложение III, безопасности
Federal Automated Information Resources . Федеральные Автоматизированные информационные ресурсы.
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. Присвоение бы, однако, иметь в виду, по NIST.
National Institute of Standards and Technology Special Publication 800-38G Национальный институт стандартов и технологии Специальный 800-38G публикации
Natl. Natl. Inst. Ин-т. Stand. Стенд. Technol. Technol. Spec. Spec. Publ. Изд. 800-38G, NNN pages (Month YYYY) 800-38G, NNN страницы (Месяц ГГГГ)
http://dx.doi.org/10.6028/NIST.SP.XXX http://dx.doi.org/10.6028/NIST.SP.XXX
CODEN: NSPUE2 CODEN: NSPUE2
Public comment period: Month Day, YYYY through Month Day, YYYY Период общественного обсуждения: Месяц, ГГГГ через месяц день, YYYY
National Institute of Standards and Technology Национальный институт стандартов и технологий
Attn: Computer Security Division, Information Technology Laboratory Внимание: Компьютер Отдел безопасности, Лаборатория информационных технологий
100 Bureau Drive (Mail Stop 8930) Gaithersburg, MD 20899-8930 100 Бюро Drive (Mail Stop 8930) Gaithersburg, MD 20899-8930
Email: EncryptionModes@nist.gov E-mail: EncryptionModes@nist.gov
Certain commercial entities, equipment, or materials may be identified in this document in order to Некоторые коммерческие организации, оборудование или материалы могут быть идентифицированы в данном документе для того, чтобы
describe an experimental procedure or concept adequately. описание экспериментальной процедуры или концепцию адекватно. Such identification is not intended to imply Такая идентификация не подразумевает
recommendation or endorsement by NIST, nor is it intended to imply that the entities, materials, or рекомендация или одобрение NIST, и это не подразумевает, что лица, материалы, или
equipment are necessarily the best available for the purpose. оборудование обязательно лучший средства для этой цели.
It is possible that implementation of modes included in this NIST Recommendation may involve an Вполне возможно, что реализация режимов включены в эту NIST Рекомендации может включать
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 Если патентообладатель подал с NIST письмо о Assurance (LOA) с
respect to any such patent rights, a copy of that LOA may be obtained from NIST. по любому из этих патентных прав, копия этого LOA могут быть получены из NIST.
There may be references in this publication to other publications currently under development by NIST Там могут быть ссылки в данной информации на других публикаций настоящее время разрабатывается в NIST
in accordance with its assigned statutory responsibilities. в соответствии с присвоенным ему законом ответственности. The information in this publication, including Информация, содержащаяся в данной публикации, в том числе
concepts and methodologies, may be used by Federal agencies even before the completion of such концепций и методов, могут быть использованы федеральными ведомствами еще до завершения таких
companion publications. компаньоны публикации. Thus, until each publication is completed, current requirements, guidelines, Таким образом, до тех пор, каждая публикация не будет завершено, текущие требования, руководящие принципы,
and procedures, where they exist, remain operative. и процедуры, где они существуют, оставаться работоспособными. For planning and transition purposes, Federal Для планирования и переходных целей, федеральными
agencies may wish to closely follow the development of these new publications by NIST. ведомствам рассмотреть внимательно следить за развитием этих новых публикаций NIST.
Organizations are encouraged to review all draft publications during public comment periods and Организациям рекомендуется пересмотреть все проекты публикации в периоды общественного обсуждения и
provide feedback to NIST. обеспечивать обратную связь с NIST. All NIST Computer Security Division publications, other than the ones Все Дивизион публикации NIST Computer Security, другие, чем те,
noted above, are available at http://csrc.nist.gov/publications. отмечалось выше, имеются в http://csrc.nist.gov/publications.

Page 5 Страница 5
NIST Special Publication 800-38G NIST Special 800-38G публикации
DRAFT ПРОЕКТ
iii III
Reports on Computer Systems Technology Отчеты о Computer Systems Technology
The Information Technology Laboratory (ITL) at the National Institute of Standards and Техническая лаборатория Информация (ITL) в Национальном институте стандартов и
Technology (NIST) promotes the US economy and public welfare by providing technical Технологии США (NIST) способствует американскую экономику и общественное благосостояние, путем предоставления технической
leadership for the Nation's measurement and standards infrastructure. руководство для инфраструктуры измерения и стандартов нации. ITL develops tests, test ITL разрабатывает тесты, тест
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 Обязанности ITL включают
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, Специальный Издание сообщает, 800-серии на исследования ITL в,
guidelines, and outreach efforts in information system security, and its collaborative activities руководящие принципы, и усилия аутрич в безопасности информационной системы, и ее совместные мероприятия
with industry, government, and academic organizations. с промышленностью, правительством и научными организациями.
Abstract Аннотация
This Recommendation specifies three methods for format-preserving encryption, called FF1, В данной Рекомендации определены три способа формате сохраняющих шифрования, называемых FF1,
FF2, and FF3. FF2 и FF3. Each of these methods is a mode of operation of the AES algorithm, which is used Каждый из этих методов является режим работы алгоритма AES, который используется
to construct a round function within the Feistel structure for encryption. построить круглую функцию в структуре Фейстеля для шифрования.
Keywords Ключевые слова
block cipher; блочный шифр; computer security; компьютерной безопасности; confidentiality; конфиденциальность; cryptography; криптография; encryption; шифрование; Feistel structure; Структура Фейстель;
format-preserving encryption; Формат сохраняющих шифрование; information security; информационная безопасность; mode of operation. режим работы.
Acknowledgements Благодарности
Much of the text in this publication is adapted from four specification documents that were Значительная часть текста в этой публикации, взяты из четырех нормативных документов, которые были
submitted to NIST: Mihir Bellare, Phil Rogaway, and Terence Spies submitted the FFX представлен NIST: Mihir Bellare, Фил Rogaway, и Теренс Спайс представлены FFX
framework and FFX[Radix] in [1 ] a nd [2]; рамки и FFX [Radix] в [1 ] в го [2]; Eric Brier, Thomas Peyrin, and Jacques Stern Эрик Шиповник, Томас Peyrin, и Жак Стерн
submitted BPS in [3] , and Joachim Vance submitted VAES3 in [13]. представлены BPS в [3] , и Йоахим Вэнс представлены VAES3 в [13].
In addition to the designers, the author wishes to thank his colleagues who reviewed drafts of this В дополнение к дизайнерам, автор хотел бы поблагодарить своих коллег, которые рассмотрели проекты это
publication and contributed to its development, especially Elaine Barker, Meltem Somnez Turan, Публикация и вклад в его развитие, особенно Элейн Баркер, Мелтем Somnez Турана,
Lily Chen, John Kelsey, Ray Perlner, Allen Roginsky, Lawrence Bassham, Tim Hall, and Sharon Лили Чен, Джон Келси, Рэй Perlner, Аллен Рогинский, Лоуренс Bassham, Тим Холл, и Шарон
Keller. Келлер. The author also gratefully acknowledges the comments from the public and private Автор также выражает благодарность за комментарии от государственных и частных
sectors to improve the quality of this publication. сектора для улучшения качества данной публикации.

Page 6 Page 6
NIST Special Publication 800-38G NIST Special 800-38G публикации
DRAFT ПРОЕКТ
iv IV
TABLE OF CONTENTS СОДЕРЖАНИЕ
1 1
PURPOSE..............................................................................................................................................................1
2 2
AUTHORITY........................................................................................................................................................1
3 3
INTRODUCTION ВВЕДЕНИЕ ................................................................................................................................................1
4 4
DEFINITIONS AND ОПРЕДЕЛЕНИЯ И NOTATION......................................................................................................................3
4.1 D 4.1 D
EFINITIONS ПРЕДЕЛЕНИЯ
....................................................................................................................................................3
4.2 A 4.2
CRONYMS CRONYMS
......................................................................................................................................................5
4.3 O 4.3 O
PERATIONS AND PERATIONS И
F F
UNCTIONS УНКЦИИ
.........................................................................................................................5
4.4 E 4.4 E
XAMPLES OF XAMPLES OF
B B
ASIC ASIC
O O
PERATIONS AND PERATIONS И
F F
UNCTIONS УНКЦИИ
........................................................................................6 .................................................. ...................................... 6
5 5
PRELIMINARIES................................................................................................................................................8
5.1 C 5.1 C
HARACTER HARACTER
S S
TRINGS TRINGS
......................................................................................................................................8
5.2 U 5.2 U
NDERLYING NDERLYING
B B
LOCK ЗАМОК
C C
IPHER AND IPHER И
K K
EY EY
...........................................................................................................8
5.3 E 5.3 E
NCRYPTION AND NCRYPTION И
D D
ECRYPTION ECRYPTION
F F
UNCTIONS УНКЦИИ
....................................................................................................9
5.4 F 5.4 F
EISTEL EISTEL
S S
TRUCTURE Туру
......................................................................................................................................10
5.5 C 5.5 C
OMPONENT OMPONENT
F F
UNCTIONS УНКЦИИ
...............................................................................................................................11
6 6
MODE РЕЖИМ SPECIFICATIONS...............................................................................................................................13
6.1 6.1 FF1................................................................................................................................................................14
6.2 6.2 FF2................................................................................................................................................................16
6.3 6.3 FF3................................................................................................................................................................19
7 7
CONFORMANCE..............................................................................................................................................21
8 8
REFERENCES....................................................................................................................................................21
APPENDIX A: PARAMETER CHOICES ПРИЛОЖЕНИЕ: Параметр ВЫБОР ............................................................................................................23
APPENDIX B: SECURITY GOAL ПРИЛОЖЕНИЕ B: БЕЗОПАСНОСТЬ ЦЕЛЬ .........................................................................................................................23
APPENDIX C: ПРИЛОЖЕНИЕ C: TWEAKS.........................................................................................................................................23
TABLE OF FIGURES Список иллюстраций
Figure 1: Illustration of the Feistel Structure................................................................................ 11 Рисунок 1: Иллюстрация структуры Feistel .......................................... ...................................... 11

Page 7 Страница 7
NIST Special Publication 800-38G NIST Special 800-38G публикации
DRAFT ПРОЕКТ
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). Формат сохраняющих шифрования (ФПО).
2 Authority 2 Орган
This publication has been developed by the National Institute of Standards and Technology Эта публикация была разработана Национальным институтом стандартов и технологии
(NIST) in furtherance of its statutory responsibilities under the Federal Information Security (NIST) в реализации его уставных обязанностей в соответствии с Федеральным информационной безопасности
Management Act (FISMA) of 2002, Public Law 107-347. Закон об управлении (FISMA) 2002, Public Law 107-347.
NIST is responsible for developing standards and guidelines, including minimum requirements NIST отвечает за разработку стандартов и руководящих принципов, включая минимальные требования
for federal information systems, but such standards and guidelines shall not apply to national для федеральных информационных систем, но таких стандартов и руководящих принципов, не применяются к национальным
security systems. системы безопасности.
This recommendation has been prepared for use by Federal agencies. Эта рекомендация была подготовлена ​​для использования федеральными ведомствами. It may be used by Это может быть использовано
nongovernmental organizations on a voluntary basis and is not subject to copyright. неправительственные организации на добровольной основе и не охраняется авторским правом. (Attribution (Attribution
would be appreciated by NIST.) будет понятно NIST.)
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. Власти министра торговли, директор Административно-бюджетное управление, или любой другой федеральный чиновник.
Conformance testing for implementations of this Recommendation will be conducted within the Аттестационного тестирования для реализаций данной Рекомендации будет проводиться в рамках
framework of the Cryptographic Algorithm Validation Program (CAVP) and the Cryptographic рамки алгоритма проверки программы Cryptographic (CAVP) и криптографической
Module Validation Program (CMVP). Модуль проверки Программа (CMVP). The requirements of this Recommendation are indicated Требования настоящей Рекомендации указаны
by the word “shall.” Some of these requirements may be out-of-scope for CAVP or CMVP словом "должны". Некоторые из этих требований может быть вне сферы для CAVP или CMVP
validation testing, and thus are the responsibility of entities using, implementing, installing, or Тестирование проверки, и, таким образом, находятся в ведении субъектов использованием, реализации, установке и
configuring applications that incorporate this Recommendation. настройке приложений, которые включают эту рекомендацию.
3 Introduction 3 Введение
This publication specifies three block cipher modes of operation—or, simply, modes—for Эта публикация определяет три режима блочного шифра работы-или просто режимы-для
format-preserving encryption (FPE). Формат сохраняющих шифрования (ФПО).
Previously approved encryption modes transform bit strings—sequences of 0 s and 1 s—into Ранее утвержденные режимы шифрования преобразования битовых строк-последовательности 0 с и 1 с записанными в
other bit strings, but these modes are not directly applicable to decimal strings, like Social другие битовые строки, но эти режимы не имеют прямого применения в десятичных строк, как социально
Security numbers (SSNs) or credit card numbers (CCNs), or to other data formats. Номера безопасности (ПКР) или номера кредитных карт (CCNS), или в другие форматы данных.
Given any finite set of symbols, like the decimal numerals, 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 and length as the original data. Формат и длины, что и исходные данные. Thus, an FPE-encrypted SSN also appears to be an SSN. Таким образом, ФПО-зашифрованы SSN-видимому, также SSN.

Page 8 Страница 8
NIST Special Publication 800-38G NIST Special 800-38G публикации
DRAFT ПРОЕКТ
2 2
Consequently, 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 because it would disrupt data fields/pathways. Режим не может быть возможным, поскольку это нарушит полей данных / пути. FPE has emerged as a FPE стала
useful cryptographic tool, whose applications include financial-information security, data полезно криптографической инструмент, чьи заявления включают безопасности, данные финансово-информационные
sanitization, and transparent encryption of fields in legacy databases. санитарная обработка и прозрачное шифрование полей в унаследованных баз данных.
The three FPE modes specified in this publication are abbreviated FF1, FF2, and FF3, to indicate Три режима FPE, указанные в данном документе, сокращенно FF1, FF2 и FF3, чтобы указать
that they are format-preserving, Feistel-based encryption modes. что они в формате сохраняющих, режимы шифрования Фейстель основе. They were submitted to NIST Они были представлены в NIST
under the names FFX[Radix], VAES3, and BPS-BC, in [2] , [1 3], and [3], respectively. под названиями FFX [Radix], VAES3, и БПС-BC, в [2] , [1 3], и [3] соответственно. Each Каждый
mode fits within a larger framework, called FFX, for constructing FPE mechanisms, that was Режим подходит в более широких рамках, под названием FFX, для построения механизмов FPE, что было
submitted to NIST in [ 1]. The “X” indicates the flexibility to instantiate the framework with представлен NIST в [ 1]. "X" указывает на гибкость для создания экземпляра базы с
different parameter sets, as well as FFX's evolution from the FFSEM specification earlier различных наборов параметров, а также эволюция FFX от спецификация FFSEM ранее
submitted to NIST in [12]. представлен NIST в [12].
The FFX framework itself is not specified in this publication; Сам каркас FFX не указано в этой публикации; in fact, FF1, FF2, and FF3 are not В самом деле, FF1, FF2, FF3 и не
presented explicitly as instantiations of FFX parameter sets, but rather as separate algorithms, in представлены в явном виде, как инстанциаций наборов параметров Ffx, а в виде отдельных алгоритмов, в
order to simplify the individual specifications. Чтобы упростить отдельные спецификации.
FF1, FF2, and FF3 each employ the Feistel structure of encryption—see Sec. 5. 4—which also FF1, FF2, и FF3 друг применять структуру Фейстеля шифрования-см. 5. 4-который также
underlies the Data Encryption Algorithm [8] . лежит в основе алгоритма шифрования данных [8] . At the core of FF1, FF2, and FF3 are somewhat В основе FF1, FF2, FF3 и несколько
different Feistel round functions that are derived from an approved block cipher with 128-bit различные круглые функции Фейстеля, которые вытекают из утвержденного блочного шифра с 128-бит
blocks, ie, the AES algorithm блоки, то есть, алгоритм AES
1 1
[6]. [6].
In addition to the formatted data for which the modes provide confidentiality, each mode also В дополнение к форматированных данных, для которых режимы обеспечивают конфиденциальность, каждый режим также
takes a “tweak” input, ie, additional information that is not necessarily secret. берет "подправить" вход, то есть дополнительную информацию, которая не обязательно секрет. This functionality Эта функциональность
can be especially important for FPE modes, because the number of possible values for the может быть особенно важно для режимов FPE, так как число возможных значений для
confidential data is often relatively small. конфиденциальные данные часто относительно небольшим. In particular, the encrypted form of the data can vary В частности, зашифрованном виде данных может изменяться
in different instances when the tweak inputs are different. в разных случаях, когда входы TWEAK отличаются. See Appendix C for further discussion Приложение C для дальнейшего обсуждения
of tweaks. твиков.
The three modes offer somewhat similar performance profiles. Три режима предлагают несколько схожие профили производительности. FF1 supports the greatest range of FF1 поддерживает самый широкий диапазон
lengths for the protected, formatted data and the tweak. длины для охраняемых, отформатированных данных и настроить. FF2 generates a subkey for the block FF2 генерирует подраздел для блока
cipher in the Feistel round function, which can help protect the original key from side-channel шифр в круглом функции Feistel, которые могут помочь защитить оригинальный ключ от боковой канал
analysis. Анализ. FF3 offers the lowest round count, eight, compared to ten for FF1 and FF2, and is the FF3 предлагает самую низкую круглую количество, восемь, десять по сравнению с по FF1 и FF2 и является
least flexible in the tweaks that it supports. наименее гибким в твиков, которые он поддерживает.
The BPS mechanism for FPE—named after its designers, Brier, Peyrin, and Stern—was Механизм BPS для ФПО-имени своих дизайнеров, Brier, Peyrin, и Стерн-был
submitted to NIST in [3] ; представлен NIST в [3] ; FF3 is essentially equivalent to the BPS-BC component of BPS, FF3 существу эквивалентно BPS-BC составляющей БТС,
instantiated with a 128-bit block cipher. создается с помощью 128-битного блочного шифра. The full BPS mode—in particular, its chaining Режим-в полном BPS частности, его цепочки
mechanism for longer input strings—is not approved in this Recommendation. Механизм для длинных входных строк-не утверждены в настоящей Рекомендации.
1 1
The term “algorithm” here indicates a high-level cryptographic technique that may encompass more than one Термин "алгоритм" здесь означает криптографической техникой высокого уровня, которые могут включать более одного
computational procedure; Вычислительная процедура; for example, an “encryption algorithm” like the AES algorithm has transformations for например, "алгоритм шифрования" как алгоритма AES имеет преобразования для
both encryption and decryption. как шифрование и дешифрование. This publication also contains ten numbered algorithms in the original sense of the Эта публикация также содержит десять пронумерованных алгоритмов в первоначальном смысле
word, ie, as a list of instructions for executing a single computational procedure. слово, то есть, как список команд для выполнения одного вычислительной процедуры.

Page 9 Страница 9
NIST Special Publication 800-38G NIST Special 800-38G публикации
DRAFT ПРОЕКТ
3 3
4 Definitions and Notation 4 Определения и обозначения
4.1 Definitions 4.1 Определения
alphabet алфавит
A finite set of two or more symbols. Конечное множество из двух или более символов.
approved утвержден
FIPS-approved or NIST-recommended: an algorithm or technique FIPS утвержденных или NIST-рекомендуется: алгоритм или технику
that is either 1) specified in a FIPS or a NIST Recommendation, or что это либо 1), указанных в ФИПС или рекомендацией NIST, или
2) adopted in a FIPS or a NIST Recommendation. 2) принят в ФИПС или рекомендацией NIST.
base база
The number of characters in a given alphabet; Символов в данном алфавите число; represented as radix представлен в виде системы счисления
in this publication. в данной публикации.
bit немного
A binary digit: 0 or 1. Двоичная цифра: 0 или 1.
bit string битовая строка
A finite, ordered sequence of bits. Конечное, упорядоченная последовательность битов.
block блок
For a given block cipher, a bit string whose length is the block size Для данного блочного шифра, битовая строка, длина которой является размер блока
of the block cipher. блочного шифра.
block cipher блочный шифр
A parameterized family of permutations on bit strings of a fixed Параметризованный семья перестановок на битовых строк из фиксированного
length; длина; the parameter that determines the permutation is a bit string параметр, который определяет перестановку немного строка
called the key. называют ключом.
block cipher блочный шифр
mode of operation Режим работы
An algorithm for the cryptographic transformation of data that is Алгоритм криптографического преобразования данных, что является
based on a block cipher. на основе блочного шифра.
block size Размер блока
For a given block cipher and key, the fixed length of the input (or Для данного блочного шифра и ключа, фиксированной длины входа (или
output) bit strings. выход) битовые строки.
block string Блок строка
A bit string that can be represented as the concatenation of a finite, Немного строка, которая может быть представлена ​​в виде конкатенации конечное,
ordered sequence of blocks. упорядоченная последовательность блоков.
byte байт
A string of eight bits. Строка из восьми битов.
byte string строка байт
A bit string that can be represented as the concatenation of a finite, Немного строка, которая может быть представлена ​​в виде конкатенации конечное,
ordered sequence of bytes. упорядоченная последовательность байт.
character характер
A symbol in an alphabet. Символ в алфавите.
character string строка символов
A finite, ordered sequence of characters. Конечное, упорядоченная последовательность символов.
ciphertext зашифрованный текст
The numeral string that is the encrypted form of a plaintext. Цифра строка, зашифрованная форма текста.

Page 10 Страница 10
NIST Special Publication 800-38G NIST Special 800-38G публикации
DRAFT ПРОЕКТ
4 4
decryption расшифровка
function функция
For a given block cipher and key, the function of an FPE mode that Для данного блочного шифра и ключа, функция режиме FPE что
takes a ciphertext numeral string and a tweak as input and returns принимает зашифрованного текста позицией строку и твик в качестве входных данных и возвращает
the corresponding plaintext numeral string as output. соответствующий открытый текст цифра строка на выходе.
designated cipher обозначены шифр
function функция
For a given block cipher and key, the choice of either the forward Для данного блочного шифра и ключа, в котором стоит либо форварда
transformation or the inverse transformation. преобразование или обратное преобразование.
encryption Шифрование
function функция
For a given block cipher and key, the function of an FPE mode that Для данного блочного шифра и ключа, функция режиме FPE что
takes a plaintext numeral string and a tweak as input and returns a занимает в текстовой позицией строку и твик в качестве входных данных и возвращает
ciphertext numeral string as output. зашифрованный текст цифра строка на выходе.
exclusive-OR исключающее ИЛИ
The bitwise addition, modulo 2, of two bit strings of equal length. Побитовое сложение по модулю 2, из двух битовых строк равной длины.
Feistel structure Структура Фейстель
A framework for constructing an encryption mode. Основа для построения режим шифрования. The framework Рамки
consists of several iterations, called rounds, in which 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; для того, чтобы изменить другую часть данных; the roles of the two роли два
parts are swapped for the next round. части меняются местами для следующего раунда.
forward вперед
transformation преобразование
For a given block cipher, the permutation of blocks that is Для данного блочного шифра, перестановка блоков, что это
determined by the choice of a key. определяется выбором ключа.
inverse обратная
transformation преобразование
For a given block cipher, the inverse of the permutation of blocks Для данного блочного шифра, обратной перестановки блоков
that is determined by the choice of a key. , что определяется выбором ключа.
key ключ
For a given block cipher, the secret bit string that parameterizes the Для данного блочного шифра, секрет битовая строка, что параметризует
permutations. перестановки.
mode режим
See “block cipher mode of operation.” Смотреть "блочный шифр режим работы."
numeral цифра
For a given base, a nonnegative integer less than the base. Для данной базы, неотрицательное целое меньше, чем базовая.
numeral string цифра строка
For a given base, a character string that is comprised of numerals for Для данной базы, символьной строки, которая состоит из цифр для
the base. Основание.
plaintext открытый текст
A numeral string whose confidentiality is protected by an FPE Цифра цепочка, конфиденциальность защищена ФПО
mode. Режим.
prerequisite Предпосылкой
A required input to an algorithm that has been established prior to Требуется вход алгоритма, который был установлен перед
the invocation of the algorithm. вызов алгоритма.
shall должен
Is required to. Требуется, чтобы. Requirements apply to conforming implementations. Требования распространяются на соответствующих реализаций.
should должны
Is recommended to. Рекомендуется, чтобы.
tweak настроить
The input parameter to the encryption and decryption functions Входной параметр для шифрования и дешифрования функций
whose confidentiality is not protected by the mode. чья конфиденциальность не защищены режиме.

Page 11 Страница 11
NIST Special Publication 800-38G NIST Special 800-38G публикации
DRAFT ПРОЕКТ
5 5
4.2 Acronyms 4.2 Сокращения
AES AES
Advanced Encryption Standard. Advanced Encryption Standard.
CAVP CAVP
Cryptographic Algorithm Validation Program. Криптографического алгоритма проверки Программа.
CCN CCN
credit card number. номер кредитной карты.
CMVP CMVP
Cryptographic Module Validation Program. Криптографическая программы проверки.
FIPS FIPS
Federal Information Processing Standard. Федеральный стандарт обработки информации.
FISMA FISMA
Federal Information Security Management Act. Федеральный закон об управлении информационной безопасностью.
FPE FPE
format-preserving encryption. Формат сохраняющих шифрование.
IETF IETF
Internet Engineering Task Force. Internet Engineering Task Force.
ITL ITL
Information Technology Laboratory. Лаборатория информационных технологий.
NIST NIST
National Institute of Standards and Technology. Национальный институт стандартов и технологий.
PRF PRF
pseudorandom function. Функция псевдослучайных.
RFC RFC
Request For Comment. Просьбу о комментарии.
SSN SSN
Social Security number. Номер социального страхования.
4.3 Operations and Functions 4.3 Операции и функции
BYTELEN BYTELEN
(T) (T)
The number of bytes in a byte string, T . Число байтов в строку байтов, T.
CIPH CIPH
K K
( X ) (Х)
The output of the designated cipher function of the block cipher Выход обозначенной функции шифрования блочного шифра
under the key K applied to the block X . под ключ К применяется к блок-X.
LEN LEN
( X ) (Х)
The length of the character string X . Длина строки символов X.
LOG ВХОД
b б
( x ) (Х)
The base b logarithm of the real number x ≠ 0. Основание б логарифм реального числа х ≠ 0.
NUM NUM
radix основанию
( X ) (Х)
The number that the numeral string X represents in base radix , with Что цифра строка X представляет в базовой системы счисления число, с
the most significant character first. Наиболее значительным символов в первую очередь.
PRF PRF
( X ) (Х)
The output of the function Выход функции
PRF PRF
applied to the block X with the применяется к блок-X с

Page 12 Страница 12
NIST Special Publication 800-38G NIST Special 800-38G публикации
DRAFT ПРОЕКТ
6 6
designated cipher function of the block cipher under the key K . обозначается шифром функции блочного шифра под ключ K.
REV REV
( X ) (Х)
Given a bit string, X , the string that consists of the bits of X in Учитывая битовую строку, X, строку, состоящую из битов X в
reverse order. обратный порядок.
STR STR
m м
radix основанию
( x ) (Х)
Given a nonnegative integer x less than radix Учитывая неотрицательное целое х меньше основанию
m м
, the representation of , Представление
x as a string of m characters in base radix , with the most significant х в виде строки из м символов в базовых основанию, с наиболее значительным
character first. персонаж впервые.
⌊ 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 ] [X]
s с
Given a nonnegative integer x less than 256 Учитывая неотрицательное целое х менее 256
s с
, the representation of x , Представление х
as a string of s bytes. как строка с байт.
[ i .. j ] [Я .. J]
The set of integers between two integers i and j , including i and j . Множество целых чисел между двух целых чисел я и J, в том числе I и J.
x mod m х тойт
The nonnegative remainder of the real number x modulo the positive Неотрицательная Остальная часть вещественного числа х по модулю положительное
integer m. целое м.
X [ i ] X [я]
The i th character of the string X . Я-я символ строки X.
X [ i .. j ] X [я .. J]
The substring of characters of a string X from X [ i ] to X [ j ], including Подстрока символов строки X от X [I], чтобы X [J], в том числе
X [ i ] and X [ j ]. X [я] и X [J].
X ⊕ Y X ⊕ Y
The bitwise exclusive-OR of bit strings X and Y whose bit lengths Побитовое исключающее ИЛИ из битовых строк X и Y, длины разрядных
are equal. равны.
X || Y X || Y
The concatenation of bit strings X and Y . Объединение строк битов X и Y.
0 0
s с
The bit string that consists of s consecutive '0' bits. Битовая строка, которая состоит из с последовательными "0" бит.
4.4 Examples of Basic Operations and Functions 4.4 Примеры основных операций и функций
In this publication, the Courier New font indicates the two binary bits, 0 and 1 . В этой публикации, Courier New шрифтом выделяются два двоичных разрядов, 0 и 1.
Given positive real numbers b and x , the base b logarithm of x , denoted Учитывая положительные числа б и х, базы В логарифм х, обозначаемый
LOG ВХОД
b б
( x ), is the unique (Х), является единственным
real number for which b действительное число, для которого б
LOG ВХОД
b б
( x ) (Х)
= x . = Х. For example, Например,
LOG ВХОД
2 2
(64) = 6, (64) = 6,
LOG ВХОД
2 2
(10) ≈ 3.32, and (10) ≈ 3,32, и
LOG ВХОД
13 13
(169) = (169) =
2. 2.
Given a real number x , the floor function, denoted ⌊ x ⌋, is the greatest integer that does not exceed Учитывая действительное число х, функцию пола, обозначаемый ⌊ х ⌋, является наибольшее целое, не превосходящее
x . х. For example, ⌊2.1⌋= 2, and ⌊4⌋= 4. Например, ⌊2.1⌋ = 2, и ⌊4⌋ = 4.
Given a real number x , the ceiling function, denoted  x , is the least integer that is not less than x . Учитывая действительное число х, функцию потолка, обозначаемый  х , является наименее целое число, которое не меньше, чем х.
For example, 2.1 = 3, and 4 = 4. Например, 2.1 = 3, и 4 = 4.

Page 13 Страница 13
NIST Special Publication 800-38G NIST Special 800-38G публикации
DRAFT ПРОЕКТ
7 7
Given two integers i and j with i ≤ j , the set of integers between i and j , including i and j , is Даны два целых числа я и J с я ≤ J, множество целых чисел между I и J, в том числе I и J, является
denoted [ i .. j ]. обозначается [я .. J]. For example, [2 .. 5] = {2, 3, 4, 5}. Например, [2 .. 5] = {2, 3, 4, 5}.
Given a real number x , and a positive integer m , the remainder of x modulo m , denoted x mod m , Учитывая действительное число х, и натуральное число т, остаток х по модулю т, обозначается х тойт,
is x – m ⌊ x / m ⌋. является х - м ⌊ х / м ⌋. For example, 20 mod 7 = 6, and -3 mod 7 = 4. Например, 20 мод 7 = 6, и -3 мод 7 = 4.
Given a positive integer s , 0 Учитывая положительное целое число с, 0
s с
denotes the string that consists of s ' 0 ' bits. обозначает строку, состоящую из S '0 "бит. For example, 0 Например, 0
8 8
= =
00000000 . 00000000.
The concatenation operation on character strings is denoted ||. Операция конгатенации символьных строк обозначается ||. For example, 001 || 10111 = Например, 001 || 10111 =
00110111 , and if the base is 16, for example, 1 3 13 7 || 0 8 10 = 1 3 13 7 0 8 10. 00110111, а если основание 16, например, 1 3 13 7 || 0 8 10 1 3 = 13 7 0 8 10.
Given bit strings of equal length, the exclusive-OR (XOR) operation, denoted ⊕, specifies the Учитывая битовые строки равной длины, исключающее ИЛИ операция (XOR), обозначается ⊕, указывает
addition, modulo 2, of the bits in corresponding bit positions. Кроме того, по модулю 2, из битов в соответствующие позиции битов. For example, 10011 ⊕ 10101 = Например, 10011 10101 ⊕ =
00110 . 00110.
Given a character string X , the length of X is denoted С учетом строка символов X, длина X обозначается
LEN LEN
( X ). (Х). For example, Например,
LEN LEN
( %$$ ) = 3, and (% $$) = ​​3, и
LEN LEN
( 00010 ) = 5. (00010) = 5.
Given a byte string X , the length of X in bytes is denoted С учетом байтовую строку Х, длина в байтах X обозначается
BYTELEN BYTELEN
( X ). (Х). For example, Например,
BYTELEN BYTELEN
( 1011100110101100 ) = 2. (1011100110101100) = 2.
Given a character string X , and any index i , ie, with 1 ≤ i ≤ Учитывая символьной строки X и любой индекс I, то есть, с 1 ≤ ≤
LEN LEN
( X ), the i th character of X is (Х), I-й символ X является
denoted X [ i ]. обозначаемое X [я]. For a pair of indices ( i , j ), with 1≤ i ≤ j ≤ Для пары индексов (I, J), с 1≤ я ≤ J ≤
LEN LEN
( X ), the substring of characters from (X), подстрока из символов
X [ i ] to X [ j ] is denoted X [ i .. j ]. X [я] в X [J] обозначается X [я .. J]. For example, if X = &$*#@@% , then X[2]= $ , X[3..5]= *#@ . Например, если X = & $ * #@@%, то X [2] = $, X [3..5] = * # @.
Given a base, radix , and a length, m , there are radix Учитывая основание, основание системы счисления, и длину, м, есть основание системы счисления
m м
distinct numeral strings. различные численные строки. Given an integer x Дано целое х
such that 0 ≤ x < radix таких, что 0 ≤ х <основанию
m м
, the integer-to-string function, denoted , Функция целое к строке, обозначенной
STR STR
m м
radix основанию
( x ), is the representation (Х), является представление
of x as a numeral string of length m in base radix , with the most significant character first, ie, on х в качестве позицией строки длины т в базовой системы счисления, с самой значительной характера первого, т.е. от
the left. влево. For example, Например,
STR STR
4 4
12 12
(559) is the string of four numerals in base 12 that represents 559, (559) является строка из четырех цифр в базе 12, что представляет собой 559,
namely, 0 3 10 7. An algorithm for computing а именно, 0 3 10 7 Алгоритм вычислений
STR STR
m м
radix основанию
( x ) is given in Sec. 5.5. (Х) дается в гл. 5.5.
A separate notation is given for the conversion of integers to byte strings: [ x ] Отдельная запись дается для преобразования целых чисел в байт строки: [х]
s с
= =
STR STR
8 s 8 с
2 2
( x ). (Х). For Для
example, [1] пример, [1]
1 1
= 00000001 . = 00000001.
Given a (non-empty) numeral string X in base radix of length m , the string-to-integer function, Учитывая (непустое) цифра строка X в базовых основанию длины т, функция строка-в-целого,
denoted обозначается
NUM NUM
radix основанию
( X ), is the integer x such that (Х), является целым числом х, таких, что
STR STR
m м
radix основанию
( x ) = X . (X) = X. In other words, Другими словами,
NUM NUM
radix основанию
( X ) is the (Х)
non-negative integer less than radix неотрицательное целое число, меньшее основание системы счисления
LEN LEN
( X ) (Х)
whose most-significant-character-first representation in которого наиболее значащего символа-первое представление в
base radix is X . база основание равно X. For example, Например,
NUM NUM
2 2
( 00011010 ) = 26. An algorithm for computing (00011010) = 26 Алгоритм вычислений
NUM NUM
radix основанию
( X ) (Х)
is given in Sec. 5.5. дается в гл. 5.5.
Given a bit string, X , the string С учетом битовая строка, X, строка
REV REV
( X ) is the concatenation of the bits of X in reverse order. (X) является объединение из битов X в обратном порядке. For Для
example, Например,
REV REV
( 00001 ) = 10000. (00001) = 10000.

Page 14 Страница 14
NIST Special Publication 800-38G NIST Special 800-38G публикации
DRAFT ПРОЕКТ
8 8
5 Preliminaries 5 Предварительные
5.1 Character Strings 5.1 Строки символов
A finite set of two or more symbols is called an alphabet, and the elements of an alphabet are Конечное множество из двух или более символов называется алфавит, а элементы алфавита являются
called characters. называемые символы. A character string is a finite sequence of characters from an alphabet. Символьная строка конечная последовательность символов из алфавита.
Individual characters may repeat in the string. Отдельные символы могут повторяться в строке. Thus, for example, given the alphabet of lower- Так, например, учитывая алфавит нижняя-
case English letters, тематические английские буквы,
{a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z}, {А, б, в, г, д, е, ж, з, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y , г},
the words “ hello ” and “ cannot ” are character strings, but “ Hello ” and “ can't ” are not, слова "привет" и "не может" являются символьные строки, но "Hello" и "не могу" не,
because the symbols “ H ” and “ ' ” are not in the alphabet. потому что символы "H" и "'" не в алфавите.
The number of characters in an alphabet is called the base, denoted radix , so that radix ≥ 2 by Символов в алфавите число называется базу, обозначается системы счисления, так что системы счисления ≥ 2 по
definition. определение. For a given base, a numeral is a nonnegative integer that is less than the base. Для данной базы, цифра является неотрицательным целым числом, которое меньше, чем основания.
The base is a parameter of FF1, FF2, and FF3, and their specifications assume that the alphabet База является параметром FF1, FF2 и FF3, и их характеристики подразумевают, что алфавит
is the set of numerals for the base: есть множество цифрами для основания:
{0, 1, …, radix -1}. {0, 1, ..., Radix -1}.
Therefore, to apply FF1, FF2, or FF3 to character strings from an arbitrary alphabet, the string Поэтому, чтобы применить FF1, FF2 или FF3 в символьные строки из произвольного алфавита, строку
must first be converted, via a one-to-one correspondence, into a string of numerals for the base of должны сначала быть преобразованы, через соответствием один к одному, в строку цифрами для основы
the alphabet. алфавит. For example, the natural conversion from lower-case English letters to base 26 Например, естественный переход от строчных букв английского алфавита на базу 26
numerals is числительные является
a→0, b→1, c→2, … x→23, y→24, z→25, → 0, б → 1, с → 2, ... х → 23, у → 24, я → 25,
although other one-to-one correspondences are possible. хотя другие один-однозначные соответствия возможны. The choice and implementation of Выбор и внедрение
conversion methods from particular alphabets to their appropriate alphabets of numerals is методы преобразования от конкретных алфавитов в их соответствующих алфавитов числительных
outside the scope of this publication. выходит за рамки данной публикации.
The interpretation of a numeral string as a number depends on the base and the ordering Интерпретация позицией цепочки как число зависит от базы и упорядочения
convention; Конвенция; algorithms for functions that convert numeral strings to numbers and vice versa are алгоритмы функций, которые превращают числовые строки в числа и наоборот являются
given in Sec. приведены в гл. 5.5. 5.5. Individual numerals, and other numbers in the specifications, are represented Индивидуальные цифры, и другие цифры в спецификациях, представлены
in base 10. в базе 10.
The basic operations and functions on strings are defined with examples in Sec. Основные операции и функции над строками определяются с примерами в гл. 4.4. 4.4.
5.2 Underlying Block Cipher and Key 5.2 В основе блочного шифра и ключа
The encryption and decryption functions of FF1, FF2, and FF3 feature a block cipher as the main Шифрования и дешифрования функции FF1, FF2, FF3 и имеют блочный шифр в качестве основного
component; компонент; thus, each of these FPE mechanisms is a mode of operation (mode, for short) of the Таким образом, каждый из этих механизмов FPE является режим работы (режим, для краткости) из
block cipher. блочный шифр.

Page 15 Страница 15
NIST Special Publication 800-38G NIST Special 800-38G публикации
DRAFT ПРОЕКТ
9 9
For any given key, K , the underlying block cipher of the mode is a permutation, ie, 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 Для режима FPE, как часть выбора
underlying block cipher with the key, either the forward transformation or the inverse основной блочный шифр с ключом, либо вперед трансформации или обратного
transformation преобразование
2 2
is specified as the designated cipher function, denoted указано в качестве назначенного шифра функции, обозначается
CIPH CIPH
K K
. . The inverse of Обратная
CIPH CIPH
K K
is not needed for the modes that are specified in this publication. не требуется для режимов, которые указаны в этой публикации.
For each of the three modes, the underlying block cipher shall be approved, and the block size Для каждого из трех режимов, основная блочный шифр должен быть утвержден, и размер блока
shall be 128 bits. должна быть 128 бит. Currently, the AES block cipher, with key lengths of 128, 192, or 256 bits, is В настоящее время AES блочный шифр, с длиной ключа 128, 192 или 256 бит, является
the only block cipher that fits this profile. только блочный шифр, который подходит эту анкету.
The choice of the key length affects the security of the FPE modes, eg, against brute-force Выбор длины ключа влияет на безопасность режимов FPE, например, против грубой силы
search, and also affects the details of the implementation of the AES algorithm. поиск, а также влияет на детали реализации алгоритма AES. Otherwise, the В противном случае,
key length does not affect the implementation of FF1, FF2, and FF3, and the choice of the key длина ключа не влияет на реализацию FF1, FF2 и FF3, и выбор ключа
length is not explicitly indicated in their specifications Methods for generating cryptographic Длина явно не указано в их спецификации методов генерации криптографических
keys are discussed in [9]; the goal is to select the keys uniformly at random, ie, for each ключи обсуждаются в [9]; цель заключается в выборе ключи случайно равномерно, то есть, для каждого
possible key to occur with equal probability. можно ключ к произойти с равной вероятностью.
The key shall be kept secret, ie, 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 this используя, реализации, установке и настройке приложений, которые включают этот
Recommendation. Рекомендация. The management of cryptographic keys is outside the scope of this Управление ключами шифрования выходит за рамки этого
publication. публикация.
5.3 Encryption and Decryption Functions 5.3 Шифрование и дешифрование Функции
For a given key, denoted K , for the designated block cipher, FF1, FF2, and FF3 each consist of Для данного ключа, обозначается K, для назначенного блочного шифра, FF1, FF2, FF3 и каждый состоит из
two related functions: encryption and decryption. два связанных с ними функций: шифрования и дешифрования. The encryption function takes as input a Функция шифрования принимает на входе
numeral string called the plaintext, denoted X , and an additional parameter, called the tweak, цифра строка называется открытый текст, обозначаемый X, и дополнительный параметр, называемый твик,
denoted T ; обозначаемое T; the function returns a numeral string called the ciphertext, denoted Y , with the same функция возвращает числовое строку, называемую зашифрованный текст, обозначается Y, с тем же
length as X . Длина как X. Similarly, the inputs to the decryption function are a numeral string X and a tweak T ; Аналогичным образом, вклад в функции дешифрования являются позицией строку Х и Т Tweak;
the output is a numeral string Y of the same length as X . выход позицией строка Y той же длины, что и х.
For FF1, the encryption function and the decryption function are denoted FF1.Encrypt( K , T , X ) Для FF1, функции шифрования и дешифрования функции, обозначены FF1.Encrypt (K, T, X)
and FF1.Decrypt( K , T , X ), with analogous notation for FF2 and FF3. и FF1.Decrypt (K, T, X), с аналогичным обозначениям FF2 и FF3.
For a given tweak, the decryption function is the inverse of the encryption function, so that Для данной настройки, функция дешифрования является обратным функции шифрования, так что
FF1.Decrypt( K , T , FF1.Encrypt( K , T , X )) = X . FF1.Decrypt (K, T, FF1.Encrypt (K, T, X)) = X.
Thus, when a ciphertext is the input to the decryption function, along with the same tweak that Таким образом, когда зашифрованный текст является входом в функцию дешифрования, вместе с тем, что TWEAK
was used to generate the ciphertext, the output is the corresponding plaintext. был использован для генерирования зашифрованного текста, выход соответствующий открытый текст.
2 2
The forward transformation and the inverse transformations are sometimes referred to as the “enrypt” and Вперед преобразование и обратные преобразования иногда называют как "enrypt" и
“decrypt” functions, respectively, of the block cipher; "Расшифровать" функции, соответственно, блочного шифра; however, in this publication, those terms are reserved for Однако, в данной публикации, эти термины зарезервированы для
functions of the FPE modes. Функции режимов FPE.

Page 16 Страница 16
NIST Special Publication 800-38G NIST Special 800-38G публикации
DRAFT ПРОЕКТ
10 10
The tweak may be any information that can be associated to the input numeral string and does Твик может быть любая информация, которая может быть связана с входным номером строки и делает
not need to be kept secret. не нужно быть великим секретом. 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 Приложении C. В FF1
and FF3, tweaks are bit strings; и FF3, ухищрений все битовые строки; in FF2, tweaks may also be character strings in a different base. в FF2, твики также может быть символьные строки в другую базу.
The tweak lengths that can be supported differ for each of the three modes; Длины TWEAK, которые могут поддерживаться отличается для каждого из трех режимов; see the individual увидеть человека
specifications in Sec. 6. спецификации в гл. 6.
The key, K , is indicated in the notation as an input for the encryption and decryption functions; Ключ, K, указывается в обозначении в качестве вклада шифрования и дешифрования функций;
however, in the specifications in this publication, the key is listed as a prerequisite, ie, an input Однако, в спецификациях в данной публикации, ключ отображается в качестве предварительного условия, то есть, вход
that is usually established prior to the invocation of the function. что, как правило, устанавливается до вызова функции.
3 3
Several other prerequisites are Несколько других предпосылки
omitted from the above notation, such as the underlying block cipher, the designation of CIPH исключены из приведенных выше обозначениях, таких как блочного шифра, обозначения CIPH
K K
, ,
and the base for the numeral strings. и основание для численных строк.
5.4 Feistel Structure 5.4 Фейстель Структура
FFX schemes, including FF1, FF2, and FF3, are based on the Feistel structure for encryption. Схемы FFX, в том числе FF1, FF2 и FF3, основаны на структуре Фейстеля для шифрования.
The Feistel structure consists of several iterations, called rounds, of a reversible transformation, Структура Фейстель состоит из нескольких итераций, называют раундов, обратимого преобразования,
which consists of three elements: 1) the data is split into two parts; который состоит из трех элементов: 1) данные разбиваются на две части; 2) a keyed function, F 2) с ключом функция, F
K K
, ,
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. и 3) роли двух частей меняются местами для следующего раунда. The structure is Структура
illustrated in Figure 1 below. показано на рисунке 1 ниже. Four rounds are shown in this example, but ten rounds are actually Четыре раунды показаны в этом примере, но десять раундов на самом деле
specified for FF1 and FF2, and eight rounds for FF3. указано для FF1 и FF2, и восьми раундов для FF3.
The two parts of the input numeral string, denoted A Две части входного позицией строки, обозначается A
0 0
and B и B
0 0
, consist of u and v characters, , Состоят из и и у персонажей,
respectively; соответственно; the total number of characters, u + v , is denoted n . Общее число символов, U + V, обозначается н. The rounds are indexed from 0 to Снаряды индексируются от 0 до
3 in the figure. 3 на рисунке. During round i , the round function F Во время I тура, круглый функция F
K K
is applied to B применяется к B
i я
, with the tweak T , the round , С Tweak T, круглый
number i , and the length n , as additional inputs, and the result is used to modify A число я, а длина п, в качестве дополнительных входов, и результат используется для изменения
i я
, via modular , С помощью модульных
addition дополнение
4 4
, indicated by +, on the numbers that the strings represent , Обозначается +, по номерам, что строки представляют
5 5
. . The string that represents Строка, представляющая
the resulting number is named with a temporary variable, C полученное число назван с временной переменной, C
i я
. . The roles of the parts are swapped Роли частей меняются местами
for the next round, so that the modified A для следующего раунда, так что изменение
i я
, ie, C , То есть, C
i я
, becomes B , Становится B
i +1 я 1
, and B И В
i я
becomes A становится
i +1 я 1
. .
The rectangles containing the two parts of the data in each round are different sizes to illustrate Прямоугольники, содержащие две части данных в каждом раунде имеют разные размеры, иллюстрирующих
that, if n is odd, then u cannot equal v . что, если п нечетное, то и не может равняться с. In order to accommodate 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. номер индекса, я, четный или нечетный.
The Feistel structure for decryption is almost identical; Структура Фейстель для расшифровки практически идентичен; the only changes are 1) modular addition единственные изменения: 1) Модульная дополнение
is replaced by modular subtraction, and 2) the order of the round indices is reversed. заменяется на модульной вычитания, и 2) порядок круглых индексов на противоположное. For Для
example, in Figure 1, the arguments to F Например, на рисунке 1, аргументы для F
K K
would begin at n , T , 3 at the top, and end at n , T , 0 at начнется в N, T, 3 в верхней части, и закончится в п, т, 0 на
the bottom. нижняя.
3 3
The distinction doesn't affect the execution of the function: all inputs are required, independent of when they were Различие не влияет на выполнение функции: все входы необходимы, независимо от того, когда они были
established or provided to the implementation. создан или предоставляемые для реализации.
4 4
In principle, the addition operation can be any other reversible operation on strings that preserves their length; В принципе, операция сложения может быть любой другой обратимой операции над строками, который сохраняет свою длину; for для
example, the FFX specification [1] supports an option for characterwise addition. Например, спецификация FFX [1] поддерживает опцию для посимвольный того.
5 5
The ordering convention for the interpretation of strings is different for FF3 than for FF1 and FF2. Конвенция заказа для интерпретации строк отличается для FF3, чем для FF1 и FF2.

Page 17 Страница 17
NIST Special Publication 800-38G NIST Special 800-38G публикации
DRAFT ПРОЕКТ
11 11
Figure 1: Illustration of the Feistel Structure Рисунок 1: Иллюстрация структуры Feistel
5.5 Component Functions 5.5 Компонент Функции
This section gives algorithms for the component functions that are called in the specifications of Этот раздел дает алгоритмы функций компонентов, которые называются в спецификациях
FF1, FF2, and FF3. FF1, FF2, и FF3. The conversion functions Функции преобразования
NUM NUM
radix основанию
( X ) and (Х) и
STR STR
m м
radix основанию
( x )—defined in Sec. (Х) ~ определено в гл. 4.4 4.4
with examples—are specified in Algorithms 1 and 2. These functions support the ordering с примерами-указаны в алгоритмах 1 и 2 Эти функции поддерживают порядок
convention for the numeral strings in FF1 and FF2, namely, that the first (ie, left-most) numeral Конвенция о численных строк в FF1 и FF2, а именно, что первый (т.е. левая) цифра
of the string is the most-significant numeral. строки является наиболее значительным позицией.
A
0 0
B B
0 0
B B
1 1
← C ← C
0 0
A
1 1
← B ← B
0 0
A
2 2
← B ← B
1 1
B B
2 2
← C ← C
1 1
B B
3 3
← C ← C
2 2
A
3 3
← B ← B
2 2
A
4 4
← B ← B
3 3
B B
4 4
← C ← C
3 3
n , T , 0 п, Т, 0
u characters U символов
v characters V символов
F F
K K
n , T , 1 N, Т, 1
n , T , 2 N, Т, 2
n , T , 3 N, Т, 3
F F
K K
F F
K K
F F
K K
+ +
+ +
+ +
+ +

Page 18 Страница 18
NIST Special Publication 800-38G NIST Special 800-38G публикации
DRAFT ПРОЕКТ
12 12
The function Функция
REV REV
( X ) )—defined in Sec. (X)) -определенной в гл. 4.4 with an example—is specified in Algorithm 3. It is 4.4 на примере-указывается в Algorithm 3. Это
used to adapt используется для адаптации
NUM NUM
radix основанию
( X ) and (Х) и
STR STR
m м
radix основанию
( x ) to the opposite ordering convention, for the numeral (Х) в противоположную конвенции заказа, для цифры
strings in FF3. строки в FF3.
The
PRF PRF
function, specified in Algorithm 4, essentially invokes the Cipher Block Chaining функция, заданная в алгоритме 4, по существу вызывает Cipher Block Chaining
encryption mode [ 7] o n the input bit string and returns the final block of the ciphertext; режим шифрования [ 7] о п входной бит строка и возвращает последний блок шифротекста; this это
function is the pseudorandom core of the Feistel round function for FF1.Encrypt and функция псевдослучайных ядро круглого функции криптографической для FF1.Encrypt и
FF1.Decrypt. FF1.Decrypt.
Algorithm 1: Алгоритм 1:
NUM NUM
radix основанию
( X ) (Х)
Prerequisite: Необходимое условие:
Base, radix . База, основание системы счисления.
Input : Вход:
Numeral string, X . Цифра строка, X.
Output : Выход:
Number, x. Количество, х.
Steps : Шаги:
1. Let x = 0. 1. Пусть х = 0.
2. 2.
For i from 1 to Для я от 1 до
LEN LEN
( X ), let x = x ⋅ radix + X [ i ]. (X), пусть х = х ⋅ основанию + X [я].
3. 3.
Return x . Вернуться х.
Algorithm 2: Алгоритм 2:
STR STR
m м
radix основанию
( x ) (Х)
Prerequisites: Необходимые условия:
Base, radix ; База, основание системы счисления;
String length, m . Длина строки, м.
Input : Вход:
Number, x , such that x < radix Количество, х, таких, что х <Radix
m м
. .
Output : Выход:
Numeral string, X. Цифра строка, X.
Steps : Шаги:
1. For i from 1 to m : 1 Для I от 1 до т:
i. я.
X [ m +1- i ] = x mod radix X [м + 1 я] = х мод основанию
; ;
ii. II.
x =x/ radix . х =х / основанию .
2. Return X . 2 Вернуться X.

Page 19 Страница 19
NIST Special Publication 800-38G NIST Special 800-38G публикации
DRAFT ПРОЕКТ
13 13
Algorithm 3: Алгоритм 3:
REV REV
( X ) (Х)
Input : Вход:
Character string, X . Строка символов, X.
Output : Выход:
Character string, Y. Строка символов, Y.
Steps : Шаги:
1. For i from 1 to 1 Для я от 1 до
LEN LEN
( X ) let Y [ i ]= X [ (X) Пусть у [I] = X [
LEN LEN
( X )+1- i ]. (Х) + 1 I].
2. Return Y [0 .. 2 Вернуться Y [0 ..
LEN LEN
( X )-1]. (Х) -1].
Algorithm 4: Алгоритм 4:
PRF PRF
( X ) (Х)
Prerequisites : Необходимые условия:
Approved, 128-bit block cipher, Утверждено, 128-бит блочный шифр,
CIPH CIPH
; ;
Key, K , for the block cipher; Ключ, К, для блочного шифра;
Input : Вход:
Nonempty bit string, X , such that Непустое битовая строка, X, таких, что
LEN LEN
( X ) is a multiple of 128. (X) является кратным 128.
Output : Выход:
Block, Y. Блок, Y.
Steps : Шаги:
1. Let m = 1. Пусть т =
LEN LEN
( X ) / 128. (Х) / 128.
2. 2.
Partition X into m blocks X Partition X в м блоков X
1 1
,…, X , ..., X
m м
, so that X = X , Так, что X = X
1 1
|| …|| X || ... || X
m м
and и
LEN LEN
( X (Х
i я
) = 128 for all i ) = 128 для всех
from 1 to m . от 1 до т.
3. 3.
Let Y Пусть Y
0 0
= 0 = 0
128 128
, and for j from 1 to m let Y , И для J от 1 до т пусть Y
j J
= =
CIPH CIPH
K K
( Y (Y
j -1 J -1
⊕ X ⊕ X
j J
). ).
4. Return Y 4 Вернуться Y
m м
. .
6 Mode Specifications 6 Технические характеристики Режим
The specifications of FF1, FF2, and FF3 are presented in this section, organized into Характеристики FF1, FF2 и FF3 представлены в этом разделе, организованы в
prerequisites, inputs, outputs, steps, and descriptions of the steps. предпосылки, входы, выходы, лестницы, и описания шагов. In addition to the key and В дополнение к ключу, и
designated cipher function, each mode has prerequisites for the choices of the base, radix , and of обозначены шифр функция, каждый режим имеет предпосылки для выбора базовой, по основанию, и
the range of lengths, [ minlen .. maxlen ], for the numeral string inputs that the implementation диапазон длин, [MINLEN .. MaxLen], для численных струнных входов, что реализация
supports. поддерживает. FF1 and FF2 also have a prerequisite for the choice of the maximum tweak length, FF1 и FF2 также есть предпосылки для выбора максимальной длины Tweak,
maxTlen , that the implementation supports, and FF2 has an additional parameter, tweakradix , for maxTlen, что реализация поддерживает, и FF2 имеет дополнительный параметр, tweakradix, для
the choice of the base for tweak strings. Выбор основания для TWEAK строк. For all of these parameters, the choices that are allowed Для всех этих параметров, выбор, который разрешается
for the individual modes are described within the prerequisites. для отдельных режимов описаны в предпосылок.
The parameter choices may affect interoperability. Выбор параметров могут повлиять на взаимодействие. The behavior of an implementation when Поведение в осуществлении, в ходе
presented with incorrect inputs is out of the scope of this Recommendation.

Page 20 Страница 20
NIST Special Publication 800-38G
DRAFT ПРОЕКТ
14 14
6.1 FF1
The specifications for the FF1.Encrypt and FF1.Decrypt functions are given in Algorithms 5 and
6 below. The tweak, T , is optional in that it may be the empty string, with byte length t= 0.
The parameters radix , minlen , maxlen , and maxTlen in FF1.Encrypt and FF1.Decrypt shall meet
the following requirements:
• radix ∈ [2 .. 2
16 16
]; ];
• radix
minlen
≥ 100;
• minlen ≥ 2;
• maxlen < 2
32 32
; ; and и
• maxTlen < 2
32 32
. .
Algorithm 5: FF1.Encrypt( K , T , X )
Prerequisites: Необходимые условия:
Approved, 128-bit block cipher,
CIPH CIPH
; ;
Key, K , for the block cipher;
Base, radix , for the character alphabet;
Range of supported message lengths, [ minlen .. maxlen ];
Maximum byte length for tweaks, maxTlen .
Inputs :
Character 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 : Выход:
Character string, Y, such that
LEN
( Y ) = n.
Steps : Шаги:
1. 1.
Let u =  n /2; v = n – u .
2. Let A = X [1 .. u ]; B = X [ u + 1 .. n ].
3. 3.
Let b =   v
LOG
2 2
( radix ) / 8; d = 4  b/ 4 + 4
4. 4.
Let P = [1]
1 1
|| [2]
1 1
|| [1]
1 1
|| [ radix ]
3 3
|| [10]
1 1
|| [ u mod 256]
1 1
|| [ n ]
4 4
|| [ t ]
4 4
. .
5. 5.
For i from 0 to 9:
i. я.
Let Q = T || [0]
( −t−b− 1) mod 16
|| [ i ]
1 1
|| [
NUM
radix
( B )]
b б
. .
ii. II.
Let R =
PRF
( P || Q ).
iii. Let S be the first d bytes of the following string of ⌈ d /16⌉ blocks:
R ||
CIPH CIPH
K K
( R ⊕ [1]
16 16
) ||
CIPH CIPH
K K
( R ⊕ [2]
16 16
) || … ||
CIPH CIPH
K K
( R ⊕ [⌈ d /16⌉ -1]
16 16
). ).
iv. Let y =
NUM
2 2
( S ).
v. ст.
If i is even, let m = u ; else, let m = v .
vi. Let c = (
NUM
radix
( A ) + y ) mod radix
m м
. .
vii. VII. Let C =
STR
m м
radix
( c ).

Page 21 Страница 21
NIST Special Publication 800-38G
DRAFT ПРОЕКТ
15 15
viii. Let A = B .
ix. Let B = C .
6. 6.
Return 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,
LEN
( A )=
LEN
( B ); otherwise,
LEN
( A )=
LEN
( B )–1. The byte lengths b and d , which are
used in Steps 5i and 5iii, are defined in Step 3.
6 6
A fixed block, P , used as the initial block for the
invocation of the function
PRF
in Step 5ii, is defined in Step 4. An iteration loop for the ten
Feistel rounds of FF1 is initiated in Step 5, executing nine substeps for each round, as follows:
The tweak, T , the substring, B , and the round number, i , are encoded as a binary string, Q , in
Step 5i. The function
PRF
is applied to the concatenation of P and Q in Step 5ii, 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 5iii. (In Figure 1 Error! Reference source not found. , S corresponds to the
output of F
K K
.) In Steps 5iv to 5vii, 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 5iv, S is converted to a number, y . In Step 5v, the
length , m , of A for this Feistel round is determined. In Step 5vi, y is added to the number
represented by the substring A and the result is reduced modulo the m th power of radix , yielding
a number, c , which is converted to a numeral string in Step 5vii. In Steps 5viii and 5ix, 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 (ie, C ) is renamed as 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 6.
Algorithm 6: FF1.Decrypt( K , T , X )
Prerequisites: Необходимые условия:
Approved, 128-bit block cipher,
CIPH CIPH
; ;
Key, K , for the block cipher;
Base, radix , for the character alphabet;
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 byte string, T , of byte length t such that t ∈ [0 .. maxTlen ] .
Output : Выход:
Numeral string, Y, such that
LEN
( Y ) = n.
6 6
When B is encoded as a byte string in Step 5i, 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 4 bytes longer than this encoding of B , which minimizes any
bias in the modular reduction in Step 5vi.

Page 22 Страница 22
NIST Special Publication 800-38G
DRAFT ПРОЕКТ
16 16
Steps : Шаги:
1. 1.
Let u =  n /2; v = n – u .
2. Let A = X [1 .. u ]; B = X [ u + 1 .. n ].
3. 3.
Let b =   v
LOG
2 2
( radix )  / 8; d = 4  b/ 4 + 4
4. 4.
Let P = [1]
1 1
|| [2]
1 1
|| [1]
1 1
|| [ radix ]
3 3
|| [10]
1 1
[ u mod 256]
1 1
|| [ n ]
4 4
|| [ t ]
4 4
. .
5. 5.
For i from 9 to 0:
i. я.
Let Q = T || [0]
( −t−b− 1) mod 16
|| [ i ]
1 1
|| [
NUM
radix
( B )]
b б
. .
ii. II.
Let R =
PRF
( P || Q ).
iii. Let S be the first d bytes of the following string of ⌈ d /16⌉ blocks:
R ||
CIPH CIPH
K K
( R ⊕ [1]
16 16
) ||
CIPH CIPH
K K
( R ⊕ [2]
16 16
) || … ||
CIPH CIPH
K K
( R ⊕ [⌈ d /16⌉ -1]
16 16
). ).
iv. Let y =
NUM
2 2
( S ).
v. ст.
If i is even, let m = u ; else, let m = v .
vi. Let c = (
NUM
radix
( A ) – y ) mod radix
m м
. .
vii. VII. Let C =
STR
m м
radix
( c ).
viii. Let A = B .
ix. Let B = C .
6. 6.
Return A || B .
Description : Описание:
The FF1.Decrypt algorithm is almost identical to the FF1.Encrypt algorithm; the only differences
are in Step 5, where the order of the indices is reversed, and in Step 5vi, where modular addition
is replaced by modular subtraction.
6.2 FF2
The specifications for the FF2.Encrypt and FF2.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.
The parameters radix , tweakradix , minlen , maxlen , and maxTlen in FF2.Encrypt and
FF2.Decrypt shall meet the following requirements:
• radix ∈ [2 .. 2
8 8
]; ];
• tweakradix ∈ [2 .. 2
8 8
]; ];
• radix
minlen
≥ 100;
• minlen ≥ 2;
• maxlen ≤ 2120/
LOG
2 2
( radix ) if radix is a power of 2;
• maxlen ≤ 298/
LOG
2 2
( radix ) if radix is not a power of 2; and и
• maxTlen < 104/
LOG
2 2
( tweakradix ).
Algorithm 7: FF2.Encrypt( K , T , X )
Prerequisites :
Approved, 128-bit block cipher,
CIPH CIPH
; ;

Page 23 Страница 23
NIST Special Publication 800-38G
DRAFT ПРОЕКТ
17 17
Key, K , for the block cipher;
Base, radix , for the character alphabet;
Base, tweakradix , for the tweak character alphabet;
Range of supported message lengths, [ minlen .. maxlen ]
Maximum supported tweak length, maxTlen .
Inputs :
Numeral string, X , in base radix of length n such that n ∈ [ minlen .. maxlen ];
Tweak numeral string, T , in base tweakradix of length t such that t ∈ [0 .. maxTlen ].
Output : Выход:
Numeral string, Y, such that
LEN
( Y ) = n.
Steps : Шаги:
1. 1.
Let u =  n /2; v = n – u .
2. Let A = X [1 .. u ]; B = X [ u + 1 .. n ].
3. 3.
If t >0, P = [ radix ]
1 1
|| [ t ]
1 1
|| [ n ]
1 1
|| [
NUM
tweakradix
( T )]
13 13
; ; else P = [ radix ]
1 1
|| [0]
1 1
|| [ n ]
1 1
|| [0]
13 13
. .
4. 4.
Let J =
CIPH CIPH
K K
( P )
5. 5.
For i from 0 to 9:
i. я.
Let Q ← [ i ]
1 1
|| [
NUM
radix
( B )]
15 15
ii. II.
Let Y ←
CIPH CIPH
J J
( Q ).
iii III
Let y ←
NUM
2 2
( Y ).
iv. If i is even, let m = u ; else, let m = v .
v. ст.
Let c = (
NUM
radix
( A ) + y ) mod radix
m м
. .
vi. Let C =
STR
m м
radix
( c ).
vii. VII. Let A = B .
viii. Let B = C .
6. 6.
Return 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,
LEN
( A )=
LEN
( B ); otherwise,
LEN
( A )=
LEN
( B )–1. A fixed block, P , is defined in Step 3
from encodings of the base, radix , and the tweak, T . The block cipher under the key K , ie,
CIPH CIPH
K K
, is applied to P in Step 4 to produce a 128-bit subkey, J . An iteration loop for the ten
Feistel rounds of FF2 is initiated in Step 5, executing eight substeps for each round, as follows:
The substring, B , and the round number, i , are encoded as a binary string, Q , in Step 5i. The
block cipher under the subkey J is applied to Q in Step 5ii to produce a block, Y . (In Error!
Reference source not found. , Y corresponds to the output of F
K K
.) In Steps 5iii to 5vi, Y 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 Y with A is indicated by the “+” operation.) In particular,
in Step 5iii, Y is converted to a number, y . In Step 5iv, the length, m , of A for this Feistel round is
determined, and in Step 5v, the number y is reduced modulo the m th power of the base radix . In В
Step 5v, the number y is added to the number represented by the substring A and the result is
reduced modulo the m th power of radix , yielding a number, c , which is converted to a numeral

Page 24 Страница 24
NIST Special Publication 800-38G
DRAFT ПРОЕКТ
18 18
string in Step 5vi. In Steps 5vii and 5viii, 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 (ie, C ) is renamed as B .
This completes one round of the Feistel structure in FF2. After the tenth round, the concatenation
of A and B is returned as the output in Step 6.
Algorithm 8: FF2.Decrypt( K , T , X )
Prerequisites: Необходимые условия:
Approved, 128-bit block cipher,
CIPH CIPH
; ;
Key, K , for the block cipher;
Base, radix , for the character alphabet;
Base, tweakradix , for the tweak character alphabet;
Range of supported message lengths, [ minlen .. maxlen ]
Maximum supported tweak length, maxTlen .
Inputs :
Numeral string, X , in base radix of length n such that n ∈ [ minlen .. maxlen ];
Tweak numeral string, T , in base tweakradix of length t such that t ∈ [0 .. maxTlen ].
Output : Выход:
Numeral string, Y, such that
LEN
( Y ) = n.
Steps : Шаги:
1. 1.
Let u =  n /2; v = n – u .
2. Let A = X [1 .. u ]; B = X [ u + 1 .. n ].
3. 3.
If t >0, P = [ radix ]
1 1
|| [ t ]
1 1
|| [ n ]
1 1
|| [
NUM
tweakradix
( T )]
13 13
; ; else P = [ radix ]
1 1
|| [0]
1 1
|| [ n ]
1 1
|| [0]
13 13
. .
4. 4.
Let J =
CIPH CIPH
K K
( P )
5. 5.
For i from 9 to 0:
i. я.
Let Q ← [ i ]
1 1
|| | [
NUM
radix
( B )]
15 15
ii. II.
Let Y ←
CIPH CIPH
J J
( Q ).
iii III
Let y ←
NUM
2 2
( Y ).
iv. If i is even, let m = u ; else, let m = v .
v. ст.
Let z = y mod radix
m м
. .
vi. Let c = (
NUM
radix
( A ) – y ) mod radix
m м
. .
vii. VII. Let C =
STR
m м
radix
( c ).
viii. Let A = B .
ix. Let B = C .
6. 6.
Return A || B .
Description : Описание:
The FF2.Decrypt algorithm is almost identical to the FF2.Encrypt algorithm: the only differences
are in Step 5, where the order of the indices is reversed, and in Step 5v, where modular addition
is replaced by modular subtraction.

Page 25 Страница 25
NIST Special Publication 800-38G
DRAFT ПРОЕКТ
19 19
6.3 FF3
The specifications for the FF3.Encrypt and FF3.Decrypt functions are given in Algorithms 9 and
10 below.
The parameters radix , minlen , and maxlen in FF3.Encrypt and FF3.Decrypt shall meet the
following requirements:
• radix ∈ [2 .. 2
16 16
]; ];
• radix
minlen
≥ 100;
• minlen ≥ 2; and и
• maxlen ≤
2 2
log
radix
(2 (2
96 96
).
Algorithm 9: FF3.Encrypt( K , T , X )
Prerequisites: Необходимые условия:
Approved, 128-bit block cipher,
CIPH CIPH
; ;
Key, K , for the block cipher;
Base, radix , for the character alphabet such that radix ∈ [2 .. 2
16 16
]; ];
Range of supported message lengths, [ minlen .. maxlen ], such that minlen ≥ 2 and maxlen ≤
2 2
log
radix
(2 (2
96 96
)].
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. 1.
Let u = ⌈ n /2⌉ ; v = n – u .
2. Let A = X [1 .. u ]; B = X [ u + 1 .. n ].
3. 3.
Let T
L L
= T [0..31] and T
R R
= T [32..63]
4. 4.
For i from 0 to 7:
i. я.
If i is even, let m = u and W = T
R R
, else let m = v and W =T
L L
. .
ii. II.
Let P =
REV REV
([
NUM
radix
( (
REV REV
( B ))]
12 12
) || W ⊕
REV REV
([ i ]
4 4
). ).
iii III
Let Y =
CIPH CIPH
K K
( P ).
iv. Let y =
NUM
2 2
( (
REV REV
( Y )).
v. ст.
Let c = (
NUM
radix
( (
REV REV
( A )) + y ) mod radix
m м
. .
vi. Let C =
REV REV
( (
STR
m м
radix
( c )).
vii. VII. Let A = B .
viii. Let B = C .
5. 5.
Return A || B .
Description : Описание:
The “split” of the numeral string X into two substrings, A and B , is performed in Steps 1 and 2.

Page 26 Страница 26
NIST Special Publication 800-38G
DRAFT ПРОЕКТ
20 20
If n is even,
LEN
( A )=
LEN
( B ); otherwise,
LEN
( A )=
LEN
( B )+1.
7 7
The tweak, T , is partitioned into a
32-bit left tweak, T
L L
, and a 32-bit right tweak, T
R R
, in Step 3. An iteration loop for the eight Feistel
rounds of FF3 is initiated in Step 4, executing eight substeps for each round, as follows:
In Step 4i, the parity of the round number, i , determines the length, m , of the substring A , and
whether T
L L
or T
R R
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, ie, CIPH
K K
, is applied to P , to produce a block, Y . (In Figure 1, Y corresponds to
the output of F
K K
.) In Steps 4iv to 4vii, Y 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 Y with A is
indicated by the “+” operation, although this operation is different than for FF1 and FF2 in that
FF3 uses the opposite ordering convention for the conversion of strings to numbers and vice
versa.) In particular, in Step 4iv, Y is converted to a number, y . In Step 4v, the number y is added
to the number represented by the substring A and the result is reduced modulo the m th power of
radix , yielding a number, c , which is converted to a numeral string in Step 5vi. In Steps 4vii and
4viii, 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 (ie, C ) is renamed as B .
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.
Algorithm 10: FF3.Decrypt( K , T , X )
Prerequisites: Необходимые условия:
Approved, 128-bit block cipher,
CIPH CIPH
; ;
Key, K , for the block cipher;
Base, radix , for the character alphabet such that radix ∈ [2 .. 2
16 16
]; ];
Range of supported message lengths, [ minlen .. maxlen ], such that minlen ≥ 2 and maxlen ≤
2 2
log
radix
(2 (2
96 96
).
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. 1.
Let u = ⌈ n /2⌉ ; v = n – u .
2. Let A = X [1 .. u ]; B = X [ u + 1 .. n ].
3. 3.
Let T
L L
= T [0..31] and T
R R
= T [32..63]
4. 4.
For i from 7 to 0:
i. я.
If i is even, let m = u and W = T
R R
, else let m = v and W =T
L L
. .
ii. II.
Let P =
REV REV
([
NUM
radix
( (
REV REV
( B ))]
12 12
) || W ⊕
REV REV
([ i ]
4 4
). ).
7 7
If n is odd, A is one character longer than B , in contrast to FF1 and FF2, where B is one character longer than A .

Page 27 Страница 27
NIST Special Publication 800-38G
DRAFT ПРОЕКТ
21 21
iii III
Let Y =
CIPH CIPH
K K
( P ).
iv. Let y =
NUM
2 2
( (
REV REV
( Y )).
vi. Let c = (
NUM
radix
( (
REV REV
( A )) – y ) mod radix
m м
. .
vii. VII. Let C =
REV REV
( (
STR
m м
radix
( c )).
viii. Let A = B .
ix. Let B = C .
5. 5.
Return A || B .
Description : Описание:
The FF3.Decrypt algorithm is almost identical to the FF3.Encrypt algorithm: the only differences
are in Step 4, where the order of the indices is reversed, and in Step 4v, where modular addition
is replaced by modular subtraction.
7 Conformance
An implementation may claim conformance to any of the following six functions:
FF1.Encrypt
FF2.Encrypt
FF3.Encrypt
FF1.Decrypt
FF2.Decrypt
FF3.Decrypt
Component functions such as
PRF
are not approved for use independent of these eight functions.
In order to claim conformance with this Recommendation, an implementation of FF1, FF2, or
FF3 must support at least one set of values for its parameters.
Two implementations can only interoperate when they support a common value for the base.
Similarly, two implementations of FF2 can only interoperate when they also support a common
value for the tweak base.
Moreover, each mode has two parameters, minlen and 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 and FF2 also have a parameter, maxTlen , that determines the lengths of the
tweak strings they support. The selection of these parameters may also affect interoperability.
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.
8 References
[1] [1]
M. Bellare, P. Rogaway, T. Spies, The FFX Mode of Operation for Format-Preserving
Encryption, Draft 1.1, Natl. Inst. Ин-т. Stand. Стенд. Technol. Technol. [Web page], http://csrc.nist.gov
/groups/ST/toolkit/BCM/documents/proposedmodes/ffx/ffx-spec.pdf , February, 2010.

Page 28 Страница 28
NIST Special Publication 800-38G
DRAFT ПРОЕКТ
22 22
[2] [2]
M. Bellare, P. Rogaway, 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, Natl. Inst. Ин-т. Stand. Стенд. Technol. Technol. [Web page],
http://csrc.nist.gov/groups/ST/toolkit/BCM/documents/proposedmodes/ffx/ffx-spec2.pdf,
September 2010.
[3] [3]
E. Brier, T. Peyrin, and J. Stern, BPS: a Format-Preserving Encryption Proposal Natl.
Inst. Ин-т. Stand. Стенд. Technol. Technol. [Web page], http://csrc.nist.gov/groups/ST/toolkit/BCM/documents
/proposedmodes/bps/bps-spec.pdf.
[4] [4]
M. Liskov, R. Rivest, and D. Wagner. Tweakable block ciphers. CRYPTO 2002,
LNCSvol. 2442, Springer, pp. 31–46, 2002
[5] [5]
M. Luby and C. Rackoff. How to construct pseudorandom permutations from
pseudorandomfunctions. SIAM Journal on Computing, 17(2), pp. 373–386, 1988
[6]
National Institute of Standards and Technology. FIPS 197, The Advanced Encryption
Standard (AES). 2001.
[7] [7]
National Institute of Standards and Technology. NIST Special Publication 800-38A:
Recommendation for Block Cipher Modes of Operation—Methods and Techniques ,
December, 2001.
[8] [8]
National Institute of Standards and Technology. NIST Special Publication 800-67
Revision 1: Recommendation for the Triple Data Encryption Algorithm (TDEA) Block
Cipher , January, 2012.
[9] [9]
National Institute of Standards and Technology. NIST Special Publication 800-133:
Recommendation for Cryptographic Key Generation , December, 2012.
[10] J. Patarin. Generic attacks on Feistel schemes. Cryptology ePrint report 2008/036.
January24, 2008. Also ASIACRYPT 2001, LNCS vol. 2248, Springer, pp. 222–238,
2001.
[11] R. Schroeppel. Hasty Pudding Cipher specification. Unpublished manuscript, [Web page]
athttp://richard.schroeppel.name:8015/hpc/hpc-spec, June 1998 (revised May 1999).
[12] T. Spies. Feistel finite set encryption. NIST submission, February 2008.
[13] J. Vance, VAES3 scheme for FFX: An addendum to “The FFX Mode of Operation for
Format-Preserving Encryption”: A parameter collection for encipher strings of arbitrary
radix with subkey operation to lengthen life of the enciphering key, Natl. Inst. Ин-т. Stand. Стенд.
Technol. Technol.
[Web
page],
http://csrc.nist.gov/groups/ST/toolkit/BCM/documents/
proposedmodes/ffx/ffx-ad-VAES3.pdf.

Page 29 Страница 29
NIST Special Publication 800-38G
DRAFT ПРОЕКТ
23 23
Appendix A: Parameter Choices
The length of the key affects its resistance to brute-force search. The requirement for each mode
that radix
minlen
≥ 100 precludes a generic meet-in-the-middle attack on the Feistel structure [10].
A requirement on maxlen for FF2—namely, that maxlen ≤ 298/
LOG
2 2
( radix ) if radix is not a
power of 2—minimizes the bias in the generation of z.
Otherwise, the choices of the mode parameters, eg, radix , minlen , and maxlen , are determined
by the needs of the application, not by security considerations.
Two potential parameters of the Feistel structure are fixed for FF1, FF2, and FF3, namely, the
number of Feistel rounds and the imbalance, ie, the lengths into which the input numeral string
is split: these were chosen in each case to balance performance requirements and security
considerations. See H of [1] for a discussion.
For FF1 and FF2, the maximum tweak length parameter, maxTlen , should be chosen to
accommodate non-secret information that may be associated to a plaintext. The security rationale
for tweaks is discussed in Appendix C.
Appendix B: Security Goal
The designers of FFX aimed to achieve strong-pseudorandom permutation (PRP) security for a
conventional block cipher [5] . 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 cryptographic goals including nonadaptive message-recovery security,
chosen-plaintext, 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] f or details.
Appendix C: Tweaks
Tweaks have been supported in stand-alone block ciphers, such as Schroeppel's Hasty Pudding
[11], and the notion was later formalized and investigated by Liskov, Rivest, and Wagner [4].
Tweaks are important for FPE modes, because FPE may be used in settings where the number of
character strings is relatively small. In such settings, the tweak should vary with each instance of
the encryption whenever possible.
For example, suppose that in an application for CCNs the leading six digits and the trailing four
digits need to be available, unencrypted, 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 these hundred CCNs were
encrypted with the same tweak, then their ciphertexts would be the same.

Page 30 Страница 30
NIST Special Publication 800-38G
DRAFT ПРОЕКТ
24 24
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. Therefore, for example,
learning that CCN 123456-123456-9876 encrypts to 123456-770611-9876 would not allow the
decryption of 111111-770611-9999, as the mapping of 123456 to 770611 is specific to the
surrounding digits 123456/9876.
In general, it is recommended to use information that is available and statically associated to a
plaintext as a tweak for that plaintext. Ideally, the non-secret tweak associated to a plaintext is
associated only to that plaintext.
Extensive tweaking means that fewer plaintexts are enciphered 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. The relevant metric is the maximum number of plaintexts that are encrypted
with the same tweak, which is likely to be significantly less than the total number of plaintexts
enciphered.