RU2652450C1 - Device for calculation montgomery modular product - Google Patents

Device for calculation montgomery modular product Download PDF

Info

Publication number
RU2652450C1
RU2652450C1 RU2017129526A RU2017129526A RU2652450C1 RU 2652450 C1 RU2652450 C1 RU 2652450C1 RU 2017129526 A RU2017129526 A RU 2017129526A RU 2017129526 A RU2017129526 A RU 2017129526A RU 2652450 C1 RU2652450 C1 RU 2652450C1
Authority
RU
Russia
Prior art keywords
input
output
basis
unit
block
Prior art date
Application number
RU2017129526A
Other languages
Russian (ru)
Inventor
Николай Иванович Червяков
Андрей Алексеевич Коляда
Виктор Андреевич Кучуков
Михаил Григорьевич Бабенко
Original Assignee
федеральное государственное автономное образовательное учреждение высшего образования "Северо-Кавказский федеральный университет"
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by федеральное государственное автономное образовательное учреждение высшего образования "Северо-Кавказский федеральный университет" filed Critical федеральное государственное автономное образовательное учреждение высшего образования "Северо-Кавказский федеральный университет"
Priority to RU2017129526A priority Critical patent/RU2652450C1/en
Application granted granted Critical
Publication of RU2652450C1 publication Critical patent/RU2652450C1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/38Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation
    • G06F7/48Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation using non-contact-making devices, e.g. tube, solid state device; using unspecified devices
    • G06F7/544Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation using non-contact-making devices, e.g. tube, solid state device; using unspecified devices for evaluating functions by calculation
    • G06F7/556Logarithmic or exponential functions
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/38Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation
    • G06F7/48Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation using non-contact-making devices, e.g. tube, solid state device; using unspecified devices
    • G06F7/57Arithmetic logic units [ALU], i.e. arrangements or devices for performing two or more of the operations covered by groups G06F7/483 – G06F7/556 or for performing logical operations
    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03KPULSE TECHNIQUE
    • H03K19/00Logic circuits, i.e. having at least two inputs acting on one output; Inverting circuits

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computational Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Computing Systems (AREA)
  • Mathematical Analysis (AREA)
  • Pure & Applied Mathematics (AREA)
  • Mathematical Optimization (AREA)
  • Mathematical Physics (AREA)
  • Computer Hardware Design (AREA)
  • Complex Calculations (AREA)

Abstract

FIELD: computer engineering.
SUBSTANCE: invention relates to computer engineering. Technical result is achieved due to device for calculating Montgomery modular product containing first operand input, second operand input, modulo multiplier block, module input, module storage register, parameter storage unit F, parameter calculating unit D by first basis, value storage unit Ri,l, value storage unit Ri,j, block for calculating first interval-index characteristic, block for calculating parameter D from second basis, Montgomery product calculation block for second basis, value storage unit Rj,k, value storage unit Rj,i, second interval-index characteristic calculating unit, second interval-index characteristic adjustment unit, constant comparison unit, multiplexer, Montgomery product calculation block for first basis, Montgomery product storage register, and Montgomery product output.
EFFECT: technical result consists in reducing hardware complexity by using modified Montgomery method in device to calculate product of numbers represented in residual class system.
1 cl, 1 dwg

Description

Изобретение относится к вычислительной технике, а именно к вычислительным модулярным системам, и предназначено для умножения двух чисел, представленных в системе остаточных классов (СОК, RNS).The invention relates to computer technology, namely to computing modular systems, and is intended to multiply two numbers represented in the system of residual classes (RNS).

Ряд алгоритмов шифрования основан на модулярной арифметике, например алгоритмы Диффи-Хелмана, Эль-Гамаля, RSA. Модулярная арифметика включает в себя множество модульных операций, таких как модулярное сложение, модулярное умножение, модулярное деление и т.д. Например, А ⋅ В mod р = Г является примером модулярного умножения.A number of encryption algorithms are based on modular arithmetic, for example, Diffie-Hellman, El-Gamal, RSA algorithms. Modular arithmetic includes many modular operations, such as modular addition, modular multiplication, modular division, etc. For example, A ⋅ B mod p = Γ is an example of modular multiplication.

Для задач криптографии размеры сомножителей А и В, представленных в двоичной форме, могут достигать более 1024 бит каждый, и, следовательно, результат умножения будет иметь размер более 2048 бит. Нахождение остатка от деления для такого числа является вычислительно сложной задачей.For cryptography tasks, the sizes of the factors A and B, presented in binary form, can reach more than 1024 bits each, and therefore, the multiplication result will have a size of more than 2048 bits. Finding the remainder of the division for such a number is a computationally difficult task.

