RU2755734C1 - Apparatus for multiplying numbers by an arbitrary modulus - Google Patents

Apparatus for multiplying numbers by an arbitrary modulus Download PDF

Info

Publication number
RU2755734C1
RU2755734C1 RU2020128299A RU2020128299A RU2755734C1 RU 2755734 C1 RU2755734 C1 RU 2755734C1 RU 2020128299 A RU2020128299 A RU 2020128299A RU 2020128299 A RU2020128299 A RU 2020128299A RU 2755734 C1 RU2755734 C1 RU 2755734C1
Authority
RU
Russia
Prior art keywords
input
information
register
output
adder
Prior art date
Application number
RU2020128299A
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 RU2020128299A priority Critical patent/RU2755734C1/en
Application granted granted Critical
Publication of RU2755734C1 publication Critical patent/RU2755734C1/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/60Methods or arrangements for performing computations using a digital non-denominational number representation, i.e. number representation without radix; Computing devices using combinations of denominational and non-denominational quantity representations, e.g. using difunction pulse trains, STEELE computers, phase computers
    • G06F7/72Methods or arrangements for performing computations using a digital non-denominational number representation, i.e. number representation without radix; Computing devices using combinations of denominational and non-denominational quantity representations, e.g. using difunction pulse trains, STEELE computers, phase computers using residue arithmetic
    • 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/60Methods or arrangements for performing computations using a digital non-denominational number representation, i.e. number representation without radix; Computing devices using combinations of denominational and non-denominational quantity representations, e.g. using difunction pulse trains, STEELE computers, phase computers
    • G06F7/72Methods or arrangements for performing computations using a digital non-denominational number representation, i.e. number representation without radix; Computing devices using combinations of denominational and non-denominational quantity representations, e.g. using difunction pulse trains, STEELE computers, phase computers using residue arithmetic
    • G06F7/722Modular multiplication

Landscapes

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

Abstract

FIELD: computing technology.
SUBSTANCE: apparatus comprises three registers, a key, three adders, two multiplexers, an OR element, and a block of OR elements. The proposed apparatus provides a possibility to achieve the described result when calculating the product of the numbers A and B modulo P by consecutively implementing the expression: (A·B) ≡ (a n -1(2 n -1·B) mod P +…+(a 1(2·B) mod P +a 0·B) mod P…) mod P, wherein n is the number of digits of the input number A; a i ,
Figure 00000006
are the coefficients in the binary representation of the number A.
EFFECT: technical result consists in providing an apparatus for multiplying numbers by an arbitrary modulus with a lower amount of equipment.
1 cl, 1 dwg, 8 tbl

Description

Изобретение относится к вычислительной технике и может быть использовано в цифровых вычислительных устройствах, в криптографических приложениях, а также в устройствах цифровой обработки сигналов и в системах управления.The invention relates to computer technology and can be used in digital computing devices, in cryptographic applications, as well as in digital signal processing devices and control systems.

Известно устройство для умножения чисел по модулю, содержащее два входных регистра, два дешифратора, три группы элементов ИЛИ, четыре группы элементов И, табличный вычислитель значений вида α'β'(mod p/2)+p/2, пять элементов ИЛИ, два элемента И и шифратор (см. АС СССР №1187161, кл. G 06 F 7/49, опубл. 23.10.1985).A device for multiplying numbers modulo is known, containing two input registers, two decoders, three groups of OR elements, four groups of AND elements, a tabular calculator of values of the form α'β '(mod p / 2) + p / 2, five OR elements, two element And and the encoder (see USSR AC No. 1187161, class G 06 F 7/49, publ. 23.10.1985).

Недостатком данного устройства является низкое быстродействие.The disadvantage of this device is its low performance.

Известен умножитель на два по модулю, содержащий сумматор и мультиплексор (см. патент РФ №2015537, кл. G 06 F 7/49, опубл. 30.06.1994).Known multiplier by two modulo, containing an adder and a multiplexer (see RF patent No. 2015537, class G 06 F 7/49, publ. 30.06.1994).

Недостатком данного устройства являются его ограниченные функциональные возможности, а именно отсутствие возможности умножения на число, отличное от двух.The disadvantage of this device is its limited functionality, namely, the inability to multiply by a number other than two.

Наиболее близким по технической сущности к заявляемому изобретению является устройство для умножения чисел по произвольному модулю, содержащее сумматоры, мультиплексоры, ключи, блоки сдвига, инвертор и сумматор по модулю (см. патент РФ № 2316042, МПК G06F 7/523 (2006.01), G06F 7/72 (2006.01), опубл. 27.01.2008. Бюл. № 3). Недостатком данного устройства большой объем оборудования.The closest in technical essence to the claimed invention is a device for multiplying numbers by an arbitrary modulus, containing adders, multiplexers, keys, shift blocks, an inverter and an adder modulo (see RF patent No. 2316042, IPC G06F 7/523 (2006.01), G06F 7/72 (2006.01), publ. 27.01.2008. Bull. No. 3). The disadvantage of this device is the large amount of equipment.

Техническим результатом изобретения является сокращение объема оборудования.The technical result of the invention is to reduce the amount of equipment.

