JP4527960B2 - Substitution substitution device, substitution substitution method, substitution substitution program, substitution substitution recording medium - Google Patents

Substitution substitution device, substitution substitution method, substitution substitution program, substitution substitution recording medium Download PDF

Info

Publication number
JP4527960B2
JP4527960B2 JP2003362200A JP2003362200A JP4527960B2 JP 4527960 B2 JP4527960 B2 JP 4527960B2 JP 2003362200 A JP2003362200 A JP 2003362200A JP 2003362200 A JP2003362200 A JP 2003362200A JP 4527960 B2 JP4527960 B2 JP 4527960B2
Authority
JP
Japan
Prior art keywords
substitution
bit string
function
bit
cyclic shift
Prior art date
Legal status (The legal status 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 status listed.)
Expired - Lifetime
Application number
JP2003362200A
Other languages
Japanese (ja)
Other versions
JP2005128166A (en
Inventor
和麻呂 青木
文学 星野
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nippon Telegraph and Telephone Corp
Original Assignee
Nippon Telegraph and Telephone Corp
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 Nippon Telegraph and Telephone Corp filed Critical Nippon Telegraph and Telephone Corp
Priority to JP2003362200A priority Critical patent/JP4527960B2/en
Publication of JP2005128166A publication Critical patent/JP2005128166A/en
Application granted granted Critical
Publication of JP4527960B2 publication Critical patent/JP4527960B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Images

Description

この発明は、主に暗号技術で用いられる換字置換処理に関し、特に、事前計算された値を用いて計算の効率化をはかった換字置換装置、換字置換方法、換字置換プログラム及び換字置換記録媒体に関する。   The present invention relates to substitution substitution processing mainly used in encryption technology, and more particularly to substitution substitution apparatus, substitution substitution method, substitution substitution program, and substitution substitution recording medium for improving calculation efficiency using pre-calculated values. .

データを秘匿するためには暗号化技術が有効である。暗号化の方法は共通鍵暗号と公開鍵暗号がある。共通鍵暗号では、暗号作成側と暗号復号側で同一の鍵を用い、この鍵は秘密に管理されている。一方、公開鍵暗号では暗号文作成のための鍵と暗号文復号の鍵は異なっており、暗号文作成のための鍵を公開しても、復号のための鍵は現実的な時間内に求まらないと広く信じられている。なお、処理速度の観点からは共通鍵暗号の方が有効である。
高速かつ安全な共通鍵暗号を作成するために、暗号化対象のデータを適当な長さのブロックに分割し、そのブロック毎に暗号化する方法をブロック暗号と呼ぶ。この様な暗号方式の代表としてAES暗号があり、その構成は、例えば、非特許文献1に示されている。
An encryption technique is effective for concealing data. Encryption methods include common key encryption and public key encryption. In the common key encryption, the same key is used on the encryption creation side and the encryption / decryption side, and this key is secretly managed. On the other hand, in public key cryptography, the key for ciphertext creation and the key for ciphertext decryption are different. Even if the key for ciphertext creation is disclosed, the key for decryption is found within a realistic time. It is widely believed that it will not be. From the viewpoint of processing speed, the common key encryption is more effective.
In order to create a high-speed and secure common key cipher, a method of dividing data to be encrypted into blocks of an appropriate length and encrypting each block is called block cipher. A representative example of such an encryption method is AES encryption, and its configuration is shown in Non-Patent Document 1, for example.

このAES暗号を含め、多くの共通鍵暗号は換字(substitution)と、置換(permutation)の組み合わせから構成されている。換字置換はかなり広い概念であるが、近年ソフトウェア実装の要請から、

Figure 0004527960
という形の換字置換が多く用いられている。 Many common key ciphers including this AES cipher are composed of a combination of substitution and permutation. Substitution replacement is a fairly broad concept, but in recent years due to the demands of software implementation,
Figure 0004527960
Substitution substitution of the form is often used.

なお、ここでの演算は全て環R上で行う。またs(x)(j=1,2,…,n)は、R→Rの換字関数(S箱:S-box)であり、Pは、

Figure 0004527960
と表される置換行列である。つまり、換字関数による演算を換字と考え、置換行列との積を置換と考える。 All calculations here are performed on the ring R. S j (x) (j = 1, 2,..., N) is an R → R substitution function (S-box), and P is
Figure 0004527960
Is a permutation matrix. That is, an operation based on a substitution function is considered as substitution, and a product with a substitution matrix is considered as substitution.

式(1)に示される換字置換は、非特許文献2で定義されているSHARK暗号でも使われている。さらにこの非特許文献2には、

Figure 0004527960
で示される関数SPの出力値を計算し、その事前計算結果をメモリ等に格納しておくことにより、式(1)を効率的に計算する方法も示されている。 The substitution substitution shown in Expression (1) is also used in the SHARK encryption defined in Non-Patent Document 2. Furthermore, in this non-patent document 2,
Figure 0004527960
Also shown is a method for efficiently calculating the expression (1) by calculating the output value of the function SP j shown in FIG.

また、現実のブロック暗号に用いられている換字置換には、式(1)に示したような一般的に記述される{pij},s(x)ではなく、これらの値が制限された形で構成されているものも多い。例えば、E2暗号(例えば、非特許文献3参照。)や、Camellia暗号(例えば、非特許文献4参照。)では、pij∈{0,1}であり、さらにs(x)の間に簡単な数学的な関係が存在する。実際、Camellia暗号では、R=GF(2),n=m=8であり、

Figure 0004527960
2(x)=s5(x)
3(x)=s6(x) …(5)
4(x)=s7(x)
8(x)=s1(x)
となっている。 In addition, substitution values used in actual block ciphers are not limited to {p ij }, s j (x), which are generally described as shown in Equation (1), but these values are limited. Many of them are made up of shapes. For example, in E2 encryption (for example, see Non-Patent Document 3) and Camellia encryption (for example, see Non-Patent Document 4), p ij ε {0,1}, and between s j (x) There is a simple mathematical relationship. In fact, in Camellia encryption, R = GF (2 8 ), n = m = 8,
Figure 0004527960
s 2 (x) = s 5 (x)
s 3 (x) = s 6 (x) (5)
s 4 (x) = s 7 (x)
s 8 (x) = s 1 (x)
It has become.

非特許文献4では、このような特殊な性質を持つCamellia暗号について、式(3)に示した一般的な方法よりも効率良く式(1)を計算する方法が紹介されている。以下、64ビットプロセッサを用い、この非特許文献4の方法を実現する場合について説明する。
この方法では、j=1,2,3,4、x=(00000000)〜(11111111)についてs(x)の出力値を事前計算しておき、その演算結果sを8要素分配列した8KB(=8バイト(64ビット)×256×4)のビット列(表)
SP=(s,s,s,s,s,s,s,s)…(6)
をメモリに格納しておく。そして、換字置換処理の際、この式(6)の表を参照し、入力データ列(x,x,…,x)に対応するSPの値を式(5)に適用し、さらに式(2)及び行列(4)を適用することにより、この入力データ列(x,x,…,x)の換字置換結果(y,y,…,y)を算出する。以下に、この演算に必要な処理回数及び表の大きさを示す。
表参照回数 8
排他的論理和回数 7
論理積回数 8
表の大きさ(KB) 8
Non-Patent Document 4 introduces a method of calculating Equation (1) more efficiently than the general method shown in Equation (3) for Camellia encryption having such special properties. Hereinafter, the case where the method of this nonpatent literature 4 is implement | achieved using a 64-bit processor is demonstrated.
In this method, the output value of s j (x) is pre-calculated for j = 1, 2, 3, 4 and x = (00000000) 2 to (11111111) 2 , and the operation result s j is divided into eight elements. Arranged 8KB (= 8 bytes (64 bits) × 256 × 4) bit string (table)
SPj = ( sj , sj , sj , sj , sj , sj , sj , sj ) (6)
Is stored in memory. Then, in the substitution processing, the table of the equation (6) is referred to, and the value of SP j corresponding to the input data string (x 1 , x 2 ,..., X 8 ) is applied to the equation (5). further by applying equation (2) and matrix (4), the input data sequence (x 1, x 2, ... , x 8) the substitution substitution results (y 1, y 2, ... , y 8) calculated To do. The number of processes required for this calculation and the size of the table are shown below.
Table reference count 8
Exclusive OR number 7
Number of logical products 8
Table size (KB) 8

次に、32ビットプロセッサを用い、この非特許文献4の方法を実現する場合について説明する。
この場合、j=1,2,3,4、x=(00000000)〜(11111111)についてs(x)の出力値を事前計算しておき、その演算結果sを以下のように配置した4KB(=4バイト(32ビット)×256×4)の表をメモリに格納しておく。
Next, the case where the method of this nonpatent literature 4 is implement | achieved using a 32-bit processor is demonstrated.
In this case, the output value of s j (x) is pre-calculated for j = 1, 2, 3, 4 and x = (00000000) 2 to (11111111) 2 , and the operation result s j is expressed as follows: The arranged 4 KB (= 4 bytes (32 bits) × 256 × 4) table is stored in the memory.

SP1110=(s,s,s,0)
SP0222=(0,s,s,s) …(7)
SP3033=(s,0,s,s
SP4404=(s,s,0,s
そして、換字置換処理の際、この式(7)の表を参照して非特許文献5に示された

Figure 0004527960
を計算し、入力データ列(x,x,…,x)の換字置換結果(y,y,…,y)を算出する。なお、SP1110(x)は、(s(x),s(x),s(x),0)を示し、その演算値は、事前計算された式(7)の表から抽出されるものである。その他のSP0222(x)等についても同様である。また、「≫」は、GF(2)をGF(2)と同一視した場合における8ビット右循環シフトを表す。 SP 1110 = (s 1 , s 1 , s 1 , 0)
SP 0222 = (0, s 2 , s 2 , s 2 ) (7)
SP 3033 = (s 3 , 0, s 3 , s 3 )
SP 4404 = (s 4 , s 4 , 0, s 4 )
And in the substitution processing, it was shown in the nonpatent literature 5 with reference to the table | surface of this Formula (7).
Figure 0004527960
Was calculated, the input data sequence (x 1, x 2, ... , x 8) the substitution substitution results (y 1, y 2, ... , y 8) is calculated. Note that SP 1110 (x 8 ) indicates (s 1 (x 8 ), s 1 (x 8 ), s 1 (x 8 ), 0), and the calculated value thereof is calculated in advance using Equation (7) It is extracted from the table. The same applies to the other SP 0222 (x 5 ) and the like. “>> 8 ” represents an 8-bit right circular shift when GF (2 8 ) is identified with GF (2) 8 .

以下に、この式(8)の演算に必要な処理回数及び表の大きさを示す。
表参照回数 8
排他的論理和回数 8
32ビットデータ循環シフト回数 1
表の大きさ(KB) 4
Specification for the ADVANCED ENCRYPTION STANDARD(AES),Federal Information Processing Standards Publication 197 V. Rijmen, et al. : ”The Cipher SHARK,” Fast Software Encryption-Third International Workshop, Lecture Notes in Computer Science 1039, pp. 99-111, Springer-Verlag, 1996 M. Kanda, et al: ”E2-A New 128-Bit Block Cipher,” IEICE Transactions on Fundamentals, Vol. E83-A, No. 1, pp. 48-59, 2000 K. Aoki, et al: ”The 128-Bit Block Cipher Camellia,” IEICE Transactions on Fundamentals, Vol. E85-A, No. 1, pp. 11-24, 2002 青木和麻呂,他6名,「128ビットブロック暗号Camelliaの実装評価」、電子情報通信学会技術研究報告,電子情報通信学会,2000年9月29日,ISEC2000‐73,p.131〜138
In the following, the number of processes and the size of the table necessary for the calculation of equation (8) are shown.
Table reference count 8
Exclusive OR number 8
32-bit data cyclic shift count 1
Table size (KB) 4
Specification for the ADVANCED ENCRYPTION STANDARD (AES), Federal Information Processing Standards Publication 197 V. Rijmen, et al .: “The Cipher SHARK,” Fast Software Encryption-Third International Workshop, Lecture Notes in Computer Science 1039, pp. 99-111, Springer-Verlag, 1996 M. Kanda, et al: “E2-A New 128-Bit Block Cipher,” IEICE Transactions on Fundamentals, Vol. E83-A, No. 1, pp. 48-59, 2000 K. Aoki, et al: “The 128-Bit Block Cipher Camellia,” IEICE Transactions on Fundamentals, Vol. E85-A, No. 1, pp. 11-24, 2002 Kazuma Aoki, 6 others, "Implementation evaluation of 128-bit block cipher Camellia", IEICE Technical Report, IEICE, September 29, 2000, ISEC 2000-73, p. 131-138

しかし、非特許文献5に示す方法は、メモリに格納すべき表のサイズが大きく、十分なメモリ容量を確保できない場合には適用できないという問題点がある。
本発明はこのような点に鑑みてなされたものであり、十分なメモリ容量を確保できない場合でも、効率良く換字置換演算を行うことが可能な換字置換装置を提供することを目的とする。
また、本発明の他の目的は、十分なメモリ容量を確保できない場合でも、効率良く換字置換演算を行うことが可能な換字置換方法を提供することである。
However, the method shown in Non-Patent Document 5 has a problem that it cannot be applied when the size of the table to be stored in the memory is large and sufficient memory capacity cannot be secured.
The present invention has been made in view of these points, and an object of the present invention is to provide a substitution device that can perform substitution substitution efficiently even when a sufficient memory capacity cannot be secured.
Another object of the present invention is to provide a substitution method capable of performing substitution substitution efficiently even when a sufficient memory capacity cannot be secured.

さらに、本発明の他の目的は、十分なメモリ容量を確保できない場合でも、効率良く換字置換演算を行うことが可能な機能をコンピュータに実行させるための換字置換プログラムを提供することである。
また、本発明の他の目的は、十分なメモリ容量を確保できない場合でも、効率良く換字置換演算を行うことが可能な機能をコンピュータに実行させるための換字置換プログラムを格納した換字置換記録媒体を提供することである。
Furthermore, another object of the present invention is to provide a substitution program for causing a computer to execute a function capable of efficiently performing substitution substitution even when a sufficient memory capacity cannot be secured.
Another object of the present invention is to provide a substitution-replacement recording medium storing a substitution-replacement program for causing a computer to execute a function capable of performing substitution substitution efficiently even when a sufficient memory capacity cannot be secured. Is to provide.

この発明では上記課題を解決するために、メモリにビット列SPを格納しておく。ここで、ビット列SPは、循環シフトによって何れかの換字関数s(x)と同値となる関数s(x)を複数個配列した関数SP(x)に、xの取り得る値を代入したものである。そして、換字置換処理の際、メモリからこのビット列SPを抽出し、抽出したビット列全体を循環シフトし、何れかの換字関数s(x)に入力データxを代入した結果s(x)を複数個配列したビット列SP(x)を算出する。
算出されたビット列SP(x)は、例えば、非特許文献4の方法に適用され、これにより、入力データ列(x,x,…,x)から、その換字置換結果であるデータ列(y,y,…,y)が求められる。
In the present invention, in order to solve the above problem, the bit string SP is stored in the memory. Here, the bit string SP is obtained by substituting a possible value of x into a function SP (x) in which a plurality of functions s (x) having the same value as any substitution function s j (x) is arranged by a cyclic shift. It is. Then, in the substitution processing, this bit string SP is extracted from the memory, the entire extracted bit string is cyclically shifted, and the result of substituting the input data x j for any substitution function s j (x) is s j (x j ) Are arranged, a bit string SP j (x j ) is calculated.
The calculated bit string SP j (x j ) is applied to, for example, the method of Non-Patent Document 4, and is thus a substitution substitution result from the input data string (x 1 , x 2 ,..., X n ). A data string (y 1 , y 2 ,..., Y m ) is obtained.

ここで、抽出したビット列を循環シフトして換字置換演算に必要なビット列SPを算出することができるため、メモリに格納すべきビット列SPの数を低減させることができる。
また、この関数s(x)は、それ自体の循環シフトによって何れかの換字関数s(x)と同値となる(s(x)=s(x)≪)。この場合、関数s(x)を複数個配列したビット列SP=(s(x), s(x),…,s(x))全体を、同ビット、同方向に循環シフトした結果は、この換字関数s(x)を同数個配列したビット列SP=(s(x), s(x),…,s(x))と同値となるという性質がある((s(x), s(x),…,s(x))=(s(x), s(x),…,s(x))≪)。そのため、換字置換演算に必要なビット列SPを算出する際、関数s(x)から換字関数s(x)を算出し、算出した換字関数s(x)を複数個配列してビット列SPを生成するといった煩雑な処理を行うことなく、単に、ビット列SP全体を循環シフトするのみでビット列SPを生成することができる。
Here, since the extracted bit string can be cyclically shifted to calculate the bit string SP j necessary for the substitution substitution operation, the number of bit strings SP j to be stored in the memory can be reduced.
The function s (x) is equivalent to any substitution function s j (x) by its own cyclic shift (s j (x) = s (x) << r ). In this case, the result of cyclically shifting the entire bit string SP = (s (x), s (x),..., S (x)) in which a plurality of functions s (x) are arranged in the same bit and in the same direction is The bit string SP j = (s j (x), s j (x),..., S j (x)) in which the same number of substitution functions s j (x) are arranged has the property of being equivalent ((s j ( x), s j (x),..., s j (x)) = (s (x), s (x),..., s (x)) << r ). Therefore, when the bit string SP j necessary for the substitution substitution operation is calculated, the substitution function s j (x) is calculated from the function s (x), and a plurality of the substitution functions s j (x) calculated are arranged to form the bit string SP. The bit string SP j can be generated simply by cyclically shifting the entire bit string SP without performing complicated processing such as generating j .

なお、「≪」はrビットの左循環シフトを表し、「≫」はrビットの右循環シフトを表す。ここではGF(2α)をGF(2)αと同一視している。 Note that “<< r ” represents an r-bit left cyclic shift, and “>> r ” represents an r-bit right cyclic shift. Here, GF ( ) is identified with GF (2) α .

上述のように、本発明では、メモリに格納すべきビット列SPの数を低減させることができるため、十分なメモリ容量を確保できない場合でも、非特許文献4の方法等を用いて効率良く換字置換演算を行うことができる。
また、単に、ビット列SP全体を循環シフトするのみでビット列SPを生成できるため、ビット列SPの生成に必要な論理演算数も少なく、効率的な換字置換演算を実現できる。
As described above, according to the present invention, the number of bit strings SP j to be stored in the memory can be reduced. Therefore, even when a sufficient memory capacity cannot be secured, the substitution method can be efficiently performed using the method of Non-Patent Document 4. A replacement operation can be performed.
Also, merely for the entire bit string SP can generate a bit string SP j only cyclic shift, logical operands also less required to generate a bit string SP j, can realize efficient substitution substitution operation.

以下、この発明の実施の形態を図面を参照して説明する。
〔第1の実施の形態〕
まず、本発明の第1の実施の形態について説明する。
本形態は、64ビットプロセッサにおいて行われるCamellia暗号の換字置換処理に本発明を適用する例である。
図1は、本形態における換字置換装置10の機能構成を例示した図、図2は、ビット列格納部11に格納される表20のデータ構成を例示した図、図3は、換字置換装置10のハードウェア構成を例示した図である。また、図4は、本形態における換字置換方法を説明するためのフローチャートである。以下、これらの図を用いて、この例の換字置換装置10の構成及び処理手順について説明する。
Embodiments of the present invention will be described below with reference to the drawings.
[First Embodiment]
First, a first embodiment of the present invention will be described.
This embodiment is an example in which the present invention is applied to a substitution substitution process of Camellia encryption performed in a 64-bit processor.
FIG. 1 is a diagram illustrating a functional configuration of the substitution device 10 according to the present embodiment, FIG. 2 is a diagram illustrating a data configuration of a table 20 stored in the bit string storage unit 11, and FIG. It is the figure which illustrated hardware constitutions. FIG. 4 is a flowchart for explaining the substitution substitution method in this embodiment. Hereinafter, the configuration and processing procedure of the substitution device 10 of this example will be described with reference to these drawings.

<ハードウェア構成>
図3に例示するように、この例の換字置換装置10は、64ビットのCPU(Central Processing Unit)10a、ROM(Read Only Memory)10b、RAM(Random Access Memory)10c、換字置換プログラムを格納したRAM等のプログラムメモリ10d、インタフェースである入力部10e及び出力部10fを有しており、バス10gにおいて相互に通信可能なように接続されている。そして、CPU10aは、プログラムメモリ10dに格納された換字置換プログラムを読み出し、それに従った処理を実行することによって、以下に示す各処理機能を実現する。
<Hardware configuration>
As illustrated in FIG. 3, the substitution device 10 of this example stores a 64-bit CPU (Central Processing Unit) 10a, a ROM (Read Only Memory) 10b, a RAM (Random Access Memory) 10c, and a substitution substitution program. A program memory 10d such as a RAM, an input unit 10e as an interface, and an output unit 10f are connected to each other via a bus 10g so as to communicate with each other. Then, the CPU 10a reads the substitution replacement program stored in the program memory 10d and executes the processing according to the program, thereby realizing each processing function shown below.

<前提>
換字置換装置10は、環R上の換字置換

Figure 0004527960
によって、入力データ列(x,x,…,x)からデータ列(y,y,…,y)を求める装置である。なお、pij(i=1,2,…,m、j=1,2,…,n)は、R上の置換行列Pのi行j列要素を示し、s(x)は、R→Rの換字関数(S箱:S-box)を示す。
ここではCamellia暗号の換字置換処理を例にとるため、R=GF(2)、n=m=8であり、置換行列は、
Figure 0004527960
である。
また、Camellia暗号の場合、換字関数間には、
2(x)=s5(x)=s1(x)≪
3(x)=s6(x)=s1(x)≫ …(10)
4(x)=s7(x)=s1(x≪
8(x)=s1(x)
の関係がある。 <Premise>
The substitution device 10 is a substitution substitution on the ring R.
Figure 0004527960
Is a device for obtaining a data string (y 1 , y 2 ,..., Y m ) from an input data string (x 1 , x 2 ,..., X n ). Note that p ij (i = 1, 2,..., M, j = 1, 2,..., N) indicates i row and j column elements of the permutation matrix P on R, and s j (x) is R → Indicates the R substitution function (S-box).
Here, since substitution substitution processing of Camellia encryption is taken as an example, R = GF (2 8 ), n = m = 8, and the substitution matrix is
Figure 0004527960
It is.
In the case of Camellia encryption, between substitution functions,
s 2 (x) = s 5 (x) = s 1 (x) << 1
s 3 (x) = s 6 (x) = s 1 (x) >> 1 (10)
s 4 (x) = s 7 (x) = s 1 (x << 1 )
s 8 (x) = s 1 (x)
There is a relationship.

<前処理>
まず、前処理として、事前計算したビット列SPをビット列格納部11に格納する。ここで、ビット列SPは、循環シフトによって何れかの換字関数s(x)と同値となる関数をs(x)とし、この関数s(x)を複数個配列した関数をSP(x)とし、この関数SP(x)にxの取り得る値を代入したビット列である。この例では、換字関数s(x)を関数s(x)とする。
また、図2に例示するように、この例では、この関数s(x)を8要素配列した関数をSP(x)(=(s(x),s(x),s(x),s(x),s(x),s(x),s(x),s(x)))としている。そして、この関数SP(x)にx=(00000000),(00000001),…,(11111111)をそれぞれ代入した256要素のビット列22
SP((00000000)2)=(s((00000000)2),…,s((00000000)2))
SP((00000001)2)=(s((00000001)2),…,s((00000001)2))

SP((11111111)2)=(s((11111111)2),…,s((11111111)2))
をSPとし、表20を構成している。
<Pretreatment>
First, as preprocessing, the pre-calculated bit string SP is stored in the bit string storage unit 11. Here, in the bit string SP, a function that is equivalent to any substitution function s j (x) by a cyclic shift is defined as s (x), and a function in which a plurality of the functions s (x) are arranged is defined as SP (x). , A bit string obtained by substituting a possible value of x into the function SP (x). In this example, the substitution function s 1 (x) is assumed to be a function s (x).
Further, as illustrated in FIG. 2, in this example, a function in which the function s (x) is arranged in eight elements is expressed as SP (x) (= (s (x), s (x), s (x), s (X), s (x), s (x), s (x), s (x))). Then, a 256-element bit string 22 obtained by substituting x = (00000000) 2 , (00000001) 2 ,..., (11111111) 2 for the function SP (x), respectively.
SP ((00000000) 2 ) = (s ((00000000) 2 ),…, s ((00000000) 2 ))
SP ((00000001) 2 ) = (s ((00000001) 2 ),…, s ((00000001) 2 ))
...
SP ((11111111) 2 ) = (s ((11111111) 2 ), ..., s ((11111111) 2 ))
Table 20 is constituted by SP.

また、これらの各ビット列SP((00000000)),SP((00000001)),…,SP((11111111))は、各代入値x=(00000000),(00000001),…,(11111111)とそれぞれ対応付けられている。この例の場合、各代入値xに対応するビット列格納部11のアドレス21(H(x))に、xの代入結果である各ビット列SP((00000000)),SP((00000001)),…,SP((11111111))を格納することにより、この対応付けを行っている。 In addition, each of these bit strings SP ((00000000) 2 ), SP ((00000001) 2 ),..., SP ((11111111) 2 ) has an assigned value x = (00000000) 2 , (00000001) 2 ,. (11111111) 2 is associated with each. In this example, each bit string SP ((00000000) 2 ), SP ((00000001) 2 ) that is the result of substitution of x is stored in the address 21 (H (x)) of the bit string storage unit 11 corresponding to each substitution value x. ,..., SP ((11111111) 2 ) is stored to perform this association.

なお、s(x)の代入結果は8ビットであるため、それが8要素配列されたSP(x)の各代入結果は64(8×8)ビット=8バイトとなる。また、表20は、このSP(x)への代入結果が256要素集合したものである。よって、この表20の大きさ(データサイズ)は2KB(=8バイト×256)である。
また、置換行列格納部16には、置換行列

Figure 0004527960
が格納される。この例では式(9)に示す置換行列Pを格納しておく。 Since the substitution result of s (x) is 8 bits, each substitution result of SP (x) in which 8 elements are arranged is 64 (8 × 8) bits = 8 bytes. Table 20 is a set of 256 elements of the assignment result to SP (x). Therefore, the size (data size) of Table 20 is 2 KB (= 8 bytes × 256).
Also, the permutation matrix storage unit 16 has a permutation matrix
Figure 0004527960
Is stored. In this example, a permutation matrix P shown in Expression (9) is stored.

<換字置換処理>
本形態において換字置換処理を行う場合、まずデータ列入力部12において、換字置換処理の対象となる入力データ列(x,x,…,x)の入力を受け付ける(ステップS1)。入力されたデータx,xは8ビット循環シフト部13へ送られ、その他のデータ列(x,x,x,x,x,x)はビット列抽出部14に送られる。
<Substitution replacement processing>
When performing substitution substitution processing in this embodiment, first, the data string input unit 12 accepts input of an input data string (x 1 , x 2 ,..., X 8 ) that is the subject of substitution substitution processing (step S1). The input data x 4 and x 7 are sent to the 8-bit cyclic shift unit 13, and the other data sequences (x 1 , x 2 , x 3 , x 5 , x 6 , x 8 ) are sent to the bit sequence extraction unit 14. It is done.

8ビット循環シフト部13は、送られた8ビットのデータx,xに対し、それぞれ1ビットの左循環シフト(x,x)を行う(ステップS2)。つまり、例えばxの各ビットがabcdefjhである場合、このビット列がbcdefjhaとなるように、各ビットを左に1ビット循環させる。そして、これらの1ビットの左循環シフト結果(x,x)はビット列抽出部14に送られる。
ビット列抽出部14は、ビット列格納部11を参照し、送られたデータ列(x,x,x,x,x,x)及び左循環シフト結果(x,x)に対応付けられているアドレス21に格納されたビット列SP(x),SP(x),SP(x),SP(x),SP(x),SP(x)及びSP(x),SP(x)を抽出する(ステップS3)。
The 8-bit cyclic shift unit 13 performs a 1-bit left cyclic shift (x 4 << 1 , x 7 << 1 ) on the transmitted 8-bit data x 4 and x 7 (step S2). That is, for example, when each bit of x 4 is Abcdefjh, the bit string so that the Bcdefjha, to 1-bit rotation each bit to the left. These 1-bit left circular shift results (x 4 << 1 , x 7 << 1 ) are sent to the bit string extraction unit 14.
The bit string extraction unit 14 refers to the bit string storage unit 11 and sends the data string (x 1 , x 2 , x 3 , x 5 , x 6 , x 8 ) and the left circular shift result (x 4 << 1 , x 7 << 1 ) The bit string SP (x 1 ), SP (x 2 ), SP (x 3 ), SP (x 5 ), SP (x 6 ), SP (x 8 ), SP (x 4 << 1 ), and SP (x 7 << 1 ) are extracted (step S3).

ここでビット列抽出部14で抽出されたSP(x)はSP(x)として、SP(x)はSP(x)として、SP(x)はSP(x)として、SP(x)はSP(x)として、それぞれ論理積演算部17に送られる。なお、SP(α)は、換字関数s(x)にデータαを代入した結果s(α)を8個配列したビット列(s(α),s(α),s(α),s(α),s(α),s(α),s(α),s(α))を示す。また、上述のような置き換え(SP(x)←SP(x)、SP(x)←SP(x)等)ができるのは、この例では、換字関数s(x)を関数s(x)としており、さらに式(10)の関係が成立していることに基づく。 Here, SP (x 1 ) extracted by the bit string extraction unit 14 is SP 1 (x 1 ), SP (x 8 ) is SP 8 (x 8 ), and SP (x 4 << 1 ) is SP 4 (x 4 ), SP (x 7 << 1 ) is sent to the AND unit 17 as SP 7 (x 7 ). SP j (α) is a bit string (s j (α), s j (α), s j () obtained by arranging eight s j (α) as a result of substituting data α for the substitution function s j (x). α), s j (α), s j (α), s j (α), s j (α), s j (α)). Further, the replacement (SP 1 (x 1 ) ← SP (x 1 ), SP 8 (x 8 ) ← SP (x 8 ), etc.) as described above can be performed in this example as a substitution function s 1 (x ) Is a function s (x), and is based on the fact that the relationship of Expression (10) is established.

また、ビット列抽出部14で抽出されたその他のSP(x),SP(x),SP(x),SP(x)は、それぞれ64ビット循環シフト部15に送られる。
64ビット循環シフト部15(「循環シフト手段」に相当)は、送られたビット列SP(x)全体を左に1ビットだけ循環シフトし(SP(x)≪)、換字関数s(x)に入力データxを代入した結果s(x)を8個配列したビット列SP(x)を算出する。ここで、ビット列SP(x)全体を左に1ビットだけ循環シフトするとビット列SP(x)となる理由を説明する。
The other SP (x 2 ), SP (x 3 ), SP (x 5 ), and SP (x 6 ) extracted by the bit string extraction unit 14 are sent to the 64-bit cyclic shift unit 15.
The 64-bit cyclic shift unit 15 (corresponding to “circular shift means”) cyclically shifts the entire transmitted bit string SP (x 2 ) by 1 bit to the left (SP (x 2 ) << 1 ), and the substitution function s 2 A bit string SP 2 (x 2 ) in which eight results s 2 (x 2 ) are arranged as a result of substituting the input data x 2 into (x) is calculated. Here, the reason why the entire bit string SP (x 2 ) is cyclically shifted to the left by 1 bit to form the bit string SP 2 (x 2 ) will be described.

例えばs(x)の各ビットがabcdefjhである場合、SP(x)は(abcdefjhabcdefjh…abcdefjh)となり、SP(x)全体を左に1ビットだけ循環シフト(SP(x)≪)した結果は、
(bcdefjhabcdefjh…abcdefjha)…(11)
となる。
また、前述のように、この例ではs(x)=s(x)としており、さらに式(10)より、s2(x)=s1(x)≪=s(x)≪が成立する。そのため、s2(x)は、s(x)を左に1ビットだけ循環シフトした結果(s(x)≪)と同じbcdefjhaとなる。そして、s2(x)を8個配列したビット列SP(x)は、(bcdefjhabcdefjh…abcdefjha)となり、上述の(11)と等しくなる。これは、ビット列SP(x)全体を左に1ビットだけ循環シフトした結果(SP(x)≪)が、s(x)を8個配列したビット列SP(x)と等しくなることを意味している。
For example, when each bit of s (x 2 ) is abcdefjh, SP (x 2 ) becomes (abcdefjhabcdefjh... Abcdefjh), and the entire SP (x 2 ) is cyclically shifted by 1 bit to the left (SP (x 2 ) << 1 )
(Bcdefjhabcdefjh ... abcdefjha) (11)
It becomes.
Further, as described above, in this example, s (x) = s 1 (x) is set, and further, s 2 (x 2 ) = s 1 (x 2 ) << 1 = s (x 2 ) from Expression (10). ) << 1 is established. Therefore, s 2 (x 2 ) is bcdefjha which is the same as the result (s (x 2 ) << 1 ) obtained by cyclically shifting s (x 2 ) by 1 bit to the left. Then, s 2 (x 2) bit string SP 2 was eight sequences (x 2) is equal to the (bcdefjhabcdefjh ... abcdefjha), and the above (11). This bit string SP (x 2) by one bit the whole left circular shift result (SP (x 2) «1 ) is, s 2 (x 2) eight sequence bit string SP 2 and (x 2) It means to be equal.

同様に、64ビット循環シフト部15は、送られたビット列SP(x)全体を左に1ビットだけ循環シフトし(SP(x)≪)、またSP(x)全体及びSP(x)全体をそれぞれ右に1ビットだけ循環シフトし(SP(x)≫, SP(x)≫)、ビット列SP(x), SP(x), SP(x)を算出する(ステップS4)。そして、64ビット循環シフト部15で算出されたビット列SP(x),SP(x),SP(x),SP(x)は論理積演算部17に送られる。 Similarly, the 64-bit cyclic shift unit 15 cyclically shifts the entire transmitted bit string SP (x 5 ) by 1 bit to the left (SP (x 5 ) << 1 ), and the entire SP (x 3 ) and SP ( x 6 ) is cyclically shifted by 1 bit to the right respectively (SP (x 3 ) >> 1 , SP (x 6 ) >> 1 ), and bit strings SP 5 (x 5 ), SP 3 (x 3 ), SP 6 ( x 6 ) is calculated (step S4). Then, the bit strings SP 2 (x 2 ), SP 3 (x 3 ), SP 5 (x 5 ), SP 6 (x 6 ) calculated by the 64-bit cyclic shift unit 15 are sent to the AND operation unit 17.

論理積演算部17は、送られたSP(x)に対し、置換行列格納部16から、置換行列Pのj列要素

Figure 0004527960
を算出する(ステップS5)。算出された論理積SP(x)・P(j=1,2,…,8)は、排他的論理和演算部18に送られ、そこで、これらの論理積SP(x)・Pの排他的論理和
Figure 0004527960
が求められ(ステップS6)、その演算結果のデータ列(y,y,…,y)が換字置換結果として出力される(ステップS7)。 The AND operation unit 17 performs the j column element of the permutation matrix P from the permutation matrix storage unit 16 for the sent SP j (x j ).
Figure 0004527960
Is calculated (step S5). The calculated logical product SP j (x j ) · P j (j = 1, 2,..., 8) is sent to the exclusive OR operation unit 18, where these logical products SP j (x j )・ Exclusive OR of P j
Figure 0004527960
Is obtained (step S6), and a data string (y 1 , y 2 ,..., Y 8 ) of the operation result is output as a substitution substitution result (step S7).

<計算コスト・表の大きさ>
以上説明したように、本形態では、ステップS2において、8ビットデータの循環シフトを2回行い、ステップS3において、ビット列格納部11の表20を8回参照している。また、ステップS4において、64ビットデータの循環シフトを4回行い、ステップS5において、論理積SP(x)・P(j=1,2,…,8)を8回行い、ステップS6において、排他的論理和を7回行っている。また、前述のように表20の大きさは2KBである。
<Calculation cost / table size>
As described above, in this embodiment, the cyclic shift of the 8-bit data is performed twice in step S2, and the table 20 of the bit string storage unit 11 is referred to eight times in step S3. In step S4, 64-bit data is cyclically shifted four times. In step S5, the logical product SPj ( xj ) .Pj (j = 1, 2,..., 8) is performed eight times. The exclusive OR is performed 7 times. As described above, the size of Table 20 is 2 KB.

表参照回数 8
排他的論理和回数 7
64ビットデータ循環シフト回数 4
8ビットデータ循環シフト回数 2
論理積回数 8
表の大きさ(KB) 2
このように、本形態では、計算コストをさほど増加させることなく、表の大きさを従来の4分の1にすることができた。
Table reference count 8
Exclusive OR number 7
64-bit data cyclic shift count 4
8-bit data cyclic shift count 2
Number of logical products 8
Table size (KB) 2
Thus, in this embodiment, the size of the table could be reduced to a quarter of the conventional size without increasing the calculation cost so much.

〔第2の実施の形態〕
次に、本発明の第2の実施の形態について説明する。
本形態は、32ビットプロセッサにおいて行われるCamellia暗号の換字置換処理に本発明を適用する例である。
図5は、本形態における換字置換装置100の機能構成を例示した図、図6は、ビット列格納部111に格納される表130のデータ構成を例示した図、図7は、本形態における換字置換方法を説明するためのフローチャートである。以下、これらの図を用いて、この例の換字置換装置100の構成及び処理手順について説明する。なお、以下では第1の実施の形態との相違点を中心に説明を行い、第1の実施の形態と共通する事項については説明を省略する。
[Second Embodiment]
Next, a second embodiment of the present invention will be described.
This embodiment is an example in which the present invention is applied to a substitution substitution process of Camellia encryption performed in a 32-bit processor.
5 is a diagram illustrating a functional configuration of the substitution device 100 according to the present embodiment, FIG. 6 is a diagram illustrating a data configuration of the table 130 stored in the bit string storage unit 111, and FIG. 7 is a substitution substitution according to the embodiment. It is a flowchart for demonstrating a method. Hereinafter, the configuration and processing procedure of the substitution device 100 of this example will be described with reference to these drawings. In the following description, differences from the first embodiment will be mainly described, and description of items common to the first embodiment will be omitted.

<ハードウェア構成>
32ビットのCPUを用いる以外は、第1の実施の形態と同様である。
<前処理>
第1の実施の形態と同様、事前計算したビット列SPをビット列格納部111に格納する。ただし、この例では、関数s(x)を4要素配列した関数をSP(x)(=(s(x),s(x),s(x),s(x)))とし、この関数SP(x)にx=(00000000),(00000001),…,(11111111)をそれぞれ代入した256要素のビット列132
SP((00000000)2)=(s((00000000)2),…,s((00000000)2))
SP((00000001)2)=(s((00000001)2),…,s((00000001)2))

SP((11111111)2)=(s((11111111)2),…,s((11111111)2))
をSPとし、表130を構成している(図6)。
<Hardware configuration>
The second embodiment is the same as the first embodiment except that a 32-bit CPU is used.
<Pretreatment>
As in the first embodiment, the pre-calculated bit string SP is stored in the bit string storage unit 111. However, in this example, a function in which the function s (x) is arranged in four elements is SP (x) (= (s (x), s (x), s (x), s (x))). A bit string 132 of 256 elements obtained by substituting x = (00000000) 2 , (00000001) 2 ,... (11111111) 2 for SP (x), respectively.
SP ((00000000) 2 ) = (s ((00000000) 2 ),…, s ((00000000) 2 ))
SP ((00000001) 2 ) = (s ((00000001) 2 ),…, s ((00000001) 2 ))
...
SP ((11111111) 2 ) = (s ((11111111) 2 ), ..., s ((11111111) 2 ))
Table 130 is configured (FIG. 6).

また、第1の実施の形態と同様、この例でも各代入値xに対応するビット列格納部111のアドレス131(H(x))に、xの代入結果である各ビット列SP((00000000)),SP((00000001)),…,SP((11111111))を格納することにより、各ビット列SPと各代入値xとの対応付けを行っている。
なお、s(x)の代入結果は8ビットであるため、それが4要素配列されたSP(x)の各代入結果は32(8×4)ビット=4バイトとなる。また、表130は、このSP(x)への代入結果が256要素集合したものである。よって、この表130の大きさ(データサイズ)は1KB(=4バイト×256)である。
また、定数格納部116には、j=1,8に対応付けられた定数(ffffff00)16,j=2,5に対応付けられた定数(00ffffff)16,j=3,6に対応付けられた定数(ff00ffff)16,j=4,7に対応付けられた定数(ffff00ff)16が格納される。
Further, similarly to the first embodiment, in this example, each bit string SP ((00000000) 2 that is the result of substitution of x into the address 131 (H (x)) of the bit string storage unit 111 corresponding to each substitution value x. ), SP ((00000001) 2 ),..., SP ((11111111) 2 ), thereby associating each bit string SP with each substitution value x.
Since the substitution result of s (x) is 8 bits, each substitution result of SP (x) in which four elements are arranged is 32 (8 × 4) bits = 4 bytes. Table 130 is a set of 256 elements obtained by substituting this SP (x). Therefore, the size (data size) of this table 130 is 1 KB (= 4 bytes × 256).
Further, in the constant storage unit 116, corresponding to j = the associated constants 1,8 (ffffff00) 16, j = 2,5 in the associated constants (00ffffff) 16, j = 3,6 constant (ff00ffff) 16, j = 4,7 in the associated constants (ffff00ff) 16 is stored.

<換字置換処理>
本形態において換字置換処理を行う場合、まずデータ列入力部112において、換字置換処理の対象となる入力データ列(x,x,…,x)の入力を受け付ける(ステップS11)。入力されたデータx,xは8ビット循環シフト部113へ送られ、その他のデータ列(x,x,x,x,x,x)はビット列抽出部114に送られる。
8ビット循環シフト部113は、送られた8ビットのデータx,xに対し、それぞれ1ビットの左循環シフト(x,x)を行い(ステップS12)、その演算結果をビット列抽出部114に送る。
<Substitution replacement processing>
When performing substitution substitution processing in this embodiment, first, the data string input unit 112 receives input of an input data string (x 1 , x 2 ,..., X 8 ) to be subjected to substitution substitution processing (step S11). The input data x 4 and x 7 are sent to the 8-bit cyclic shift unit 113, and the other data strings (x 1 , x 2 , x 3 , x 5 , x 6 , x 8 ) are sent to the bit string extraction unit 114. It is done.
The 8-bit cyclic shift unit 113 performs a 1-bit left cyclic shift (x 4 << 1 , x 7 << 1 ) on the transmitted 8-bit data x 4 and x 7 (step S12), and performs an operation thereof. The result is sent to the bit string extraction unit 114.

ビット列抽出部114は、ビット列格納部111を参照し、送られたデータ列(x,x,x,x,x,x)及び左循環シフト結果(x,x)に対応付けられているアドレス131に格納されたビット列SP(x),SP(x),SP(x),SP(x),SP(x),SP(x)及びSP(x),SP(x)を抽出する(ステップS13)。このビット列抽出部114で抽出されたSP(x)、SP(x)、SP(x)、SP(x)は、それぞれ論理積演算部117に送られ、その他のSP(x),SP(x),SP(x),SP(x)は、それぞれ32ビット循環シフト部115に送られる。 The bit string extraction unit 114 refers to the bit string storage unit 111, and transmits the transmitted data string (x 1 , x 2 , x 3 , x 5 , x 6 , x 8 ) and the left circular shift result (x 4 << 1 , x 7 << 1 ) The bit string SP (x 1 ), SP (x 2 ), SP (x 3 ), SP (x 5 ), SP (x 6 ), SP (x 8 ), SP (x 4 << 1 ), and SP (x 7 << 1 ) are extracted (step S13). SP (x 1 ), SP (x 8 ), SP (x 4 << 1 ), and SP (x 7 << 1 ) extracted by the bit string extraction unit 114 are respectively sent to the AND operation unit 117, SP (x 2 ), SP (x 3 ), SP (x 5 ), and SP (x 6 ) are each sent to the 32-bit cyclic shift unit 115.

32ビット循環シフト部115(「循環シフト手段」に相当)は、送られたビット列SP(x)全体及びSP(x)全体を左に1ビットだけ循環シフトし(SP(x)≪,SP(x)≪)、SP(x)全体及びSP(x)全体をそれぞれ右に1ビットだけ循環シフトする(SP(x)≫, SP(x)≫)(ステップS14)。そして、これらの演算結果は、論理積演算部117に送られる。なお、SP(x)≪は、換字関数s(x)に入力データxを代入した結果s(x)を4個配列したビット列に相当する。同様に、SP(x)≪はs(x)を4個配列したビット列に相当し、SP(x)≫, はs(x)を4個配列したビット列に相当し、SP(x)≫はs(x)を4個配列したビット列に相当する。 The 32-bit cyclic shift unit 115 (corresponding to “circular shift means”) cyclically shifts the entire transmitted bit string SP (x 2 ) and SP (x 5 ) to the left by 1 bit (SP (x 2 ) << 1 , SP (x 5 ) << 1 ), SP (x 3 ) and SP (x 6 ) are each cyclically shifted to the right by one bit (SP (x 3 ) >> 1 , SP (x 6 ) >> 1 (Step S14). Then, these calculation results are sent to the logical product calculation unit 117. SP (x 2 ) << 1 corresponds to a bit string in which four results s 2 (x 2 ) obtained by substituting the input data x 2 into the substitution function s 2 (x) are arranged. Similarly, SP (x 5 ) << 1 corresponds to a bit string in which four s 5 (x 5 ) are arranged, and SP (x 3 ) >> 1 , corresponds to a bit string in which four s 3 (x 3 ) are arranged. SP (x 6 ) >> 1 corresponds to a bit string in which four s 6 (x 6 ) are arranged.

論理積演算部117は、送られたSP(x)(j=1,8)、SP(x)≪(j=2,5)、SP(x)≫(j=3,6)及びSP(x)(j=4,7)のjにそれぞれ対応する定数((ffffff00)16等)を定数格納部116から抽出し、抽出した定数とSP(x)との論理積を以下のように計算する(ステップS15)。
SP1110(x)←SP(x)&(ffffff00)16
SP0222(x)←SP(x)≪&(00ffffff)16
SP3033(x)←SP(x)≫&(ff00ffff)16
SP4404(x)←SP(x)&(ffff00ff)16
SP0222(x)←SP(x)≪&(00ffffff)16
SP3033(x)←SP(x)≫&(ff00ffff)16
SP4404(x)←SP(x)&(ffff00ff)16
SP1110(x)←SP(x)&(ffffff00)16
論理積演算部117での演算結果SP1110(x),SP0222(x),SP3033(x),SP4404(x),SP0222(x),SP3033(x),SP4404(x),SP1110(x)は、排他的論理和演算部118に送られ、排他的論理和演算部118は、以下の排他的論理和演算によりDとUを求める(ステップS16)。
The logical product operation unit 117 sends the received SP (x j ) (j = 1,8), SP (x j ) << 1 (j = 2,5), SP (x j ) >> 1 (j = 3, 6) and constants ((ffffff00) 16 etc.) respectively corresponding to j of SP (x j << 1 ) (j = 4, 7) are extracted from the constant storage unit 116, and the extracted constants and SP (x j ) and Is calculated as follows (step S15).
SP 1110 (x 1 ) ← SP (x 1 ) & (ffffff00) 16
SP 0222 (x 2 ) <-SP (x 2 ) << 1 & (00ffffff) 16
SP 3033 (x 3 ) <-SP (x 3 ) >> 1 & (ff00ffff) 16
SP 4404 (x 4 ) <-SP (x 4 << 1 ) & (ffff00ff) 16
SP 0222 (x 5 ) ← SP (x 5 ) << 1 & (00ffffff) 16
SP 3033 (x 6 ) <-SP (x 6 ) >> 1 & (ff00ffff) 16
SP 4404 (x 7 ) ← SP (x 7 << 1 ) & (ffff00ff) 16
SP 1110 (x 8 ) ← SP (x 8 ) & (ffffff00) 16
Calculation results SP 1110 (x 1 ), SP 0222 (x 2 ), SP 3033 (x 3 ), SP 4404 (x 4 ), SP 0222 (x 5 ), SP 3033 (x 6 ) in the AND operation unit 117 , SP 4404 (x 7 ), SP 1110 (x 8 ) are sent to the exclusive OR operation unit 118, and the exclusive OR operation unit 118 obtains D and U by the following exclusive OR operation ( Step S16).

Figure 0004527960
算出されたDは排他的論理和演算部120に送られ、Uは32ビット循環シフト部119及び排他的論理和演算部120に送られる。32ビット循環シフト部119は、送られたUを右に8ビット循環シフトして(U≫)排他的論理和演算部120に送り(ステップS17)、排他的論理和演算部120は、以下の演算によりデータ列(y,y,…,y)を算出し(ステップS18)、そのデータ列(y,y,…,y)を換字置換結果として出力する(ステップS19)。
Figure 0004527960
The calculated D is sent to the exclusive OR operation unit 120, and U is sent to the 32-bit cyclic shift unit 119 and the exclusive OR operation unit 120. The 32-bit cyclic shift unit 119 cyclically shifts the sent U by 8 bits to the right (U >> 8 ) and sends it to the exclusive OR operation unit 120 (step S17). The data string (y 1 , y 2 ,..., Y 8 ) is calculated by the operation of (Step S18), and the data string (y 1 , y 2 ,..., Y 8 ) is output as a substitution substitution result (Step S19). ).

Figure 0004527960
<計算コスト・表の大きさ>
以上説明したように、本形態では、ステップS12において、8ビットデータの循環シフトを2回行い、ステップS13において、ビット列格納部111の表130を8回参照している。また、32ビットデータの循環シフトを、ステップS14において4回行い、ステップS17において1回行っている。さらに、スステップS15において論理積を8回行い、排他的論理和をステップS16において6回、ステップS18において2回行っている。また、前述のように表130の大きさは1KBである。
Figure 0004527960
<Calculation cost / table size>
As described above, in this embodiment, the cyclic shift of 8-bit data is performed twice in step S12, and the table 130 of the bit string storage unit 111 is referred to eight times in step S13. Further, the cyclic shift of 32-bit data is performed four times in step S14 and once in step S17. Furthermore, logical product is performed 8 times in step S15, and exclusive logical sum is performed 6 times in step S16 and twice in step S18. Further, as described above, the size of the table 130 is 1 KB.

表参照回数 8
排他的論理和回数 8
32ビットデータ循環シフト回数 5
8ビットデータ循環シフト回数 2
論理積回数 8
表の大きさ(KB) 1
このように、本形態では、計算コストをさほど増加させることなく、表の大きさを従来の4分の1にすることができた。
Table reference count 8
Exclusive OR number 8
32-bit data cyclic shift count 5
8-bit data cyclic shift count 2
Number of logical products 8
Table size (KB) 1
Thus, in this embodiment, the size of the table could be reduced to a quarter of the conventional size without increasing the calculation cost so much.

なお、本発明は上述の各実施の形態に限定されるものではない。例えば、上述の各実施の形態はCamellia暗号への適用例であるため、R=GF(2)、n=m=8とし、置換行列Pを式(9)とし、換字関数間に式(10)の関係があることとしたが、特にこれに限定されるものではなく、例えば、RとしてGF(2)のその他の拡大体を用い、n,mとしてその他の数を適用し、置換行列Pを各要素が∈{0,1}であるその他の行列を用いてもよく、換字関数としてs(x)=s(e(x))≪(eは簡単に計算可能な関数)の関係を満たすものを用いてもよい。また、循環シフトを行う必要がない、或いは効率が悪い場合には、この循環シフトの代わりに、通常のシフト、加算、排他的論理和、論理和等を組み合わせた演算を行うこととしてもよい。 The present invention is not limited to the embodiments described above. For example, since each of the above-described embodiments is an application example to the Camellia cipher, R = GF (2 8 ), n = m = 8, the permutation matrix P is set as Formula (9), and the formula ( 10), but is not particularly limited to this. For example, another extension field of GF (2) is used as R, other numbers are applied as n and m, and a permutation matrix P may be another matrix in which each element is ∈ {0, 1}, and s j (x) = s (e (x)) << t (e is a function that can be easily calculated) as a substitution function Those satisfying the relationship may be used. Further, when it is not necessary to perform a cyclic shift or when the efficiency is poor, instead of this cyclic shift, an operation combining a normal shift, addition, exclusive logical sum, logical sum or the like may be performed.

また、上述の各実施の形態では、1種類の関数s(x)にxの取り得る値を代入した結果のみから構成されたビット列(SP)をビット列格納部に格納しておくこととしたが、複数の関数s(x)にxの取り得る値を代入した結果から構成されたビット列(SP)をビット列格納部に格納しておき、これらを用いて換字置換処理を行ってもよい。
さらに、上述の各実施の形態では、関数s(x)として換字関数s(x)を用いたが、関数s(x)としてその他の換字関数を用いてもよく、また、換字関数以外の関数を関数s(x)としてもよい。
In each of the above-described embodiments, the bit string (SP) configured only from the result of substituting the possible values of x into one type of function s (x) is stored in the bit string storage unit. Alternatively, a bit string (SP) composed of the result of substituting the possible values of x into a plurality of functions s (x) may be stored in the bit string storage unit, and substitution substitution processing may be performed using these.
Further, in each of the above-described embodiments, the substitution function s 1 (x) is used as the function s (x). However, other substitution functions may be used as the function s (x). The function may be a function s (x).

その他、本発明の趣旨を逸脱しない範囲で適宜変更が可能であることはいうまでもない。また、上述の各種の処理は、記載に従って時系列に実行されるのみならず、処理を実行する装置の処理能力あるいは必要に応じて並列的にあるいは個別に実行されてもよい。
また、上述の構成をコンピュータによって実現する場合、各装置が有すべき機能の処理内容はプログラム(換字変換プログラム)によって記述される。そして、このプログラムをコンピュータで実行することにより、上記処理機能がコンピュータ上で実現される。
Needless to say, other modifications are possible without departing from the spirit of the present invention. In addition, the various processes described above are not only executed in time series according to the description, but may be executed in parallel or individually according to the processing capability of the apparatus that executes the processes or as necessary.
Further, when the above configuration is realized by a computer, the processing contents of the functions that each device should have are described by a program (substitution conversion program). The processing functions are realized on the computer by executing the program on the computer.

この処理内容を記述したプログラムは、コンピュータで読み取り可能な記録媒体(換字変換記録媒体)に記録しておくことができる。コンピュータで読み取り可能な記録媒体としては、例えば、磁気記録装置、光ディスク、光磁気記録媒体、半導体メモリ等どのようなものでもよいが、具体的には、例えば、磁気記録装置として、ハードディスク装置、フレキシブルディスク、磁気テープ等を、光ディスクとして、DVD(Digital Versatile Disc)、DVD−RAM(Random Access Memory)、CD−ROM(Compact Disc Read Only Memory)、CD−R(Recordable)/RW(ReWritable)等を、光磁気記録媒体として、MO(Magneto-Optical disc)等を、半導体メモリとしてEEP−ROM(Electronically Erasable and Programmable-Read Only Memory)等を用いることができる。   The program describing the processing contents can be recorded in a computer-readable recording medium (substitution conversion recording medium). The computer-readable recording medium may be any medium such as a magnetic recording device, an optical disk, a magneto-optical recording medium, or a semiconductor memory. Specifically, for example, the magnetic recording device may be a hard disk device or a flexible Discs, magnetic tapes, etc. as optical disks, DVD (Digital Versatile Disc), DVD-RAM (Random Access Memory), CD-ROM (Compact Disc Read Only Memory), CD-R (Recordable) / RW (ReWritable), etc. As the magneto-optical recording medium, MO (Magneto-Optical disc) or the like can be used, and as the semiconductor memory, EEP-ROM (Electronically Erasable and Programmable-Read Only Memory) or the like can be used.

また、このプログラムの流通は、例えば、そのプログラムを記録したDVD、CD−ROM等の可搬型記録媒体を販売、譲渡、貸与等することによって行う。さらに、このプログラムをサーバコンピュータの記憶装置に格納しておき、ネットワークを介して、サーバコンピュータから他のコンピュータにそのプログラムを転送することにより、このプログラムを流通させる構成としてもよい。   The program is distributed by selling, transferring, or lending a portable recording medium such as a DVD or CD-ROM in which the program is recorded. Furthermore, the program may be distributed by storing the program in a storage device of the server computer and transferring the program from the server computer to another computer via a network.

このようなプログラムを実行するコンピュータは、例えば、まず、可搬型記録媒体に記録されたプログラムもしくはサーバコンピュータから転送されたプログラムを、一旦、自己の記憶装置に格納する。そして、処理の実行時、このコンピュータは、自己の記録媒体に格納されたプログラムを読み取り、読み取ったプログラムに従った処理を実行する。また、このプログラムの別の実行形態として、コンピュータが可搬型記録媒体から直接プログラムを読み取り、そのプログラムに従った処理を実行することとしてもよく、さらに、このコンピュータにサーバコンピュータからプログラムが転送されるたびに、逐次、受け取ったプログラムに従った処理を実行することとしてもよい。また、サーバコンピュータから、このコンピュータへのプログラムの転送は行わず、その実行指示と結果取得のみによって処理機能を実現する、いわゆるASP(Application Service Provider)型のサービスによって、上述の処理を実行する構成としてもよい。なお、本形態におけるプログラムには、電子計算機による処理の用に供する情報であってプログラムに準ずるもの(コンピュータに対する直接の指令ではないがコンピュータの処理を規定する性質を有するデータ等)を含むものとする。   A computer that executes such a program first stores, for example, a program recorded on a portable recording medium or a program transferred from a server computer in its own storage device. When executing the process, the computer reads a program stored in its own recording medium and executes a process according to the read program. As another execution form of the program, the computer may directly read the program from the portable recording medium and execute processing according to the program, and the program is transferred from the server computer to the computer. Each time, the processing according to the received program may be executed sequentially. Also, the program is not transferred from the server computer to the computer, and the above-described processing is executed by a so-called ASP (Application Service Provider) type service that realizes the processing function only by the execution instruction and result acquisition. It is good. Note that the program in this embodiment includes information that is used for processing by an electronic computer and that conforms to the program (data that is not a direct command to the computer but has a property that defines the processing of the computer).

また、この形態では、コンピュータ上で所定のプログラムを実行させることにより、本装置を構成することとしたが、これらの処理内容の少なくとも一部をハードウェア的に実現することとしてもよい。   In this embodiment, the present apparatus is configured by executing a predetermined program on a computer. However, at least a part of these processing contents may be realized by hardware.

この発明により換字置換演算に必要な表の大きさを大幅に削減できるため(例えば、32ビット語長環境では1/4)、携帯電話等の省メモリ環境でも、演算速度をそれほど落すことなく換字置換を実装できる。   Since the present invention can greatly reduce the size of a table required for substitution substitution operation (for example, 1/4 in a 32-bit word length environment), substitution in a memory-saving environment such as a mobile phone does not significantly reduce the computation speed. You can implement replacement.

第1の実施の形態における換字置換装置の機能構成を例示した図。The figure which illustrated the functional composition of the substitution substitution device in a 1st embodiment. 第1の実施の形態のビット列格納部に格納される表のデータ構成を例示した図。The figure which illustrated the data structure of the table | surface stored in the bit string storage part of 1st Embodiment. 換字置換装置のハードウェア構成を例示した図。The figure which illustrated the hardware constitutions of the substitution device. 第1の実施の形態の換字置換方法を説明するためのフローチャート。The flowchart for demonstrating the substitution substitution method of 1st Embodiment. 第2の実施の形態における換字置換装置の機能構成を例示した図。The figure which illustrated the functional composition of the substitution substitution device in a 2nd embodiment. 第2の実施の形態のビット列格納部に格納される表のデータ構成を例示した図。The figure which illustrated the data structure of the table | surface stored in the bit string storage part of 2nd Embodiment. 第2の実施の形態の換字置換方法を説明するためのフローチャート。The flowchart for demonstrating the substitution substitution method of 2nd Embodiment.

符号の説明Explanation of symbols

10,100 換字置換装置
11,111 ビット列格納部
14,114 ビット抽出部
15 64ビット循環シフト部
115,119 32ビット循環シフト部
10,100 Substitution replacement device 11,111 Bit string storage unit 14,114 Bit extraction unit 15 64-bit cyclic shift unit 115,119 32-bit cyclic shift unit

Claims (7)

i=1,2,…,mとし、j=1,2,…,nとし、環R上の置換行列のi行j列要素をpijとし、R→Rの換字関数をs(x)とした場合における、R上の換字置換
Figure 0004527960

によって、入力データ列(x,x,…,x)からデータ列(y,y,…,y)を求める換字置換装置であって、
循環シフトによって何れかの上記換字関数s(x)と同値となる関数をs(x)とし、この関数s(x)を複数個配列した関数をSP(x)とし、この関数SP(x)にxの取り得る値を代入したビット列をSPとした場合における、当該ビット列SPを格納するビット列格納手段と、
上記ビット列格納手段から上記ビット列SPの少なくとも一部を抽出するビット列抽出手段と、
上記ビット列抽出手段において抽出されたビット列全体を循環シフトし、何れかの上記換字関数s(x)に入力データxを代入した結果s(x)を複数個配列したビット列SP(x)を算出する循環シフト手段と、
を有することを特徴とする換字置換装置。
i = 1,2, ..., m, j = 1,2, ..., n, i row j column element of the permutation matrix on ring R is p ij, and R → R substitution function is s j (x ), Substitution substitution on R
Figure 0004527960

Is a substitution device for obtaining a data string (y 1 , y 2 ,..., Y m ) from an input data string (x 1 , x 2 ,..., X n ),
A function that has the same value as any of the substitution functions s j (x) by the cyclic shift is defined as s (x), a function in which a plurality of the functions s (x) are arranged is defined as SP (x), and this function SP (x ), A bit string storage means for storing the bit string SP when the bit string obtained by substituting a possible value of x is SP,
Bit string extraction means for extracting at least part of the bit string SP from the bit string storage means;
The entire bit string extracted by the bit string extraction means is cyclically shifted, and the result of substituting the input data x j for any of the substitution functions s j (x) is a bit string SP j (array of a plurality of s j (x j ). a cyclic shift means for calculating x j );
Substitution replacement device characterized by having.
請求項1記載の換字置換装置であって、
上記関数s(x)は、
何れかの換字関数s(x)である、
ことを特徴とする換字置換装置。
A substitution device according to claim 1,
The function s (x) is
Any substitution function s k (x),
The substitution device characterized by that.
請求項1或いは2記載の換字置換装置であって、
上記ビット列抽出手段は、
いずれかの入力データxに対応するビット列SP(x)を抽出する手段である、
ことを特徴とする換字置換装置。
A substitution device according to claim 1 or 2,
The bit string extraction means includes
A means for extracting a bit string SP (x p ) corresponding to any of the input data x p ;
The substitution device characterized by that.
請求項1から3の何れかに記載の換字置換装置であって、
上記ビット列格納手段に格納された上記ビット列SPは、
1種類の上記関数s(x)にxの取り得る値を代入した結果のみから構成されたビット列である、
ことを特徴とする換字置換装置。
The substitution device according to any one of claims 1 to 3,
The bit string SP stored in the bit string storage means is
A bit string composed only of the result of substituting a possible value of x into one type of the function s (x),
The substitution device characterized by that.
コンピュータを、メモリとビット列抽出手段と循環シフト手段とを有する換字置換装置として機能させ、i=1,2,…,mとし、j=1,2,…,nとし、環R上の置換行列のi行j列要素をpijとし、R→Rの換字関数をs(x)とした場合における、R上の換字置換
Figure 0004527960

によって、入力データ列(x,x,…,x)からデータ列(y,y,…,y)を求める換字置換方法であって、
循環シフトによって何れかの上記換字関数s(x)と同値となる関数をs(x)とし、この関数s(x)を複数個配列した関数をSP(x)とし、この関数SP(x)にxの取り得る値を代入したビット列をSPとした場合における、当該ビット列SPを上記メモリに格納しておき、
上記ビット列抽出手段が、上記メモリから上記ビット列SPの少なくとも一部を抽出する手順と、
上記循環シフト手段が、抽出されたビット列全体を循環シフトさせ、何れかの上記換字関数s(x)に入力データxを代入した結果s(x)を複数個配列したビット列SP(x)を算出する手順と、
を実行することを特徴とする換字置換方法。
Let the computer function as a substitution substitution device having a memory, a bit string extraction means, and a cyclic shift means, i = 1, 2,..., M, j = 1, 2,. Substitution substitution on R in the case where the i row and j column element of p is ij and the R → R substitution function is s j (x)
Figure 0004527960

Is a substitution substitution method for obtaining a data string (y 1 , y 2 ,..., Y m ) from an input data string (x 1 , x 2 ,..., X n ),
A function that has the same value as any of the substitution functions s j (x) by the cyclic shift is defined as s (x), a function in which a plurality of the functions s (x) are arranged is defined as SP (x), and this function SP (x when the) bit sequence obtained by substituting the possible values of x in the set to SP, the bit string SP may be stored in the memory,
A procedure in which the bit string extraction means extracts at least a part of the bit string SP from the memory;
The cyclic shift unit, the whole was extracted bit string by circulating shift, one of the substitution function s j The result of substituting the input data x j in (x) s j (x j) bit string to a plurality arranged SP j A procedure for calculating (x j );
The substitution method characterized by performing .
請求項1から4の何れかに記載の換字置換装置としてコンピュータを機能させるための換字置換プログラム。   5. A substitution program for causing a computer to function as the substitution device according to claim 1. 請求項6記載の換字置換プログラムを格納したコンピュータ読取り可能な換字置換記録媒体。   A computer-readable substitution replacement recording medium storing the substitution substitution program according to claim 6.
JP2003362200A 2003-10-22 2003-10-22 Substitution substitution device, substitution substitution method, substitution substitution program, substitution substitution recording medium Expired - Lifetime JP4527960B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2003362200A JP4527960B2 (en) 2003-10-22 2003-10-22 Substitution substitution device, substitution substitution method, substitution substitution program, substitution substitution recording medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2003362200A JP4527960B2 (en) 2003-10-22 2003-10-22 Substitution substitution device, substitution substitution method, substitution substitution program, substitution substitution recording medium

Publications (2)

Publication Number Publication Date
JP2005128166A JP2005128166A (en) 2005-05-19
JP4527960B2 true JP4527960B2 (en) 2010-08-18

Family

ID=34641926

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2003362200A Expired - Lifetime JP4527960B2 (en) 2003-10-22 2003-10-22 Substitution substitution device, substitution substitution method, substitution substitution program, substitution substitution recording medium

Country Status (1)

Country Link
JP (1) JP4527960B2 (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000284691A (en) * 1999-01-25 2000-10-13 Nippon Telegr & Teleph Corp <Ntt> Substitution permutation device and program recording medium thereof
JP2001194994A (en) * 2000-01-06 2001-07-19 Nippon Telegr & Teleph Corp <Ntt> Device and method for substituting computation and its program recording medium
JP2001236017A (en) * 2000-02-22 2001-08-31 Nippon Telegr & Teleph Corp <Ntt> Substitution processing device and recording medium with program thereof recorded thereon

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000284691A (en) * 1999-01-25 2000-10-13 Nippon Telegr & Teleph Corp <Ntt> Substitution permutation device and program recording medium thereof
JP2001194994A (en) * 2000-01-06 2001-07-19 Nippon Telegr & Teleph Corp <Ntt> Device and method for substituting computation and its program recording medium
JP2001236017A (en) * 2000-02-22 2001-08-31 Nippon Telegr & Teleph Corp <Ntt> Substitution processing device and recording medium with program thereof recorded thereon

Also Published As

Publication number Publication date
JP2005128166A (en) 2005-05-19

Similar Documents

Publication Publication Date Title
JP7049374B2 (en) A terminal device that performs the same type of encryption, a server device that processes the ciphertext, and its method.
Thangavel et al. Enhanced DNA and ElGamal cryptosystem for secure data storage and retrieval in cloud
CN110084599B (en) Key processing method, device, equipment and storage medium
JP6044738B2 (en) Information processing apparatus, program, and storage medium
US10326596B2 (en) Techniques for secure authentication
CN115664847A (en) User information safe storage method of internet education platform
Ahmad et al. A secure network communication protocol based on text to barcode encryption algorithm
Ahmad et al. Distributed text-to-image encryption algorithm
JP2008209499A (en) Aes decryption apparatus and program
JP5992651B2 (en) ENCRYPTION METHOD, PROGRAM, AND SYSTEM
EP3483867B1 (en) System, device, method, and program for indexing a secret-shared array with secure multiparty computations
JP4527960B2 (en) Substitution substitution device, substitution substitution method, substitution substitution program, substitution substitution recording medium
JP5530025B2 (en) Data division apparatus and data division program
JP2011040932A (en) Authenticated encryption device, authenticated encryption method, verified decryption device, verified decryption method, encryption system, program, recording medium
JP6091394B2 (en) Information processing apparatus and encryption method
JP4789536B2 (en) Data division apparatus, data division method, and computer program
Vinay et al. Implementation of DNA cryptography based on dynamic DNA sequence table using cloud computing
JP6203387B2 (en) Encryption device, storage system, decryption device, encryption method, decryption method, encryption program, and decryption program
JP4692022B2 (en) Scalar multiplication apparatus and program for elliptic curve cryptography
CN115834163B (en) Method, device, equipment and storage medium for generating secret key of encrypted data
CN114254372B (en) Data encryption processing method and system and electronic equipment
CN116841750B (en) Edge computing device integrating encryption algorithm
JP2001142395A (en) Extended key generator, ciphering/deciphering device, extended key generating method and recording medium
JP7261502B2 (en) Cryptographic processing device, cryptographic processing method, and cryptographic processing program
WO2022270080A1 (en) Encryption processing device, encryption processing method, and encryption processing program

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20060406

RD03 Notification of appointment of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7423

Effective date: 20060406

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20091020

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20091116

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20100525

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20100604

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20130611

Year of fee payment: 3

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

Ref document number: 4527960

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20140611

Year of fee payment: 4

S531 Written request for registration of change of domicile

Free format text: JAPANESE INTERMEDIATE CODE: R313531

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

EXPY Cancellation because of completion of term