Один из подходов к повышению эффективности выполнения модулярного умножения предложен в [Montgomery

Figure 00000001
Modular multiplication without trial division // Mathematics of computation. - 1985. - T. 44. - №170. - C. 519-521.] Он заключается в замене нахождения результата по большому модулю p на операции по модулю R, который выбирается таким образом, чтобы операции деления и нахождения остатка были эффективными. Часто R берется в виде степени числа 2. Также должен выполняться ряд условий: R > p, R и p взаимно простые, а также вводятся R-1 и p', удовлетворяющие выражениям 0 < R-1 < p, 0 < p' < R и RR-1 - pp' = 1. Последнее выражение является диафантовым уравнением и может быть решено, например, методом Евклида. Тогда алгоритм нахождения произведения Монтгомери можно описать алгоритмом 1.One approach to improving the performance of modular multiplication is proposed in [Montgomery
Figure 00000001
Modular multiplication without trial division // Mathematics of computation. - 1985. - T. 44. - No. 170. - C. 519-521.] It consists in replacing the finding of the result in the large modulus p with operations in the modulus R, which is chosen so that the division and finding the remainder operations are effective. Often R is taken as a power of 2. Also a number of conditions must be satisfied: R> p, R and p are coprime, and R -1 and p 'are entered that satisfy the expressions 0 <R -1 <p, 0 <p'< R and RR -1 - pp '= 1. The last expression is a diaphantine equation and can be solved, for example, by the Euclidean method. Then the algorithm for finding the Montgomery product can be described by algorithm 1.

Алгоритм 1: Произведение МонтгомериAlgorithm 1: Montgomery's Product

Функция MontMult(A ⋅ В)MontMult Function (A ⋅ B)

m ← (А ⋅ В mod R) p' mod Rm ← (A ⋅ B mod R) p 'mod R

t ← (А ⋅ В + m ⋅ p) / Rt ← (A ⋅ B + m ⋅ p) / R

Если t≥p тоIf t≥p then

вернуть t - preturn t - p

иначеotherwise

вернуть treturn t

Использование данного алгоритма в вычислительных устройствах позволяет уменьшить аппаратную сложность. Однако недостатком этого подхода является то, что результатом алгоритма MontMult(A ⋅ В) является не точный результат А ⋅ В mod p, а масштабированный. Для перевода значения t в немасштабированный вид остатка по модулю p, необходимо вычислить t ⋅ R mod p или, что эквивалентно, применить алгоритм

Figure 00000002
Однако представление Монтгомери является полноценным представлением чисел, допускающим выполнение операций над масштабированными значениями, поэтому перевод к немасштабированному виду необходим лишь в конце вычислений.Using this algorithm in computing devices can reduce hardware complexity. However, the drawback of this approach is that the result of the MontMult algorithm (A ⋅ B) is not an exact result A ⋅ B mod p, but a scaled one. To translate the value of t into the unscaled form of the remainder modulo p, it is necessary to calculate t ⋅ R mod p or, equivalently, apply the algorithm
Figure 00000002
However, the Montgomery representation is a full-fledged representation of numbers that allows operations on scaled values, so a translation to an unscaled view is necessary only at the end of the calculation.

Одним из способов повышения производительности вычисления произведения Монтгомери является применение СОК. В СОК целое число представляется в виде остатков от деления на набор модулей, а арифметические операции над числами заменяются на операциями над остатками. Выполнение операций происходит параллельно без межразрядных переносов, что позволяет очень быстро реализовать сложение, вычитание и умножение.One way to increase the productivity of computing a Montgomery product is to use a RNS. In RNS, an integer is represented as residues from division by a set of modules, and arithmetic operations on numbers are replaced by operations on residues. The operations are performed in parallel without inter-bit transfers, which allows for very fast addition, subtraction and multiplication.

Известен способ умножения Монтгомери в СОК (патент US 7027598, опубл. 11.04.2006). Согласно описанному выше алгоритму, способ сводится к выполнению сначала S = MontMult(A ⋅ Q), где Q=(R2 mod p) - предвычисленная константа, а после F = MontMult(B ⋅ S), где F - конечный результат. В данном изобретении при использовании модулярной арифметики применяют два базиса V и W, все модули vi и wi, (i = 1, …, n), которых взаимно простые. Недостатком данного способа является необходимость три раза переводить результаты между базисами, что является вычислительно сложной операцией.A known method of multiplying Montgomery in RNS (patent US 7027598, publ. 11.04.2006). According to the algorithm described above, the method is reduced to performing first S = MontMult (A ⋅ Q), where Q = (R 2 mod p) is a precomputed constant, and after F = MontMult (B ⋅ S), where F is the final result. In the present invention, when using modular arithmetic, two bases V and W are used, all modules v i and w i , (i = 1, ..., n), which are coprime. The disadvantage of this method is the need to translate the results between the bases three times, which is a computationally complex operation.

Наиболее близким к предлагаемому устройству, выбранным в качестве прототипа, является устройство для умножения чисел в модулярной системе счисления с плавающей запятой (авторское свидетельство SU №1411741, опубликован 23.07.1988), содержащее тактовый вход устройства, выход мантиссы результата устройства, вход мантиссы первого операнда устройства, вход мантиссы второго операнда устройства, вход порядка первого операнда устройства, вход порядка второго операнда устройства, выход порядка результата устройства, выход признака переполнения устройства, вычитатель порядка произведения, первый элемент задержки, схему сравнения с константой, блок модульных умножителей, блок масштабирования чисел, блок вычисления интервального индекса числа, блок суммирования вычетов сумматора порядков, вспомогательный регистр, второй элемент задержки.Closest to the proposed device, selected as a prototype, is a device for multiplying numbers in a modular number system with a floating point (copyright certificate SU No. 1411741, published July 23, 1988), which contains the device’s clock input, device result mantissa output, first operand mantissa input devices, the input of the mantissa of the second operand of the device, the input of the order of the first operand of the device, the input of the order of the second operand of the device, the output of the order of the result of the device, the output of the overflow sign CTBA, subtractor work order, the first element of delay, a comparison circuit with a constant flow of modular multipliers scaling block numbers calculating unit interval index number, the summation block of residues order adder, auxiliary register, the second delay element.

Недостатком данного изобретения являются ограниченные функциональные возможности и большая аппаратная сложность.The disadvantage of this invention is the limited functionality and great hardware complexity.

Техническим результатом заявляемого изобретения является расширение функциональных возможностей и снижение аппаратной сложности за счет применения в устройстве модифицированного метода Монтгомери для вычисления произведения чисел, представленных в СОК.The technical result of the claimed invention is to expand the functionality and reduce hardware complexity due to the use of a modified Montgomery method in the device to calculate the product of numbers represented in RNS.

Данный технический результат достигается тем, что в устройство вычисления модулярного произведения Монтгомери, содержащее вход первого операнда, вход второго операнда, блок умножителей по модулю, блок вычисления первой интервально-индексной характеристики, блок сравнения с константой, где вход первого операнда подключен к первому входу блока умножителей по модулю, ко второму входу которого подключен вход второго операнда введены вход модуля, регистр хранения модуля, блок хранения параметра F, блок вычисления параметра D по первому базису, блок хранения значений Ri,l, где i=1, …, l, l - количество модулей в первом базисе, блок хранения значений Ri,j, здесь i=1, …, l-1, j = l+1, …, k, k - количество модулей в двух базисах, блок вычисления параметра D по второму базису, блок вычисления произведения Монтгомери по второму базису, блок хранения значений Rj,k, блок хранения значений Rj,i, здесь j=l+1, …, k-1, блок вычисления второй интервально-индексной характеристики, блок корректировки второй интервально-индексной характеристики, мультиплексор, блок вычисления произведения Монтгомери по первому базису, регистр хранения произведения Монтгомери, выход произведения Монтгомери, где первый выход блока умножителей по модулю соединен с первым входом блока вычисления параметра D по первому базису, второй вход которого соединен с выходом блока хранения параметра F, на вход которого с первого выхода регистра хранения модуля поступают значения модуля по первому базису, вход регистра хранения модуля подключен ко входу модуля, а со второго выхода регистра хранения модуля значения модуля по второму базису поступают на третий вход блока вычисления произведения Монтгомери по второму базису, второй вход которого подключен к выходу блока вычисления параметра D по второму базису, второй вход которого соединен с выходом блока вычисления первой интервально-индексной характеристики, вход которого подключен к выходу блока хранения значений Ri,l, вход которого подключен к выходу блока вычисления параметра D по первому базису, который также соединен со входом блока хранения значений Ri,j, выход которого соединен с первым входом блока вычисления параметра D по второму базису, второй выход блока умножителей по модулю соединен с первым входом блока вычисления произведения Монтгомери по второму базису, выход которого одновременно подключен ко входу блока хранения значений Rj,k, ко входу блока хранения значений Rj,i, к первому входу регистра хранения произведения Монтгомери, второй вход которого соединен с выходом блока вычисления произведения Монтгомери по первому базису, первый вход которого соединен с выходом блока хранения значений Rj,i, а второй вход подключен к выходу мультиплексора, управляющий вход которого подключен к выходу блока сравнения с константой, вход которого подключен ко входу блока корректировки второй интервально-индексной характеристики, к выходу блока вычисления второй интервально-индексной характеристики и к первому входу мультиплексора, второй вход которого соединен с выходом блока корректировки второй интервально-индексной характеристики, выход блока хранения значений Rj,k подключен ко входу блока вычисления второй интервально-индексной характеристики, выход регистра хранения произведения Монтгомери соединен с выходом произведения Монтгомери.This technical result is achieved by the fact that the Montgomery modular product calculator contains the input of the first operand, the input of the second operand, the block of multipliers modulo, the block of calculation of the first interval-index characteristic, the comparison unit with a constant, where the input of the first operand is connected to the first input of the block multipliers modulo, to the second input of which the input of the second operand is connected, the module input is entered, the module storage register, the parameter storage block F, the parameter D calculation unit from the first base su, the storage unit for the values of R i, l , where i = 1, ..., l, l is the number of modules in the first basis, the storage unit for the values of R i, j , here i = 1, ..., l-1, j = l + 1, ..., k, k - the number of modules in two bases, the unit for calculating the parameter D in the second basis, the unit for computing the Montgomery product in the second basis, the unit for storing the values of R j, k , the unit for storing the values of R j, i , here j = l +1, ..., k-1, block for calculating the second interval-index characteristic, block for adjusting the second interval-index characteristic, multiplexer, block for computing the Montgomery product with respect to the first base ISU, Montgomery product storage register, Montgomery product output, where the first output of the block of multipliers is modulo connected to the first input of the block for calculating parameter D according to the first basis, the second input of which is connected to the output of the block of storage of parameter F, whose input is from the first output of the module the module values are received in the first basis, the input of the module storage register is connected to the module input, and from the second output of the module storage register, the module values in the second basis are sent to the third input of the calculation unit Montgomery product Ia according to the second basis, the second input of which is connected to the output of calculation block parameter D by the second basis, a second input coupled to an output of calculating unit of the first interval-index characteristic, whose input is connected to the output values of the storage unit R i, l, whose input connected to the output parameter calculating unit D on the basis of the first, which is also connected to the input of the storage unit values R i, j, the output of which is connected to the first input parameter calculating unit D on the basis of the second, the second output Lok multipliers modulo connected to the first input of the Montgomery product calculation unit according to the second basis, whose output is simultaneously connected to the input of the block store values R j, k, to the input value storage unit R j, i, to the first input of the Montgomery product storage register, a second input which is connected to the output of the Montgomery product calculation unit according to the first basis, the first input of which is connected to the output of the value storage unit R j, i , and the second input is connected to the output of the multiplexer, the control input of which is connected to the output of the comparison unit with a constant, the input of which is connected to the input of the correction unit of the second interval-index characteristic, to the output of the calculation unit of the second interval-index characteristic and to the first input of the multiplexer, the second input of which is connected to the output of the correction unit of the second interval-index characteristic, output a value storage unit R j, k is connected to the input of the second interval-index characteristic calculation unit, the output of the Montgomery product storage register is connected to the output Dénia Montgomery.

Данное устройство вычисления модулярного произведения Монтгомери поясняется фигурой 1, на которой представлен общий вид устройства вычисления модулярного произведения Монтгомери, содержащего вход первого операнда 1, вход второго операнда 2, блок умножителей по модулю 3, вход модуля 4, регистр хранения модуля 5, блок хранения параметра F 6, блок вычисления параметра D по первому базису 7, блок хранения значений Ri,l 8, блок хранения значений Ri,j 9, блок вычисления первой интервально-индексной характеристики 10, блок вычисления параметра D по второму базису 11, блок вычисления произведения Монтгомери по второму базису 12, блок хранения значений Rj,k 13, блок хранения значений Rj,i 14, блок вычисления второй интервально-индексной характеристики 15, блок корректировки второй интервально-индексной характеристики 16, блок сравнения с константой 17, мультиплексор 18, блок вычисления произведения Монтгомери по первому базису 19, регистр хранения произведения Монтгомери 20, выход произведения Монтгомери 21.This Montgomery modular product calculation device is illustrated in Figure 1, which shows a general view of the Montgomery modular product calculation device containing the input of the first operand 1, the input of the second operand 2, the multiplier unit modulo 3, the input of module 4, the storage register of module 5, the parameter storage unit F 6, the block for calculating the parameter D according to the first basis 7, the block for storing the values of R i, l 8, the block for storing the values of R i, j 9, the block for calculating the first interval-index characteristic 10, the block for calculating the parameter D for the second at basis 11, a unit for computing the Montgomery product in the second basis 12, a unit for storing values of R j, k 13, a unit for storing values of R j, i 14, a unit for calculating a second interval-index characteristic 15, a correction unit for a second interval-index characteristic 16, a block comparison with a constant 17, a multiplexer 18, a unit for computing a Montgomery product according to the first basis 19, a storage register for a Montgomery product 20, an output of a Montgomery product 21.

Сущность изобретения основана на следующем математическом аппарате. Определяют два базиса СОК М1 и M2 с взаимно простыми модулями mi и количеством модулей

Figure 00000003
в первом базисе и k = 8 всего модулей в обоих базисах, т.е. во втором базисе
Figure 00000004
модуля.The invention is based on the following mathematical apparatus. Two bases JUICE M 1 and M 2 are determined with mutually simple modules m i and the number of modules
Figure 00000003
in the first basis and k = 8 of all modules in both bases, i.e. in the second basis
Figure 00000004
module.

Figure 00000005
Figure 00000005

Figure 00000006
Figure 00000006

Тогда объединенный базисThen the combined basis

Figure 00000007
Figure 00000007

Затем вычисляют вспомогательный модуль то, удовлетворяющий соотношению

Figure 00000008
т.е.
Figure 00000009
Подставляя данные значения, получают, что
Figure 00000010
Возьмем m0 = 8.Then calculate the auxiliary module that satisfies the relation
Figure 00000008
those.
Figure 00000009
Substituting these values, we obtain
Figure 00000010
Take m 0 = 8.

Вычисляют необходимые для работы константы.The constants necessary for the operation are calculated.

Figure 00000011
Figure 00000011

Figure 00000012
Figure 00000012

Figure 00000013
Figure 00000013

Затем вычисляют следующие остатки:Then calculate the following residues:

Figure 00000014
Figure 00000014

Figure 00000015
Figure 00000015

и следующие величиныand the following quantities

Figure 00000016
Figure 00000016

где

Figure 00000017
- мультипликативная инверсия числа m по модулю p.Where
Figure 00000017
is the multiplicative inversion of the number m modulo p.

Для работы также необходимо определить значение следующих констант:For operation, it is also necessary to determine the value of the following constants:

Figure 00000018
Figure 00000018

По формулам (1)-(2) вычисляют константы:The formulas (1) - (2) calculate the constants:

Figure 00000019
Figure 00000019

Затем находят все необходимые константы:Then they find all the necessary constants:

Figure 00000020
Figure 00000020

По формулам (3)-(4) находят следующие значения:The formulas (3) - (4) find the following values:

Figure 00000021
Figure 00000021

По формуле (5) определяют:By the formula (5) determine:

Figure 00000022
Figure 00000022

По формулам (6)-(7):By the formulas (6) - (7):

Figure 00000023
Figure 00000023

По формуле (8) находят:By the formula (8) find:

Figure 00000024
Figure 00000024

Затем задают модуль p, удовлетворяющий условиюThen, a module p satisfying the condition

Figure 00000025
Figure 00000025

В качестве примера значение модуля берется равнымAs an example, the value of the module is taken equal

Figure 00000026
Figure 00000026

Из значения модуля p по первому базису M1 вычисляют параметрFrom the value of the module p on the first basis M 1 calculate the parameter

Figure 00000027
Figure 00000027

В качестве сомножителей берут два операнда, представленных в СОК:Two operands represented in the RNS are taken as factors:

Figure 00000028
Figure 00000028

где A, В < p, и находят значение

Figure 00000029
where A, B <p, and find the value
Figure 00000029

Figure 00000030
Figure 00000030

Затем находят по первому базису параметрThen, the parameter is found in the first basis

Figure 00000031
Figure 00000031

Из полученных значений Ci,j, Ci, D по формуламFrom the obtained values of C i, j , C i , D according to the formulas

Figure 00000032
Figure 00000032

вычисляют следующие значения:calculate the following values:

Figure 00000033
Figure 00000033

Затем по формулеThen according to the formula

Figure 00000034
Figure 00000034

находят первую интервально-индексную характеристику

Figure 00000035
find the first interval-index characteristic
Figure 00000035

Figure 00000036
Figure 00000036

По формулеAccording to the formula

Figure 00000037
Figure 00000037

вычисляют значения Ri,j:calculate the values of R i, j :

Figure 00000038
Figure 00000038

По формулеAccording to the formula

Figure 00000039
Figure 00000039

находят значение параметра D по второму базису:find the value of the parameter D on the second basis:

Figure 00000040
Figure 00000040

По формулеAccording to the formula

Figure 00000041
Figure 00000041

находят результат вычисления произведения Монтгомери по второму базису М2:find the result of computing the Montgomery product on the second basis of M 2 :

Figure 00000042
Figure 00000042

По формуламAccording to the formulas

Figure 00000043
Figure 00000043

вычисляют значения:calculate the values:

Figure 00000044
Figure 00000044

Затем по формулеThen according to the formula

Figure 00000045
Figure 00000045

вычисляют вторую интервально-индексную характеристику

Figure 00000046
calculate the second interval-index characteristic
Figure 00000046

Figure 00000047
Figure 00000047

Затем вторую интервально-индексную характеристику

Figure 00000048
сравнивают с константой m0. Значение второй интервально-индексной характеристики
Figure 00000049
корректируют на основе выражения:Then the second interval-index characteristic
Figure 00000048
compared with the constant m 0 . The value of the second interval-index characteristic
Figure 00000049
correct based on the expression:

Figure 00000050
Figure 00000050

Из выражения (18), проверяя условие

Figure 00000051
и т.к. 0 < 8, скорректированную вторую интервально-индексную характеристику
Figure 00000052
принимают равной
Figure 00000053
From expression (18), checking the condition
Figure 00000051
and since 0 <8, adjusted second interval-index characteristic
Figure 00000052
accept equal
Figure 00000053

Далее по формулеFurther according to the formula

Figure 00000054
Figure 00000054

находят следующие значения:find the following values:

Figure 00000055
Figure 00000055

И, наконец, из выраженияAnd finally, from the expression

Figure 00000056
Figure 00000056

находят результат вычисления произведения Монтгомери по первому базису

Figure 00000057
find the result of computing the Montgomery product on the first basis
Figure 00000057

Таким образом, получено значение произведения Монтгомери

Figure 00000058
в СОК.Thus, the value of the work of Montgomery is obtained.
Figure 00000058
in JUICE.

Figure 00000059
Figure 00000059

Обратим внимание, что полученное значение является масштабированным и для получения немасштабированного значения нужно выполнить данный алгоритм еще раз со значениями:Note that the obtained value is scaled and to obtain an unscaled value, you need to run this algorithm again with the values:

Figure 00000060
Figure 00000060

и

Figure 00000061
and
Figure 00000061

Результатом работы алгоритма является число в СОК: (0, 2, 4, 3, 2, 6, 7, 15).The result of the algorithm is the number in the RNS: (0, 2, 4, 3, 2, 6, 7, 15).

Проверим данное значение:Check this value:

Figure 00000062
Figure 00000062

Таким образом, алгоритм работает верно.Thus, the algorithm works correctly.

Опишем работу устройства на основе данного алгоритма.We describe the operation of the device based on this algorithm.

На входы первого операнда 1 и второго операнда 2 подаются соответственно значения сомножителей А и В, представленные в СОК, которые поступают на блок умножителей по модулю 3, где вычисляется значение

Figure 00000063
Значения С по первому базису с первого выхода блока умножителей по модулю 3 поступают на первый вход блока вычисления параметра D по первому базису 7, значения С по второму базису со второго выхода блока умножителей по модулю 3 поступают на первый вход блока вычисления произведения Монтгомери по второму базису 12.The inputs of the first operand 1 and the second operand 2 are respectively supplied with the values of the factors A and B presented in the RNC, which are fed to the block of multipliers modulo 3, where the value is calculated
Figure 00000063
The values of C for the first basis from the first output of the block of multipliers modulo 3 go to the first input of the unit for computing the parameter D according to the first basis 7, the values of C for the second basis from the second output of the block of multipliers modulo 3 go to the first input of the unit for computing the product of Montgomery according to the second basis 12.

Значение модуля p поступает на вход модуля 4, откуда оно записывается в регистр хранения модуля 5. Значения модуля p по первому базису поступают на вход блока хранения параметра F 6, который реализован в виде ПЗУ, на вход которого подается число

Figure 00000064
а на выход поступает параметр
Figure 00000065
Реализация табличным способом в виде ПЗУ позволит избежать вычислительно сложной операции нахождения мультипликативной инверсии. С выхода блока хранения параметра F 6 значение F поступает на второй вход блока вычисления параметра D по первому базису 7, где вычисляется
Figure 00000066
The value of module p goes to the input of module 4, from where it is written into the storage register of module 5. The values of module p go to the input of the storage unit of parameter F 6, which is implemented as a ROM, to the input of which the number
Figure 00000064
and the output is the parameter
Figure 00000065
Implementation in a tabular manner in the form of ROM will avoid the computationally complex operation of finding a multiplicative inversion. From the output of the storage unit for parameter F 6, the value F is supplied to the second input of the unit for calculating the parameter D according to the first basis 7, where
Figure 00000066

Значение параметра D с выхода блока вычисления параметра D по первому базису 7 одновременно поступает на вход блока хранения значений

Figure 00000067
8 и вход блока хранения значений Ri,j 9.The value of the parameter D from the output of the block for calculating the parameter D according to the first basis 7 is simultaneously fed to the input of the value storage unit
Figure 00000067
8 and the input of the storage unit of values of R i, j 9.

В блоке хранения значений

Figure 00000067
8 на основе значений
Figure 00000068
табличным способом получают хранящиеся там значения
Figure 00000069
вычисленные по формулам (9)-(10), которые поступают на вход блока вычисления первой интервально-индексной характеристики 10
Figure 00000070
которая вычисляется по формуле (11). Затем значение первой интервально-индексной характеристики
Figure 00000071
с выхода блока вычисления первой интервально-индексной характеристики 10
Figure 00000072
поступает на второй вход блока вычисления параметра D по второму базису 11.In the value storage unit
Figure 00000067
8 based on values
Figure 00000068
in a tabular way get the values stored there
Figure 00000069
calculated by formulas (9) - (10), which are fed to the input of the calculation unit of the first interval-index characteristic 10
Figure 00000070
which is calculated by the formula (11). Then the value of the first interval-index characteristic
Figure 00000071
from the output of the calculation unit of the first interval-index characteristic 10
Figure 00000072
arrives at the second input of the block for calculating the parameter D according to the second basis 11.

В блоке хранения значений Ri,j 9 на основе значений

Figure 00000073
табличным способом получают хранящиеся там значения
Figure 00000074
Figure 00000075
вычисленные по формуле (12), которые поступают на первый вход блока вычисления параметра D по второму базису 11.In the storage unit of values R i, j 9 based on the values
Figure 00000073
in a tabular way get the values stored there
Figure 00000074
Figure 00000075
calculated by the formula (12), which are fed to the first input of the block for calculating the parameter D according to the second basis 11.

В блоке вычисления параметра D по второму базису 11 по формуле (13) происходит вычисление значений

Figure 00000076
, которые поступают на второй вход блока вычисления произведения Монтгомери по второму базису 12, на третий вход которого со второго выхода регистра хранения модуля 5 поступают значения модуля p по второму базису:
Figure 00000077
In the block for calculating the parameter D according to the second basis 11 by the formula (13), the values are calculated
Figure 00000076
that go to the second input of the Montgomery product calculation unit according to the second basis 12, the third input of which from the second output of the storage register of module 5 receives the values of module p according to the second basis:
Figure 00000077

В блоке вычисления произведения Монтгомери по второму базису 12 по формуле (14) находят результат вычисления произведения Монтгомери по второму базису

Figure 00000078
который поступает одновременно на первый вход регистра хранения произведения Монтгомери 20, на вход блока хранения значений Rj,i 14 и на вход блока хранения значений Rj,k 13.In the block for computing the Montgomery product for the second basis 12, using formula (14), find the result of computing the Montgomery product for the second basis
Figure 00000078
which is fed simultaneously to the first input of the storage register of the Montgomery 20 product, to the input of the storage unit of values R j, i 14 and to the input of the storage unit of values R j, k 13.

В блоке хранения значений Rj,k 13 на основе значений

Figure 00000079
табличным способом получают хранящиеся там значения Rj,k, вычисленные по формулам (15)-(16), которые поступают на вход блока вычисления второй интервально-индексной характеристики 15
Figure 00000080
В блоке вычисления второй интервально-индексной характеристики 15 по формуле (17) происходит вычисление
Figure 00000081
значение которой одновременно поступает на первый вход мультиплексора 18, на вход блока корректировки второй интервально-индексной характеристики 16
Figure 00000082
на вход блока сравнения с константой 17.In the storage unit of values of R j, k 13 based on the values
Figure 00000079
in a tabular manner, the values of R j, k stored there are calculated, calculated according to formulas (15) - (16), which are input to the calculation unit of the second interval-index characteristic 15
Figure 00000080
In the calculation unit of the second interval-index characteristic 15 by the formula (17), the calculation
Figure 00000081
the value of which simultaneously arrives at the first input of the multiplexer 18, at the input of the correction unit of the second interval-index characteristic 16
Figure 00000082
to the input of the comparison unit with the constant 17.

В блоке корректировки второй интервально-индексной характеристики 16 по формуле (18) вычисляют

Figure 00000083
которое поступает на второй вход мультиплексора 18.In the block adjustment of the second interval-index characteristic 16 by the formula (18) calculate
Figure 00000083
which goes to the second input of the multiplexer 18.

В блоке сравнения с константой 17 проверяется условие

Figure 00000084
результат которого поступает на управляющий вход мультиплексора 18. На выход мультиплексора 18 поступает значение
Figure 00000085
скорректированное на основе выражения (18), которое затем поступает на второй вход блока вычисления произведения Монтгомери по первому базису 19.In the comparison block with constant 17, the condition is checked
Figure 00000084
the result of which is supplied to the control input of the multiplexer 18. The output of the multiplexer 18 receives the value
Figure 00000085
adjusted on the basis of expression (18), which then goes to the second input of the unit for computing the Montgomery product according to the first basis 19.

В блоке хранения значений Rj,i 14 по формуле (19) происходит вычисление значений

Figure 00000086
которые поступают на первый вход блока вычисления произведения Монтгомери по первому базису 19.In the storage unit of the values of R j, i 14 according to the formula (19), the values are calculated
Figure 00000086
which go to the first input of the unit for computing the Montgomery product according to the first basis 19.

В блоке вычисления произведения Монтгомери по первому базису 19 по формуле (20) вычисляют значения произведения Монтгомери по первому базису

Figure 00000087
которые поступают на второй вход регистра хранения произведения Монтгомери 20.In the block for computing the Montgomery product according to the first basis 19, using the formula (20), the values of the Montgomery product according to the first basis are calculated
Figure 00000087
which go to the second input of the storage register of the work of Montgomery 20.

На выход регистра хранения произведения Монтгомери 20 поступает значение произведение Монтгомери

Figure 00000088
по обоим базисам.The output of the storage register of the work of Montgomery 20 receives the value of the work of Montgomery
Figure 00000088
on both bases.

Claims (1)

Устройство вычисления модулярного произведения Монтгомери, содержащее вход первого операнда, вход второго операнда, блок умножителей по модулю, блок вычисления первой интервально-индексной характеристики, блок сравнения с константой, где вход первого операнда подключен к первому входу блока умножителей по модулю, ко второму входу которого подключен вход второго операнда, отличающееся тем, что в него введены вход модуля, регистр хранения модуля, блок хранения параметра F, блок вычисления параметра D по первому базису, блок хранения значений Ri,l, где i=1, …, l, l - количество модулей в первом базисе, блок хранения значений Ri,j, здесь i=1, …, l-1, j=l+1, …, k, k - количество модулей в двух базисах, блок вычисления параметра D по второму базису, блок вычисления произведения Монтгомери по второму базису, блок хранения значений Rj,k, блок хранения значений Rj,i, здесь j=l+1, …, k-1, блок вычисления второй интервально-индексной характеристики, блок корректировки второй интервально-индексной характеристики, мультиплексор, блок вычисления произведения Монтгомери по первому базису, регистр хранения произведения Монтгомери, выход произведения Монтгомери, где первый выход блока умножителей по модулю соединен с первым входом блока вычисления D по первому базису, второй вход которого соединен с выходом блока хранения параметра F, на вход которого с первого выхода регистра хранения модуля поступают значения модуля по первому базису, вход регистра хранения модуля подключен ко входу модуля, а со второго выхода регистра хранения модуля значения модуля по второму базису поступают на третий вход блока вычисления произведения Монтгомери по второму базису, второй вход которого подключен к выходу блока вычисления параметра D по второму базису, второй вход которого соединен с выходом блока вычисления первой интервально-индексной характеристики, вход которого подключен к выходу блока хранения значений Ri,l, вход которого подключен к выходу блока вычисления параметра D по первому базису, который также соединен со входом блока хранения значений Ri,j, выход которого соединен с первым входом блока вычисления параметра D по второму базису, второй выход блока умножителей по модулю соединен с первым входом блока вычисления произведения Монтгомери по второму базису, выход которого одновременно подключен ко входу блока хранения значений Rj,k, ко входу блока хранения значений Rj,i, к первому входу регистра хранения произведения Монтгомери, второй вход которого соединен с выходом блока вычисления произведения Монтгомери по первому базису, первый вход которого соединен с выходом блока хранения значений Rj,i, а второй вход подключен к выходу мультиплексора, управляющий вход которого подключен к выходу блока сравнения с константой, вход которого подключен ко входу блока корректировки второй интервально-индексной характеристики, к выходу блока вычисления второй интервально-индексной характеристики и к первому входу мультиплексора, второй вход которого соединен с выходом блока корректировки второй интервально-индексной характеристики, выход блока хранения значений Rj,k подключен ко входу блока вычисления второй интервально-индексной характеристики, выход регистра хранения произведения Монтгомери соединен с выходом произведения Монтгомери.A Montgomery modular product computation device comprising an input of a first operand, an input of a second operand, a modulo multiplier block, a unit for calculating a first interval-index characteristic, a constant comparing unit, where an input of the first operand is connected to the first input of a multiplier modulo, to the second input of which the input of the second operand is connected, characterized in that the input of the module, the module storage register, the storage unit for the parameter F, the calculation unit for the parameter D on the first basis, the storage unit are s R i, l, where i = 1, ..., l, l - number of modules in the first basis, a block of values storing R i, j, here i = 1, ..., l-1, j = l + 1, ..., k, k is the number of modules in two bases, the unit for calculating the parameter D in the second basis, the unit for computing the Montgomery product in the second basis, the unit for storing the values of R j, k , the unit for storing the values of R j, i , here j = l + 1, ... , k-1, block for calculating the second interval-index characteristic, block for correcting the second interval-index characteristic, multiplexer, block for computing the Montgomery product with respect to the first basis, storage register Montgomery's note, the output of Montgomery's work, where the first output of the block of multipliers is modulo connected to the first input of the calculation block D along the first basis, the second input of which is connected to the output of the storage block of parameter F, the input of which from the first output of the module storage register receives the module values of the first basis, the input of the storage register of the module is connected to the input of the module, and from the second output of the register of storage of the module, the values of the module on the second basis go to the third input of the block of calculation of the Montgomery product by the second th basis, the second input of which is connected to the output calculation unit parameter D by the second basis, a second input coupled to an output of the calculating the first interval-index characteristic, whose input is connected to the output values of the storage unit R i, l, whose input is connected to the output of block calculating a first parameter D on the basis, which is also connected to the input of the storage unit values R i, j, the output of which is connected to the first input parameter calculating unit D on the basis of the second, the second output of the multipliers modulo unit coupled n to the first input of the calculation work Montgomery the second basis, whose output is simultaneously connected to the input of the block store values R j, k, to the input value storage unit R j, i, to the first input of the Montgomery product storage register, a second input coupled to an output Montgomery product of the first calculation unit basis, the first input of which is connected to the output values of the storage unit R j, i, a second input connected to the output of the multiplexer, whose control input is connected to the output of the comparator unit with constant Second, the input of which is connected to the input of block corrections second interval-index characteristics to the output of calculation block of the second interval-index characteristics and to the first input of the multiplexer, a second input coupled to an output adjustment unit of the second interval-index characteristic output values of the storage unit R j , k is connected to the input of the calculation unit of the second interval-index characteristic, the output of the Montgomery artwork storage register is connected to the output of the Montgomery artwork.
RU2017129526A 2017-08-18 2017-08-18 Device for calculation montgomery modular product RU2652450C1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
RU2017129526A RU2652450C1 (en) 2017-08-18 2017-08-18 Device for calculation montgomery modular product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
RU2017129526A RU2652450C1 (en) 2017-08-18 2017-08-18 Device for calculation montgomery modular product

Publications (1)

Publication Number Publication Date
RU2652450C1 true RU2652450C1 (en) 2018-04-26

Family

ID=62045615

Family Applications (1)

Application Number Title Priority Date Filing Date
RU2017129526A RU2652450C1 (en) 2017-08-18 2017-08-18 Device for calculation montgomery modular product

Country Status (1)

Country Link
RU (1) RU2652450C1 (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040189355A1 (en) * 2002-12-02 2004-09-30 Walmsley Simon Robert Temperature based filter for an on-chip system clock
US7191333B1 (en) * 2001-10-25 2007-03-13 Cisco Technology, Inc. Method and apparatus for calculating a multiplicative inverse of an element of a prime field
RU2363979C2 (en) * 2004-07-23 2009-08-10 Квэлкомм Инкорпорейтед Method and device for generating random numbers
RU2595906C1 (en) * 2015-03-13 2016-08-27 Федеральное государственное бюджетное образовательное учреждение высшего образования "Кубанский государственный технологический университет" (ФГБОУ ВО "КубГТУ") Device for calculating functions

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7191333B1 (en) * 2001-10-25 2007-03-13 Cisco Technology, Inc. Method and apparatus for calculating a multiplicative inverse of an element of a prime field
US20040189355A1 (en) * 2002-12-02 2004-09-30 Walmsley Simon Robert Temperature based filter for an on-chip system clock
US7592829B2 (en) * 2002-12-02 2009-09-22 Silverbrook Research Pty Ltd On-chip storage of secret information as inverse pair
RU2363979C2 (en) * 2004-07-23 2009-08-10 Квэлкомм Инкорпорейтед Method and device for generating random numbers
RU2595906C1 (en) * 2015-03-13 2016-08-27 Федеральное государственное бюджетное образовательное учреждение высшего образования "Кубанский государственный технологический университет" (ФГБОУ ВО "КубГТУ") Device for calculating functions

Similar Documents

Publication Publication Date Title
Higham Error analysis of the Björck-Pereyra algorithms for solving Vandermonde systems
US20130185345A1 (en) Algebraic processor
US8990278B1 (en) Circuitry for computing mathematical functions
KR20150114104A (en) Method and apparatus for computing montgomery multiplication performing final reduction wihhout comparator
Higham et al. Computing the action of trigonometric and hyperbolic matrix functions
Malik High throughput floating-point dividers implemented in FPGA
Dwivedi An efficient multiplication algorithm using Nikhilam method
EP3121710B1 (en) Computational method, computational device and computer software product for montgomery domain
RU2652450C1 (en) Device for calculation montgomery modular product
KR101128505B1 (en) method and apparatus for modular multiplication
EP3226120B1 (en) Non-modular multiplier, method for non-modular multiplication and computational device
CN113672196B (en) Double multiplication calculating device and method based on single digital signal processing unit
Zyuzina et al. Monotone approximation of a scalar conservation law based on the CABARET scheme in the case of a sign-changing characteristic field
Ali et al. A Total norm of τ-adic Non-Adjacent Form Occuring among all Element of Z (τ): An Alternative Formula
US20140052767A1 (en) Apparatus and architecture for general powering computation
Schinianakis et al. GF (2 n) Montgomery multiplication using Polynomial Residue Arithmetic
Jaiswal et al. Taylor series based architecture for quadruple precision floating point division
Ishmukhametov et al. A parallel computation of the GCD of natural numbers
Fayed et al. A high-speed, high-radix, processor array architecture for real-time elliptic curve cryptography over GF (2 m)
Czyżak et al. FPGA realization of an improved alpha max plus beta min algorithm
Gil et al. On the computation and inversion of the cumulative noncentral beta distribution function
Kukade et al. A Novel Parallel Multiplier for 2's Complement Numbers Using Booth's Recoding Algorithm
EP2897041B1 (en) Optimized Hardware Architecture and Method for ECC Point Addition Using Mixed Affine-Jacobian Coordinates over Short Weierstrass Curves
RU2559772C2 (en) Device for primary division of molecular numbers in format of remainder class system
KR20200058249A (en) Method for computing 3-isogeny on twisted edwards curves