Для достижения технического результата в устройство для умножения чисел по произвольному модулю, содержащее ключ, три сумматора, два мультиплексора, вход кода множимого, вход кода множителя, выход кода произведения, вход инверсного кода модуля, причем на первый информационный вход первого сумматора подается инверсный код модуля, а на вход переноса подается сигнал логической единицы, информационный выход соединен с первым информационным входом первого мультиплексора, выход переноса соединен с управляющим входом первого мультиплексора, а второй информационный вход соединен со вторым информационным входом первого мультиплексора, на первый информационный вход второго сумматора подается инверсный код модуля, а на вход переноса подается сигнал логической единицы, информационный выход соединен с первым информационным входом второго мультиплексора, выход переноса соединен с управляющим входом второго мультиплексора, дополнительно введены вход установки в исходное состояние, тактовый вход, элемент ИЛИ, три регистра и блок элементов ИЛИ, причем первый регистр является регистром сдвига, а второй и третий регистры являются накопительными, информационный вход первого регистра является входом кода множимого устройства, вход сигнала параллельной записи соединен со входом установки в исходное состояние устройства, вход сдвига соединен с тактовым входом устройства, информационный выход младшего разряда соединен с управляющим входом ключа, информационный выход которого соединен с первым информационным входом третьего сумматора, информационный выход которого соединен со вторым информационным входом второго сумматора и вторым информационным входом второго мультиплексора, информационный выход которого соединен с информационным входом второго регистра, вход записи которого соединен с тактовым входом устройства, а выход является выходом кода произведения устройства и соединен со вторым информационным входом третьего сумматора, вход кодов множителя устройства соединен с первым информационным входом блока элементов ИЛИ, второй информационный вход которого соединен с информационным выходом первого мультиплексора, а выход соединен с информационным входом третьего регистра, вход записи которого соединен с выходом элемента ИЛИ, а выход соединен информационным входом ключа и со сдвигом на один разряд в сторону старшего со вторыми информационными входами первого сумматора и первого мультиплексора, первый вход элемента ИЛИ соединен со входом установки в исходное состояние устройства, а второй соединен с тактовым входом устройства. To achieve a technical result, a device for multiplying numbers by an arbitrary modulus containing a key, three adders, two multiplexers, an input of a multiplier code, an input of a multiplier code, an output of a product code, an input of an inverse module code, and the inverse code of a module is fed to the first information input of the first adder , and a logical unit signal is supplied to the transfer input, the information output is connected to the first information input of the first multiplexer, the transfer output is connected to the control input of the first multiplexer, and the second information input is connected to the second information input of the first multiplexer, the inverse code is supplied to the first information input of the second adder module, and a logical unit signal is fed to the transfer input, the information output is connected to the first information input of the second multiplexer, the transfer output is connected to the control input of the second multiplexer, the input of the installation to the initial state, the clock input, the element OR, three registers and a block of OR elements, the first register being a shift register, and the second and third registers are accumulative, the information input of the first register is the input of the multiplier device code, the input of the parallel recording signal is connected to the input of setting the initial state of the device, the shift input connected to the clock input of the device, the information output of the least significant bit is connected to the control input of the key, the information output of which is connected to the first information input of the third adder, the information output of which is connected to the second information input of the second adder and the second information input of the second multiplexer, the information output of which is connected to the information the input of the second register, the write input of which is connected to the clock input of the device, and the output is the output of the product code of the device and is connected to the second information input of the third adder, the input of the multiplier codes of the device is connected to the first information th input of the block of OR elements, the second information input of which is connected to the information output of the first multiplexer, and the output is connected to the information input of the third register, the write input of which is connected to the output of the OR element, and the output is connected to the information input of the key and with a shift by one bit towards the higher with the second information inputs of the first adder and the first multiplexer, the first input of the OR element is connected to the input of the device initialization, and the second is connected to the clock input of the device.

Сущность изобретения заключается в реализации следующего способа вычисления произведения чисел A и B по модулю P. ПустьThe essence of the invention lies in the implementation of the following method for calculating the product of numbers A and B modulo P. Let be

(A·B) ≡ R (mod P), (1)( A B ) ≡ R (mod P ), (1)

где A - целое положительное число, являющееся множимым;where A is a positive integer that is multiplicable;

B - целое положительное число, являющееся множителем, причем B<P; B is a positive integer that is a factor, and B <P ;

P - целое положительное число, называемое модулем; P is a positive integer called the modulus;

R - целое положительное число, являющееся остатком от произведения чисел A и B по модулю P. R is a positive integer that is the remainder of the product of numbers A and B modulo P.

При этом пустьMoreover, let

A = a n -1 ·2 n -1+. . . +a 1 ·2+a 0, (2) A = a n -1 · 2 n -1 +. ... ... + A 1 · 2+ a 0 (2)

B = b m -1 ·2 m -1+ . . . + b 1 ·2+b 0, (3) B = b m -1 · 2 m -1 +. ... ... + B 1 · 2+ b 0 (3)

P = p m -1 ·2 m -1+ . . . +p 1 ·21+p 0, (4) P = p m -1 · 2 m -1 +. ... ... + P 1 · 2 1 + p 0 (4)

R = r m -1 ·2 m -1+ . . . +r 1 ·21+r 0, (5) R = r m -1 · 2 m -1 +. ... ... + R 1 · 2 1 + r 0 (5)

где a i ,

Figure 00000001
- коэффициенты, принимающие значение 0 или 1 в зависимости от значения числа A; where a i ,
Figure 00000001
- coefficients taking the value 0 or 1 depending on the value of the number A ;

n - количество разрядов в представлении множимого; n is the number of bits in the multiplication representation;

b i ,

Figure 00000002
- коэффициенты, принимающие значение 0 или 1 в зависимости от значения числа B; b i ,
Figure 00000002
- coefficients that take the value 0 or 1 depending on the value of the number B ;

p i ,

Figure 00000002
- коэффициенты, принимающие значение 0 или 1 в зависимости от значения модуля P; p i ,
Figure 00000002
- coefficients taking the value 0 or 1 depending on the value of the module P ;

r i ,

Figure 00000002
- коэффициенты, принимающие значение 0 или 1 в зависимости от значения остатка R; r i ,
Figure 00000002
- coefficients taking the value 0 or 1 depending on the value of the remainder R ;

m - количество разрядов в представлении множителя B, модуля P и остатка R. m is the number of bits in the representation of the multiplier B , modulus P and remainder R.

Представим произведение чисел A и B следующим образом:We represent the product of numbers A and B as follows:

A·B = (a n -1 ·2 n -1+ . . . + a 1 ·2+a 0B. (6) A · B = (a n -1 · 2 n -1 +... + A 1 · 2+ a 0) · B. (6)

Перепишем выражение (6) следующим образом:Let's rewrite expression (6) as follows:

A·B = (a n -1 ·2 n -1·B + . . . + a 1 ·B +a 0·B), (7) A · B = (a n -1 · 2 n -1 · B +... + A 1 · 2 · B + a 0 · B), (7)

Тогда произведение (1) чисел A и B по модулю P запишем в видеThen the product (1) of numbers A and B modulo P can be written in the form

(A·B) ≡(a n -1 ·2 n -1·B + . . . + a 1 ·B +a 0·B) (mod P). (8) (A · B) ≡ (a n -1 · 2 n -1 · B +... + A 1 · 2 · B + a 0 · B) (mod P). (eight)

Из теории чисел известно, что операция приведения по модулю инвариантна к сложению и умножению, т. е. величина остатка не зависит от того, вычислен ли он от суммы (произведения) или от каждого слагаемого (сомножителя), а затем соответствующие частичные остатки просуммированы (перемножены) и от результата вычислен остаток по модулю.It is known from number theory that the operation of reduction modulo is invariant to addition and multiplication, i.e., the value of the remainder does not depend on whether it is calculated from the sum (product) or from each term (factor), and then the corresponding partial remainders are summed ( multiplied) and the remainder of the result is calculated modulo.

Исходя из вышесказанного, выражение (8) может быть записано следующим образом.Based on the above, expression (8) can be written as follows.

(A·B) ≡ (a n -1 ·2 n -1·B) mod P +… +(a 1 ·B) mod P +(a 0·B)mod P. (9) (A · B) ≡ (a n -1 · 2 n -1 · B) mod P + ... + (a 1 · 2 · B) mod P + (a 0 · B) mod P. (nine)

Выражение (9) с учетом того, что слагаемое (a 0·B) по определению всегда меньше P и коэффициенты a i ,

Figure 00000001
принимают значения 0 или 1 может быть записано в следующем виде:Expression (9), taking into account that the term ( a 0 B ), by definition, is always less than P and the coefficients a i ,
Figure 00000001
take values 0 or 1 can be written as follows:

(A·B) ≡ a n -1(2 n -1·B) mod P +... +a 1(2·B) mod P +a 0·B. (10)( A B ) ≡ a n -1 (2 n -1 B ) mod P + ... + a 1 (2 B ) mod P + a 0 B. (ten)

Тогда, изменяя в (10) порядок скобок, получим:Then, changing the order of the brackets in (10), we get:

(A·B) ≡ (a n -1(2 n -1·B) mod P +... +(a 1(2·B) mod P +a 0·B)mod P…)mod P(11)( A B ) ≡ ( a n -1 (2 n -1 B ) mod P + ... + ( a 1 (2 B ) mod P + a 0 B ) mod P …) mod P (11 )

В соответствии с (11) вычисление произведения (A·B) по модулю P может быть выполнено за n этапов последовательным умножением коэффициентов a i на величину 2 i ·B, где

Figure 00000001
, приведением этого значения по модулю P и последовательным накапливающим суммированием результатов умножения по модулю P. По определению величина множителя B лежит в диапазоне 0≤BP-1. Величины 2 i ·B могут быть получены последовательным умножением множителя B на 2 и приведением результата умножения по модулю P. Умножение на 2 при двоичном представлении чисел осуществляется сдвигом разрядов кода умножаемого числа на один в сторону старших. Результат умножения может попасть в диапазон [0, P-1], в этом случае приведение по модулю не требуется, или в диапазон [P, 2P-2], в этом случае приведение по модулю P осуществляется путем вычитания из результата умножения модуля P.In accordance with (11), the calculation of the product ( A B ) modulo P can be performed in n stages by sequentially multiplying the coefficients a i by the value 2 i B , where
Figure 00000001
, by converting this value modulo P and successively accumulating the results of the multiplication modulo P. By definition, the value of the multiplier B lies in the range 0 B P -1. The values 2 i · B can be obtained by sequentially multiplying the factor B by 2 and reducing the result of the multiplication modulo P. Multiplication by 2 in the binary representation of numbers is carried out by shifting the code bits of the multiplied number by one towards the higher ones. The multiplication result may lie in the range [0, P -1], in this case the modulo reduction is not required, or in the range [P, P 2 -2], in this case reduction modulo P is carried out by subtracting from the result of multiplying unit P ...

На фиг.1 представлена схема устройства для умножения чисел по произвольному модулю.Figure 1 shows a diagram of a device for multiplying numbers by an arbitrary modulus.

Устройство для умножения чисел по произвольному модулю содержит первый 1, второй 11 и третий 7 регистры, ключ 2, первый 3, второй 9 и третий 8 сумматоры, первый 4 и второй 10 мультиплексоры, элемент ИЛИ 6, блок элементов ИЛИ 5, вход кода множителя 12, вход кода множимого 13, вход инверсного кода модуля 14, вход установки в исходное состояние 15, тактовый вход 16, выход кода произведения 17. Первый регистр 1 является регистром сдвига, а второй 11 и третий 7 регистры являются накопительными. На первые информационные входы первого 3 и второго 9 сумматоров подается инверсный код модуля, а на входы переноса подается сигнал логической единицы. Информационный выход первого 3 сумматора соединен с первым информационным входом первого мультиплексора 4, выход переноса соединен с управляющим входом первого мультиплексора 4. Информационный выход второго сумматора 9 соединен с первым информационным входом второго мультиплексора 10, выход переноса соединен с управляющим входом второго мультиплексора 10. Информационный вход первого регистра 1 является входом кода множимого 13 устройства, вход сигнала параллельной записи является входом установки в исходное состояние 15 устройства, вход сдвига соединен с тактовым входом 16 устройства, информационный выход младшего разряда соединен с управляющим входом ключа 2, информационный выход которого соединен с первым информационным входом третьего сумматора 8, информационный выход которого соединен со вторым информационным входом второго сумматора 9 и вторым информационным входом второго мультиплексора 10, информационный выход которого соединен с информационным входом второго регистра 11, вход записи которого соединен с тактовым входом 16 устройства, а выход является выходом кода произведения 17 устройства и соединен со вторым информационным входом третьего сумматора 8. Вход кодов множителя 12 устройства соединен с первым информационным входом блока элементов ИЛИ 5, второй информационный вход которого соединен с информационным выходом первого мультиплексора 4, а выход соединен с информационным входом третьего регистра 7, вход записи которого соединен с выходом элемента ИЛИ 6, первый вход которого соединен со входом установки в начальное состояние 15 устройства, а второй вход соединен с тактовым входом 16 устройства. Выход третьего регистра 7 соединен информационным входом ключа 2 и со сдвигом на один разряд в сторону старшего со вторыми информационными входами первого сумматора 3 и первого мультиплексора 4. The device for multiplying numbers by an arbitrary modulus contains the first 1, the second 11 and the third 7 registers, the key 2, the first 3, the second 9 and the third 8 adders, the first 4 and the second 10 multiplexers, the OR element 6, the OR element block 5, the multiplier code input 12, multiplicand code input 13, inverse code input of module 14, reset input 15, clock input 16, product code output 17. The first register 1 is a shift register, and the second 11 and third registers 7 are cumulative. The inverse code of the module is supplied to the first information inputs of the first 3 and second 9 adders, and a logical unit signal is supplied to the transfer inputs. The information output of the first 3 adder is connected to the first information input of the first multiplexer 4, the transfer output is connected to the control input of the first multiplexer 4. The information output of the second adder 9 is connected to the first information input of the second multiplexer 10, the transfer output is connected to the control input of the second multiplexer 10. Information input of the first register 1 is the input of the code of the multiplier 13 of the device, the input of the parallel recording signal is the input of setting the device to the initial state 15, the shift input is connected to the clock input 16 of the device, the information output of the least significant bit is connected to the control input of the key 2, the information output of which is connected to the first information the input of the third adder 8, the information output of which is connected to the second information input of the second adder 9 and the second information input of the second multiplexer 10, the information output of which is connected to the information input of the second register 11, the input h The recording of which is connected to the clock input 16 of the device, and the output is the output of the product code 17 of the device and is connected to the second information input of the third adder 8. The input of the multiplier codes 12 of the device is connected to the first information input of the block of elements OR 5, the second information input of which is connected to the information output of the first multiplexer 4, and the output is connected to the information input of the third register 7, the write input of which is connected to the output of the OR element 6, the first input of which is connected to the input of setting to the initial state 15 of the device, and the second input is connected to the clock input 16 of the device. The output of the third register 7 is connected by the information input of the key 2 and with a shift by one bit towards the higher one with the second information inputs of the first adder 3 and the first multiplexer 4.

Устройство для умножения чисел по произвольному модулю работает следующим образом (см. Фиг. 1).The device for multiplying numbers by an arbitrary modulus operates as follows (see Fig. 1).

В начальном состоянии первый 1, второй 11 и третий 7 регистры находятся в нулевом состоянии.In the initial state, the first 1, the second 11 and the third 7 registers are in the zero state.

На вход 12 устройства подается m - разрядный двоичный код множителя B. На вход 13 устройства подается n - разрядный двоичный код множимого A. На вход 14 устройства подается m - разрядный инверсный двоичный код модуля P. An m -bit binary code of the multiplier B is fed to the input 12 of the device. An n -bit binary code of the multiplier A is fed to the input 13 of the device. The input 14 of the device is supplied with an m - bit inverse binary code of the module P.

Для установки устройства в исходное состояние на вход 15 устройства подается сигнал установки в исходное состояние устройства, который, поступая на вход записи первого регистра 1, осуществляет запись кода множимого A со входа 13 устройства в первый регистр 1. Также сигнал установки в исходное состояние устройства, проходя со входа 15 устройства через элемент ИЛИ 6 на вход записи третьего регистра 7, осуществляет запись кода множителя B со входа кода множителя 12 устройства в третий регистр 7. После того, как запись информации в первый регистр 1 и третий регистр 7 осуществлена, на вход 12 устройства подаются нулевые сигналы. To set the device to the initial state, a signal is sent to the device input 15 to initialize the device, which, arriving at the write input of the first register 1, writes the code of the multiplier A from the device input 13 to the first register 1. Also, the device initialization signal, passing from the input 15 of the device through the OR element 6 to the write input of the third register 7, writes the multiplier code B from the input of the multiplier code 12 of the device to the third register 7. After the information is written to the first register 1 and the third register 7, to the input 12 devices give zero signals.

С выхода третьего регистра 7 код множителя B поступает на информационный вход ключа 2, на управляющий вход которого поступает значение младшего разряда a 0 кода множимого A в соответствии с (2). На информационном выходе ключа 2 образуется значение 0, если a 0=0 или значение B, если a 0=1, которое поступает на первый информационный вход третьего сумматора 8, на второй информационный вход которого поступает нулевое значение с выхода второго регистра 11. В результате на информационном выходе третьего сумматора 8 окажется код значения a 0·B, который поступает на вторые информационные входы второго сумматора 9 и второго мультиплексора 10. Так как на первый информационный вход второго сумматора 9 подается инверсный код модуля, а на вход переноса подается логическая единица, то он осуществляет вычитание a 0·B-P. По определению значение a 0·B < P, поэтому сигнал на выходе переноса второго сумматора 9, осуществляющего вычитание a 0·B-P, будет равен нулю и информационный выход второго мультиплексора 10 окажется скоммутированным с его вторым информационным входом. В результате на информационном входе второго регистра 11 окажется значение a 0·B. Одновременно с выхода третьего регистра 7 значение множителя B со сдвигом на один разряд в сторону старших (т.е. 2·B) поступает на вторые информационные входы первого сумматора 3 и первого мультиплексора 4. Первый сумматор 3 осуществляет вычитание 2·B-P, так как на его первый информационный вход подается инверсный код модуля P, а на вход переноса сигнал логической единицы. Если значение 2·B окажется больше или равно P, то на выходе переноса первого сумматора 3 появится сигнал переноса, который скоммутирует первый информационный вход первого мультиплексора 4 с его информационным выходом. Если же значение 2·B окажется меньше модуля P, то сигнал переноса не появится и с информационным выходом первого мультиплексора 4 окажется скоммутирован его второй информационный вход. В результате на информационный вход третьего регистра 7 с информационного выхода первого мультиплексора 4 через блок элементов ИЛИ 5 поступит значение (2·B) mod P.From the output of the third register 7, the multiplier code B is fed to the information input of key 2, the control input of which receives the value of the least significant bit a 0 of the multiplier code A in accordance with (2). At the information output of key 2, the value 0 is formed if a 0 = 0 or the value B , if a 0 = 1, which is fed to the first information input of the third adder 8, the second information input of which receives a zero value from the output of the second register 11. As a result the information output of the third adder 8 will contain the value code a 0 · B , which is fed to the second information inputs of the second adder 9 and the second multiplexer 10. Since the inverse module code is fed to the first information input of the second adder 9, and a logical unit is fed to the transfer input, then he subtracts a 0 · B - P. By definition, the value a 0 · B < P , therefore, the signal at the carry output of the second adder 9, which subtracts a 0 · B - P , will be equal to zero and the information output of the second multiplexer 10 will be connected to its second information input. As a result, the information input of the second register 11 will contain the value a 0 · B. Simultaneously from the output of the third register 7, the value of the multiplier B , shifted by one bit towards the higher ones (i.e., 2 B ), is fed to the second information inputs of the first adder 3 and the first multiplexer 4. The first adder 3 subtracts 2 B - P , since the inverse code of the module P is fed to its first information input, and a logical unit signal is fed to the transfer input. If the value 2 · B turns out to be greater than or equal to P , then a carry signal will appear at the carry output of the first adder 3, which will connect the first information input of the first multiplexer 4 with its information output. If the value 2 · B turns out to be less than the module P , then the carry signal will not appear and its second information input will be connected to the information output of the first multiplexer 4. As a result, the value (2 · B ) mod P will arrive at the information input of the third register 7 from the information output of the first multiplexer 4 through the block of elements OR 5.

Таким образом перед началом вычислений устройство будет установлено в исходное состояние, при этом в первый регистр 1 будет записан код множимого A, а в третий регистр 7 будет записан код множителя B.Thus, before starting the calculations, the device will be set to its initial state, while the code of the multiplier A will be written to the first register 1, and the code of the multiplier B will be written to the third register 7.

Первым тактовым сигналом со входа 16 устройства в третий регистр 7 будет записано значение (2·B) mod P, а во второй регистр 11 будет записано значение a 0·B.The first clock signal from the input 16 of the device will write the value (2 · B ) mod P to the third register 7, and the value a 0 · B will be written to the second register 11.

Вторым тактовым сигналом со входа 16 устройства в третий регистр 7 будет записано значение (22·B) mod P, а во второй регистр 11 будет записано значение (a 1 ·B +a 0·B) (mod P).The second clock signal from the input device 16 in the third register 7 is written to the value (2 2 · B) mod P, and the second register 11 is written to the value (a 1 · 2 · B + a 0 · B) (mod P).

В результате через n-1 тактов, в соответствии с (11), на входе второго регистра 11 получим произведение чисел A и B по модулю P, код которого
n-ым тактовым сигналом будет записан во второй регистр 11 и поступит на выход 17 устройства.
As a result, after n -1 clock cycles, in accordance with (11), at the input of the second register 11, we obtain the product of numbers A and B modulo P , the code of which is
The n- th clock signal will be written to the second register 11 and will be sent to the output 17 of the device.

Рассмотрим работу устройства по модулю на примере.Let's consider the operation of the device modulo using an example.

Пусть множимое A=24310=111100112, множитель B=3110=000111112 модуль P=4110=001010012, разрядность n=8, разрядность m=8.Let the multiplier A = 243 10 = 11110011 2 , the multiplier B = 31 10 = 00011111 2 module P = 41 10 = 00101001 2 , bit width n = 8, bit width m = 8.

В таблице 1 представлены состояния на входах и выходах элементов устройства после установки его в исходное состояние. В таблице 1 и далее приняты следующие обозначения:Table 1 shows the states at the inputs and outputs of the elements of the device after setting it to its initial state. In Table 1 and below, the following designations are adopted:

«инф. вход 1» - информационный вход первого 1, второго 11 и третьего 7 регистров, ключа 2, а также первый информационный вход первого 3, второго 9 и третьего 8 сумматоров, первого 4 и второго 10 мультиплексоров, блока элементов ИЛИ 5;"Inf. input 1 "- information input of the first 1, second 11 and third 7 registers, key 2, as well as the first information input of the first 3, second 9 and third 8 adders, first 4 and second 10 multiplexers, block of elements OR 5;

«инф. вход 2» - второй информационный вход первого 3, второго 9 и третьего 8 сумматоров, первого 4 и второго 10 мультиплексоров, блока элементов ИЛИ 5;"Inf. input 2 "- the second information input of the first 3, second 9 and third 8 adders, first 4 and second 10 multiplexers, block of elements OR 5;

«упр. вход» - управляющий вход ключа 2, первого 4 и второго 10 мультиплексоров, а также вход переноса первого 3 и второго 9 сумматоров;"Exercise. input "- the control input of the key 2, the first 4 and second 10 multiplexers, as well as the transfer input of the first 3 and second 9 adders;

«инф. выход» - информационный выход ключа 2, первого 3, второго 9 и третьего 8 сумматоров, первого 4 и второго 10 мультиплексоров, блока элементов ИЛИ 5, второго 11 и третьего 7 регистров, а также выход младшего разряда первого регистра 1;"Inf. output "- information output of key 2, first 3, second 9 and third 8 adders, first 4 and second 10 multiplexers, block of elements OR 5, second 11 and third 7 registers, as well as the output of the least significant bit of the first register 1;

«выход переноса» - выход переноса первого 3 и второго 9 сумматоров."Carry output" - carry output of the first 3 and second 9 adders.

Таблица 1.Table 1.

инф. вход 1inf. entrance 1 инф. вход 2inf. entrance 2 упр. входex. entrance инф. выходinf. output выход переносаcarry exit Регистр 1Register 1 1111001111110011 -- -- 11 -- Ключ 2Key 2 0001111100011111 -- 11 0001111100011111 -- Сумматор 3Totalizer 3 1101011011010110 0011111000111110 11 0001010100010101 11 Мультиплексор 4Multiplexer 4 0001010100010101 0011111000111110 11 0001010100010101 -- Блок ИЛИ 5OR block 5 0001111100011111 0000000000000000 -- 0001111100011111 -- Регистр 7Register 7 0001010100010101 -- -- 0001111100011111 -- Сумматор 8Totalizer 8 0001111100011111 0000000000000000 -- 0001111100011111 -- Сумматор 9Totalizer 9 1101011011010110 0001111100011111 11 1111011011110110 00 Мультиплексор 10Multiplexer 10 1111011011110110 0001111100011111 00 0001111100011111 -- Регистр 11Register 11 0001111100011111 -- -- 00 --

В таблицах 2 - 8 представлены состояния на входах и выходах элементов устройства на первом - седьмом тактах соответственно.Tables 2 - 8 show the states at the inputs and outputs of the device elements on the first - seventh clock cycles, respectively.

Таблица 2.Table 2.

инф. вход 1inf. entrance 1 инф. вход 2inf. entrance 2 упр. входex. entrance инф. выходinf. output выход переносаcarry exit Регистр 1Register 1 1111001111110011 -- -- 11 -- Ключ 2Key 2 0001010100010101 -- 11 0001010100010101 -- Сумматор 3Totalizer 3 1101011011010110 0010101000101010 11 0000000100000001 11 Мультиплексор 4Multiplexer 4 0000000100000001 0010101000101010 11 0000000100000001 -- Блок ИЛИ 5OR block 5 0000000000000000 0000000100000001 -- 0000000100000001 -- Регистр 7Register 7 0000000100000001 -- -- 0001010100010101 -- Сумматор 8Totalizer 8 0001010100010101 0001111100011111 -- 0011010000110100 -- Сумматор 9Totalizer 9 1101011011010110 0011010000110100 11 0000101100001011 11 Мультиплексор 10Multiplexer 10 0000101100001011 0011010000110100 11 0000101100001011 -- Регистр 11Register 11 0000101100001011 -- -- 0001111100011111 --

Таблица 3.Table 3.

инф. вход 1inf. entrance 1 инф. вход 2inf. entrance 2 упр. входex. entrance инф. выходinf. output выход переносаcarry exit Регистр 1Register 1 1111001111110011 -- -- 00 -- Ключ 2Key 2 0000000100000001 -- 00 00 -- Сумматор 3Totalizer 3 1101011011010110 0000001000000010 11 1101100111011001 00 Мультиплексор 4Multiplexer 4 1101100111011001 0000001000000010 00 0000001000000010 -- Блок ИЛИ 5OR block 5 0000000000000000 0000001000000010 -- 0000001000000010 -- Регистр 7Register 7 0000001000000010 -- -- 0000000100000001 -- Сумматор 8Totalizer 8 0000000000000000 0000101100001011 -- 0000101100001011 -- Сумматор 9Totalizer 9 1101011011010110 0000101100001011 11 1110001011100010 00 Мультиплексор 10Multiplexer 10 1110001011100010 0000101100001011 00 0000101100001011 -- Регистр 11Register 11 0000101100001011 -- -- 0000101100001011 --

Таблица 4.Table 4.

инф. вход 1inf. entrance 1 инф. вход 2inf. entrance 2 упр. входex. entrance инф. выходinf. output выход переносаcarry exit Регистр 1Register 1 1111001111110011 -- -- 00 -- Ключ 2Key 2 0000001000000010 -- 00 00 -- Сумматор 3Totalizer 3 1101011011010110 0000010000000100 11 1101101111011011 00 Мультиплексор 4Multiplexer 4 1101101111011011 0000010000000100 00 0000010000000100 -- Блок ИЛИ 5OR block 5 0000000000000000 0000010000000100 -- 0000010000000100 -- Регистр 7Register 7 0000010000000100 -- -- 0000001000000010 -- Сумматор 8Totalizer 8 0000000000000000 0000101100001011 -- 0000101100001011 -- Сумматор 9Totalizer 9 1101011011010110 0000101100001011 11 1110001011100010 00 Мультиплексор 10Multiplexer 10 1110001011100010 0000101100001011 00 0000101100001011 -- Регистр 11Register 11 0000101100001011 -- -- 0000101100001011 --

Таблица 5.Table 5.

инф. вход 1inf. entrance 1 инф. вход 2inf. entrance 2 упр. входex. entrance инф. выходinf. output выход переносаcarry exit Регистр 1Register 1 1111001111110011 -- -- 11 -- Ключ 2Key 2 0000010000000100 -- 11 0000010000000100 -- Сумматор 3Totalizer 3 1101011011010110 0000100000001000 11 1101111111011111 00 Мультиплексор 4Multiplexer 4 1101111111011111 0000100000001000 00 0000100000001000 -- Блок ИЛИ 5OR block 5 0000000000000000 0000100000001000 -- 0000100000001000 -- Регистр 7Register 7 0000100000001000 -- -- 0000010000000100 -- Сумматор 8Totalizer 8 0000010000000100 0000101100001011 -- 0000111100001111 -- Сумматор 9Totalizer 9 1101011011010110 0000111100001111 11 1110011011100110 00 Мультиплексор 10Multiplexer 10 1110011011100110 0000111100001111 00 0000111100001111 -- Регистр 11Register 11 0000111100001111 -- -- 0000101100001011 --

Таблица 6.Table 6.

инф. вход 1inf. entrance 1 инф. вход 2inf. entrance 2 упр. входex. entrance инф. выходinf. output выход переносаcarry exit Регистр 1Register 1 1111001111110011 -- -- 11 -- Ключ 2Key 2 0000100000001000 -- 11 0000100000001000 -- Сумматор 3Totalizer 3 1101011011010110 0001000000010000 11 1110011111100111 00 Мультиплексор 4Multiplexer 4 1110011111100111 0001000000010000 00 0001000000010000 -- Блок ИЛИ 5OR block 5 0000000000000000 0001000000010000 -- 0001000000010000 -- Регистр 7Register 7 0001000000010000 -- -- 0000100000001000 -- Сумматор 8Totalizer 8 0000100000001000 0000111100001111 -- 0001011100010111 -- Сумматор 9Totalizer 9 1101011011010110 0001011100010111 11 1110111011101110 00 Мультиплексор 10Multiplexer 10 1110111011101110 0001011100010111 00 0001011100010111 -- Регистр 11Register 11 0001011100010111 -- -- 0000111100001111 --

Таблица 7.Table 7.

инф. вход 1inf. entrance 1 инф. вход 2inf. entrance 2 упр. входex. entrance инф. выходinf. output выход переносаcarry exit Регистр 1Register 1 1111001111110011 -- -- 11 -- Ключ 2Key 2 0001000000010000 -- 11 0001000000010000 -- Сумматор 3Totalizer 3 1101011011010110 0010000000100000 11 1111011111110111 00 Мультиплексор 4Multiplexer 4 1111011111110111 0010000000100000 00 0010000000100000 -- Блок ИЛИ 5OR block 5 0000000000000000 0010000000100000 -- 0010000000100000 -- Регистр 7Register 7 0010000000100000 -- -- 0001000000010000 -- Сумматор 8Totalizer 8 0001000000010000 0001011100010111 -- 0010011100100111 -- Сумматор 9Totalizer 9 1101011011010110 0010011100100111 11 1111111011111110 00 Мультиплексор 10Multiplexer 10 1111111011111110 0010011100100111 00 0010011100100111 -- Регистр 11Register 11 0010011100100111 -- -- 0001011100010111 --

Таблица 8.Table 8.

инф. вход 1inf. entrance 1 инф. вход 2inf. entrance 2 упр. входex. entrance инф. выходinf. output выход переносаcarry exit Регистр 1Register 1 1111001111110011 -- -- 11 -- Ключ 2Key 2 0010000000100000 -- 11 0010000000100000 -- Сумматор 3Totalizer 3 1101011011010110 0100000001000000 11 0001011100010111 11 Мультиплексор 4Multiplexer 4 0001011100010111 0100000001000000 11 0001011100010111 -- Блок ИЛИ 5OR block 5 0000000000000000 0001011100010111 -- 0001011100010111 -- Регистр 7Register 7 0001011100010111 -- -- 0010000000100000 -- Сумматор 8Totalizer 8 0010000000100000 0010011100100111 -- 001000111001000111 -- Сумматор 9Totalizer 9 1101011011010110 0100011101000111 11 0001111000011110 11 Мультиплексор 10Multiplexer 10 0001111000011110 0100011101000111 11 0001111000011110 -- Регистр 11Register 11 0001111000011110 -- -- 0010011100100111 --

На седьмом такте на информационном входе регистра 11 окажется код числа 3010=000111102, который восьмым тактовым импульсом запишется во второй регистр 11 и окажется на выходах устройства. Непосредственной проверкой устанавливаем, что (243·31) mod 41 = 30, что подтверждает правильность работы устройства.On the seventh clock cycle at the information input of register 11 there will be a number code 30 10 = 00011110 2 , which by the eighth clock pulse will be written to the second register 11 and will be at the outputs of the device. By direct verification, we establish that (243 · 31) mod 41 = 30, which confirms the correct operation of the device.

Устройство прототип содержит m - ключей, (m-1) - сумматоров, (m-1) - мультиплексоров, m - входовый сумматор по модулю, который в свою очередь может содержать минимум 2m сумматоров и m мультиплексоров. The prototype device contains m - keys, ( m -1) - adders, ( m -1) - multiplexers, m - input adder modulo, which in turn can contain at least 2 m adders and m multiplexers.

Предлагаемое устройство содержит ключ, 3 сумматора, 2 мультиплексора, 3 регистра, элемент ИЛИ и блок элементов ИЛИ. Очевидно, что объем оборудования в предлагаемом устройстве практически в m - раз меньше, чем в устройстве прототипе.The proposed device contains a key, 3 adders, 2 multiplexers, 3 registers, an OR element and a block of OR elements. It is obvious that the amount of equipment in the proposed device is practically m - times less than in the prototype device.

Claims (1)

Устройство для умножения чисел по произвольному модулю, содержащее ключ, три сумматора, два мультиплексора, вход кода множимого, вход кода множителя, выход кода произведения, вход инверсного кода модуля, причем на первый информационный вход первого сумматора со входа инверсного кода модуля подается инверсный код модуля, а на вход переноса первого сумматора подается сигнал логической единицы, информационный выход первого сумматора соединен с первым информационным входом первого мультиплексора, выход переноса первого сумматора соединен с управляющим входом первого мультиплексора, а второй информационный вход первого сумматора соединен со вторым информационным входом первого мультиплексора, на первый информационный вход второго сумматора со входа инверсного кода модуля подается инверсный код модуля, а на вход переноса второго сумматора подается сигнал логической единицы, информационный выход второго сумматора соединен с первым информационным входом второго мультиплексора, выход переноса второго сумматора соединен с управляющим входом второго мультиплексора, отличающееся тем, что в него введены вход установки в исходное состояние, тактовый вход, элемент ИЛИ, три регистра и блок элементов ИЛИ, причем первый регистр является регистром сдвига, а второй и третий регистры являются накопительными, информационный вход первого регистра является входом кода множимого устройства, вход сигнала параллельной записи первого регистра соединен со входом установки в исходное состояние устройства, вход сдвига первого регистра соединен с тактовым входом устройства, информационный выход младшего разряда первого регистра соединен с управляющим входом ключа, информационный выход которого соединен с первым информационным входом третьего сумматора, информационный выход которого соединен со вторым информационным входом второго сумматора и вторым информационным входом второго мультиплексора, информационный выход которого соединен с информационным входом второго регистра, вход записи которого соединен с тактовым входом устройства, а выход второго регистра является выходом кода произведения устройства и соединен со вторым информационным входом третьего сумматора, вход кодов множителя устройства соединен с первым информационным входом блока элементов ИЛИ, второй информационный вход которого соединен с информационным выходом первого мультиплексора, а выход блока элементов ИЛИ соединен с информационным входом третьего регистра, вход записи которого соединен с выходом элемента ИЛИ, а выход третьего регистра соединен информационным входом ключа и со сдвигом на один разряд в сторону старшего со вторыми информационными входами первого сумматора и первого мультиплексора, первый вход элемента ИЛИ соединен со входом установки в исходное состояние устройства, а второй соединен с тактовым входом устройства.A device for multiplying numbers by an arbitrary modulus, containing a key, three adders, two multiplexers, an input of a multiplier code, an input of a multiplier code, an output of a product code, an input of an inverse module code, and the inverse code of a module is fed to the first information input of the first adder from the input of the inverse module code , and a logical unit signal is supplied to the transfer input of the first adder, the information output of the first adder is connected to the first information input of the first multiplexer, the transfer output of the first adder is connected to the control input of the first multiplexer, and the second information input of the first adder is connected to the second information input of the first multiplexer, to the first information input of the second adder from the input of the inverse code of the module is fed with the inverse code of the the second adder is connected to the control input of the second multiplexer, characterized in that the input to the initial state, a clock input, an OR element, three registers and a block of OR elements are introduced into it, the first register being a shift register, and the second and third registers are accumulative, the information input of the first register is the input of the multiplier device code, the input of the parallel recording signal of the first register is connected to the input of the device to the initial state of the device, the shift input of the first register is connected to the clock input of the device, the information output of the least significant bit of the first register is connected to the control input of the key, the information output of which connected to the first information input of the third adder, the information output of which is connected to the second information input of the second adder and the second information input of the second multiplexer, the information output of which is connected to the information input of the second register, the write input of which is is connected to the clock input of the device, and the output of the second register is the output of the product code of the device and is connected to the second information input of the third adder, the input of the device multiplier codes is connected to the first information input of the OR element block, the second information input of which is connected to the information output of the first multiplexer, and the output the block of OR elements is connected to the information input of the third register, the write input of which is connected to the output of the OR element, and the output of the third register is connected to the information input of the key and with a shift by one bit towards the older one with the second information inputs of the first adder and the first multiplexer, the first input of the OR element is connected to the input of the device in the initial state of the device, and the second is connected to the clock input of the device.
RU2020128299A 2020-08-25 2020-08-25 Apparatus for multiplying numbers by an arbitrary modulus RU2755734C1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
RU2020128299A RU2755734C1 (en) 2020-08-25 2020-08-25 Apparatus for multiplying numbers by an arbitrary modulus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
RU2020128299A RU2755734C1 (en) 2020-08-25 2020-08-25 Apparatus for multiplying numbers by an arbitrary modulus

Publications (1)

Publication Number Publication Date
RU2755734C1 true RU2755734C1 (en) 2021-09-20

Family

ID=77745836

Family Applications (1)

Application Number Title Priority Date Filing Date
RU2020128299A RU2755734C1 (en) 2020-08-25 2020-08-25 Apparatus for multiplying numbers by an arbitrary modulus

Country Status (1)

Country Link
RU (1) RU2755734C1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
RU2780400C1 (en) * 2021-10-29 2022-09-22 федеральное государственное автономное образовательное учреждение высшего образования "Северо-Кавказский федеральный университет" Device for calculating the rank of a modular number

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
RU2015537C1 (en) * 1991-10-29 1994-06-30 Вячеслав Иванович Петренко Modulo two multiplier
US20040210614A1 (en) * 2000-12-19 2004-10-21 International Business Machines Corporation Hardware implementation for modular multiplication using a plurality of almost entirely identical processor elements
RU2316042C1 (en) * 2006-08-07 2008-01-27 ГОУ ВПО Ставропольский государственный университет Device for multiplying numbers with arbitrary modulus
US20080109501A1 (en) * 2006-11-06 2008-05-08 Atmel Corporation Modular multiplication method with precomputation using one known operand

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
RU2015537C1 (en) * 1991-10-29 1994-06-30 Вячеслав Иванович Петренко Modulo two multiplier
US20040210614A1 (en) * 2000-12-19 2004-10-21 International Business Machines Corporation Hardware implementation for modular multiplication using a plurality of almost entirely identical processor elements
RU2316042C1 (en) * 2006-08-07 2008-01-27 ГОУ ВПО Ставропольский государственный университет Device for multiplying numbers with arbitrary modulus
US20080109501A1 (en) * 2006-11-06 2008-05-08 Atmel Corporation Modular multiplication method with precomputation using one known operand

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
RU2780400C1 (en) * 2021-10-29 2022-09-22 федеральное государственное автономное образовательное учреждение высшего образования "Северо-Кавказский федеральный университет" Device for calculating the rank of a modular number

Similar Documents

Publication Publication Date Title
Yang et al. A new RSA cryptosystem hardware design based on Montgomery's algorithm
US6026421A (en) Apparatus for multiprecision integer arithmetic
Lee Low complexity bit-parallel systolic multiplier over GF (2m) using irreducible trinomials
Bunimov et al. Area and time efficient modular multiplication of large integers
Chen et al. Scalable and systolic dual basis multiplier over GF (2m)
US3878985A (en) Serial-parallel multiplier using booth{3 s algorithm with combined carry-borrow feature
CN113032723B (en) Matrix multiplier realizing method and matrix multiplier device
Basha et al. Design and Implementation of Radix-4 Based High Speed Multiplier for ALU's Using Minimal Partial Products
RU2755734C1 (en) Apparatus for multiplying numbers by an arbitrary modulus
RU2348965C1 (en) Computing mechanism
Li et al. Case studies of logical computation on stochastic bit streams
RU2661797C1 (en) Computing device
RU2739338C1 (en) Computing device
Krishnamurthy et al. Design of FIR filter using novel pipelined bypass multiplier
RU2642366C1 (en) Adder accumulator
RU2756408C1 (en) Computing apparatus
RU2797164C1 (en) Pipeline module multiplier
RU2791441C1 (en) Modulo accumulator
RU2804380C1 (en) Pipeline calculator
RU2751802C1 (en) Modulo multiplier
RU2799035C1 (en) Conveyor totalizer by modulo
Yang et al. The IC design of a high speed RSA processor
Sanu et al. Parallel montgomery multipliers
RU2798746C1 (en) Computing device
Kim et al. Digit-serial modular multiplication using skew-tolerant domino CMOS