JP4733793B2 - Encryption / decryption system, encryption device, decryption device, encryption method, decryption method, and program - Google Patents

Encryption / decryption system, encryption device, decryption device, encryption method, decryption method, and program Download PDF

Info

Publication number
JP4733793B2
JP4733793B2 JP2009095456A JP2009095456A JP4733793B2 JP 4733793 B2 JP4733793 B2 JP 4733793B2 JP 2009095456 A JP2009095456 A JP 2009095456A JP 2009095456 A JP2009095456 A JP 2009095456A JP 4733793 B2 JP4733793 B2 JP 4733793B2
Authority
JP
Japan
Prior art keywords
encryption
plaintext
data
decryption
value
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 - Fee Related
Application number
JP2009095456A
Other languages
Japanese (ja)
Other versions
JP2010246055A (en
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 JP2009095456A priority Critical patent/JP4733793B2/en
Publication of JP2010246055A publication Critical patent/JP2010246055A/en
Application granted granted Critical
Publication of JP4733793B2 publication Critical patent/JP4733793B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Description

この発明は、平文データを暗号化し、暗号化されたデータを平文データに復号化する暗号化・復号化システムに関する。   The present invention relates to an encryption / decryption system that encrypts plaintext data and decrypts the encrypted data into plaintext data.

近年、インターネットを利用して、音楽データのダウンロードや、ビジネスデータのやりとりなどが盛んに行われるようになってきており、同時に、こうした、ネットワーク上で送受信されるデータの機密性を保持する必要性も高まってきている。   In recent years, music data has been downloaded and business data has been actively exchanged over the Internet, and at the same time, the need to maintain the confidentiality of data sent and received over the network. Is also growing.

一般的に、ネットワークを介してデータを送信するユーザは、そのデータについて暗号化を行い、復号キーを有さない第三者には当該データの内容が開示されないようにする。従来の暗号化方法で代表的なものには、公開鍵暗号方式であるRSA、共通鍵暗号方式であるDES(Data Encryption Standard)がある。   Generally, a user who transmits data via a network encrypts the data so that the content of the data is not disclosed to a third party who does not have a decryption key. Typical examples of conventional encryption methods include RSA, which is a public key encryption method, and DES (Data Encryption Standard), which is a common key encryption method.

この他にも、たとえば、特許文献1では、暗号化関数として、平文データの文字列の内容、およびその文字列の位置に依存する関数が採用され、暗号化処理に用いられる乱数が、平文の文字列の内容に応じて選択される暗号化方法が提案されている。
特開2001−203685号公報
In addition, for example, in Patent Document 1, a function that depends on the contents of a character string of plaintext data and the position of the character string is adopted as an encryption function, and a random number used for encryption processing is expressed in plaintext. An encryption method selected according to the contents of a character string has been proposed.
Japanese Patent Laid-Open No. 2001-203585

しかしながら、上述した従来の暗号化方式では、XOR、乗算、除算等のビット演算を多く用いて複雑にデータを変化させ、高いビット変化率と暗号強度を獲得しようとするものであるが、そのような複雑な演算のために全体の計算量が増大し、暗号化処理を行う処理速度が遅くなってしまうという問題点がある。また、上述の特許文献1のような方法では、平文データの文字ごとに、対応する乱数表を切り替えて暗号化するという単純なものであり、多くのパターンの乱数表を用意しなければならないという仕組みの複雑さや、暗号強度の面で十分とは言えない。   However, in the conventional encryption method described above, data is changed in a complicated manner using many bit operations such as XOR, multiplication, and division, and a high bit change rate and encryption strength are obtained. Due to such complicated calculations, there is a problem that the total calculation amount increases, and the processing speed for performing the encryption processing becomes slow. Further, the method as described in Patent Document 1 is a simple method of switching and encrypting the corresponding random number table for each character of the plaintext data, and it is necessary to prepare many patterns of random number tables. It cannot be said that the complexity of the mechanism and the encryption strength are sufficient.

したがって、本発明の目的は、暗号化処理または復号化処理を行う際の計算量を低減させつつ、高いビット変化率および暗号強度を実現する暗号化・復号化システムを提供することにある。   Accordingly, an object of the present invention is to provide an encryption / decryption system that realizes a high bit change rate and encryption strength while reducing the amount of calculation when performing encryption processing or decryption processing.

また、本発明の目的は、平文データの内容を、暗号鍵テーブルをアクセスする際のインデックスとして用いるなどして、暗号化処理を、よりシンプルなロジックで実現実現する暗号化・復号化システムを提供することにある。また、復号化処理についても、どうようにシンプルなロジックで実現される。   Another object of the present invention is to provide an encryption / decryption system that realizes encryption processing with simpler logic by using the contents of plaintext data as an index when accessing the encryption key table. There is to do. Also, the decryption process is realized with simple logic.

本発明の第1実施態様は、各エントリーに、それぞれ異なる暗号鍵を格納する暗号鍵テーブルと、平文データを、平文文字単位で暗号化し暗号文データを生成する暗号化手段と、暗号文データを復号化する復号化手段とを備える暗号化・復号化システムである。ここで、暗号化手段は、平文データから、順次平文文字を抽出し、平文文字の内容に基づいて、暗号鍵テーブルのエントリーの順番を決定し、決定された順番のエントリーに記憶される暗号鍵テーブルの値に基づいて、平文文字に対応する暗号鍵を決定し、決定された暗号鍵を、第1インデックスで指定される暗号文データの位置にセットするよう構成され、一方、復号化手段は、暗号文データから、平文文字と同じ単位で順次暗号文字を抽出し、暗号文字の内容に基づいて、復号鍵テーブルのエントリーの順番を決定し、決定された順番のエントリーに記憶される復号鍵テーブルの値に基づいて、暗号文字に対応する復号鍵を決定し、決定された復号鍵を、第2インデックスで指定される平文データの位置にセットするように構成される。また、第1インデックスは、平文データにおける平文文字の位置に基づいて決定され、第2インデックスは、暗号文データにおける暗号文字の位置に基づいて決定される。 According to a first embodiment of the present invention, an encryption key table storing different encryption keys in each entry, encryption means for encrypting plaintext data in plaintext units to generate ciphertext data, and ciphertext data An encryption / decryption system comprising decryption means for decrypting. Here, the encryption means sequentially extracts plaintext characters from the plaintext data, determines the order of entries in the encryption key table based on the contents of the plaintext characters, and stores the encryption keys stored in the entries in the determined order. The encryption key corresponding to the plaintext character is determined based on the value of the table, and the determined encryption key is configured to be set at the position of the encrypted text data specified by the first index, while the decryption means , from the ciphertext data, sequentially extracted cipher text in the same units as plain text characters, based on the contents of the cipher text, the decryption key determines the order of the entries in the decryption key table is stored in the entry of the determined order Based on the value of the table, a decryption key corresponding to the encrypted character is determined, and the determined decryption key is set at the position of the plaintext data designated by the second index. The first index is determined based on the position of the plaintext character in the plaintext data, and the second index is determined based on the position of the encrypted character in the ciphertext data.

本発明の第2実施態様は、上述の第1実施態様において、復号鍵テーブルが、エントリーの順番を表す値と当該エントリーに格納されている値との関係に関し、暗号鍵テーブルとは逆になるように構成される。 In the second embodiment of the present invention, in the first embodiment described above, the decryption key table is reverse to the encryption key table with respect to the relationship between the value representing the entry order and the value stored in the entry. Configured as follows.

本発明の第3実施態様は、各エントリーに、それぞれ異なる暗号鍵を格納する暗号鍵テーブルと、平文データを、平文文字単位で暗号化し暗号文データを生成する暗号化手段とを備える暗号化装置である。ここで、暗号化手段は、平文データから、順次平文文字を抽出し、平文文字の内容に基づいて、暗号鍵テーブルのエントリーの順番を決定し、決定された順番のエントリーに記憶される暗号鍵テーブルの値に基づいて、平文文字に対応する暗号鍵を決定し、決定された暗号鍵を、インデックスで指定される暗号文データの位置にセットするように構成され、インデックスは、平文データにおける平文文字の位置に基づいて決定される。 A third embodiment of the present invention is an encryption apparatus comprising: an encryption key table that stores different encryption keys in each entry; and an encryption unit that encrypts plaintext data in plaintext units to generate ciphertext data. It is. Here, the encryption means sequentially extracts plaintext characters from the plaintext data, determines the order of entries in the encryption key table based on the contents of the plaintext characters, and stores the encryption keys stored in the entries in the determined order. The encryption key corresponding to the plaintext character is determined based on the value of the table, and the determined encryption key is set to the position of the encrypted text data specified by the index. The index is the plaintext in the plaintext data. Determined based on character position.

本発明の第4実施態様は、上述の第3実施態様において、インデックスを、平文データにおける平文文字の位置、および平文データのサイズを用いて計算し、サイズが2のn乗数である場合に、除算を用いない方法で計算が行われるように構成される。   According to a fourth embodiment of the present invention, in the third embodiment, the index is calculated using the position of the plaintext character in the plaintext data and the size of the plaintext data, and the size is an n multiplier of 2. The calculation is performed in a manner that does not use division.

本発明の第5実施態様は、上述の第3実施態様において、暗号化手段は、生成された暗号文データを同じ手順でさらに暗号化することにより、平文データに対して暗号化を複数回行うよう制御するように構成される。また、これらの複数回の暗号化処理のそれぞれにおいて、決定された暗号鍵をセットする暗号文データ内の位置を変化させるように制御することができる。   According to a fifth embodiment of the present invention, in the third embodiment described above, the encrypting means encrypts the generated ciphertext data by the same procedure, thereby encrypting the plaintext data a plurality of times. Configured to control. Further, in each of the plurality of times of encryption processing, control can be performed so as to change the position in the ciphertext data where the determined encryption key is set.

本発明の第6実施態様は、上述の第3実施態様において、暗号化手段は、平文文字に対応する暗号鍵を、順番のエントリーに記憶される暗号鍵テーブルの値と、以前に決定された暗号鍵とを用いて決定するように構成される。 According to a sixth embodiment of the present invention, in the third embodiment described above, the encrypting means determines the encryption key corresponding to the plain text character and the value of the encryption key table stored in the order entry previously. It is comprised so that it may determine using an encryption key.

本発明の第7実施態様は、各エントリーに、それぞれ異なる復号鍵を格納する復号鍵テーブルと、暗号文を、暗号文字単位で復号化し平文データを生成する復号化手段とを備える復号化装置である。ここで、復号化手段は、暗号文データから、順次暗号文字を抽出し、暗号文字の内容に基づいて、復号鍵テーブルのエントリーの順番を決定し、決定された順番のエントリーに記憶される復号鍵テーブルの値に基づいて、暗号文字に対応する復号鍵を決定し、決定された復号鍵を、インデックスで指定される平文データの位置にセットする。また、インデックスは、暗号文データにおける暗号文字の位置に基づいて決定される。 A seventh embodiment of the present invention is a decryption apparatus comprising a decryption key table storing different decryption keys in each entry, and decryption means for decrypting ciphertext in units of cipher characters to generate plaintext data. is there. Here, the decryption means sequentially extracts the cipher characters from the ciphertext data, determines the order of the entries in the decryption key table based on the contents of the cipher characters, and stores the decryption stored in the entries in the determined order. Based on the value in the key table, the decryption key corresponding to the cipher character is determined, and the determined decryption key is set at the position of the plaintext data designated by the index. The index is determined based on the position of the cipher character in the ciphertext data.

本発明の第8実施態様は、平文データを暗号化する暗号化装置で用いられる暗号化方法である。この暗号化装置は、各エントリーに、それぞれ異なる暗号鍵を格納する暗号鍵テーブルを有し、暗号化方法は、平文データから、順次、所定単位の平文文字を抽出するステップと、暗号鍵テーブルのエントリーの順番を、平文文字の内容に基づいて決定するステップと、決定された順番のエントリーに記憶される暗号鍵テーブルの値に基づいて、平文文字に対応する暗号鍵を決定するステップと、決定された暗号鍵を、インデックスで指定される暗号文データの位置にセットすることにより、暗号文データを生成するステップとを有する。ここで、インデックスは、平文データにおける平文文字の位置に基づいて決定される。 The eighth embodiment of the present invention is an encryption method used in an encryption apparatus that encrypts plaintext data. This encryption apparatus has an encryption key table for storing different encryption keys in each entry, and the encryption method extracts a plaintext character of a predetermined unit sequentially from plaintext data, the order of entries, determining determining based on the contents of the plaintext characters, based on the value of the encryption key table stored in the entry of the determined order, the encryption key corresponding to the plaintext characters, determined Generating ciphertext data by setting the encrypted key at the position of the ciphertext data designated by the index . Here, the index is determined based on the position of the plaintext character in the plaintext data.

本発明の第9実施態様は、暗号文データを復号化する復号化装置で用いられる復号化方法である。この復号化装置は、各エントリーに、それぞれ異なる復号鍵を格納する復号鍵テーブルを有し、復号化方法は、暗号文データから、順次、所定単位の暗号文字を抽出するステップと、復号鍵テーブルのエントリーの順番を、暗号文字の内容に基づいて決定するステップと、決定された順番のエントリーに記憶される復号鍵テーブルの値に基づいて、暗号文字に対応する復号鍵を決定するステップと、決定された復号鍵を、インデックスで指定される平文データの位置にセットすることにより、平文データを生成するステップとを有する。ここで、インデックスは、暗号文データにおける暗号文字の位置に基づいて決定される。 The ninth embodiment of the present invention is a decryption method used in a decryption device for decrypting ciphertext data. This decryption apparatus has a decryption key table for storing different decryption keys in each entry, and the decryption method includes a step of sequentially extracting a predetermined unit of cipher characters from ciphertext data, and a decryption key table. a step of the order of entries, determining based on the contents of the cipher text, based on the value of the decryption key table stored in the entry of the determined order, determines a decryption key corresponding to the encryption character, the determined decoding key, by setting the position of the plaintext data specified by the index, which chromatic and generating plaintext data. Here, the index is determined based on the position of the encrypted character in the ciphertext data.

本発明の第10実施態様は、平文データを暗号化する暗号化装置のためのプログラムである。この暗号化装置は、各エントリーに、それぞれ異なる暗号鍵を格納する暗号鍵テーブルを有し、プログラムは、暗号化装置のコンピュータに対して、平文データから、順次平文文字を抽出するステップと、暗号鍵テーブルのエントリーの順番を、平文文字の内容に基づいて決定するステップと、決定された順番のエントリーに記憶される暗号鍵テーブルの値に基づいて、平文文字に対応する暗号鍵を決定するステップと、決定された暗号鍵を、インデックスで指定される暗号文データの位置にセットすることによって、暗号文データを生成するステップとを実行させる。また、インデックスは、平文データにおける平文文字の位置に基づいて決定される。 The tenth embodiment of the present invention is a program for an encryption device that encrypts plaintext data. This encryption apparatus has an encryption key table for storing different encryption keys in each entry. The program sequentially extracts plaintext characters from plaintext data to the computer of the encryption apparatus ; the order of entries in the key table, and determining based on the contents of the plaintext characters, based on the value of the encryption key table stored in the entry of the determined order to determine the encryption key corresponding to the plaintext characters step And generating the ciphertext data by setting the determined cipher key at the position of the ciphertext data specified by the index . The index is determined based on the position of the plaintext character in the plaintext data.

本発明に係る暗号化・復号化システムによって、暗号化処理または復号化処理を行う際の計算量が低減され、それと同時に、高いビット変化率および暗号強度が実現される。また、本発明に係る暗号化・復号化システムによって、暗号化処理や復号化処理が、よりシンプルなロジックで実現される。これは、たとえば、平文データの内容を、暗号鍵テーブルをアクセスする際のインデックスとして用いたり、暗号化の計算において、乗算および除算等の、負荷の高い演算を効果的に排除するといった、処理方式上の様々な工夫により達成される。   With the encryption / decryption system according to the present invention, the amount of calculation when performing encryption processing or decryption processing is reduced, and at the same time, a high bit change rate and encryption strength are realized. Further, the encryption / decryption system according to the present invention realizes encryption processing and decryption processing with simpler logic. This is a processing method in which, for example, the content of plaintext data is used as an index when accessing the encryption key table, or operations that are expensive such as multiplication and division are effectively eliminated in the calculation of encryption. This is achieved by the various devices above.

最初に、本発明の一実施形態に係る暗号化・復号化システムの概要を、図1の機能ブロック図を参照して説明する。本発明の暗号化・復号化システム1は、制御部100、暗号化処理部110、および復号化処理部120を含むように構成される。   First, an outline of an encryption / decryption system according to an embodiment of the present invention will be described with reference to the functional block diagram of FIG. The encryption / decryption system 1 of the present invention is configured to include a control unit 100, an encryption processing unit 110, and a decryption processing unit 120.

制御部100は、暗号化を行う場合に、平文データ10を暗号化処理部110に提供するとともに、暗号化処理部110から出力されたデータを暗号文データ20として記録したり、外部に提供したりする。また、制御部100は、復号化を行う場合に、暗号文データ20を復号化処理部120に提供するとともに、復号化処理部120から出力されたデータを平文データ10として記録したり、外部に提供したりする。   When encryption is performed, the control unit 100 provides the plaintext data 10 to the encryption processing unit 110 and records the data output from the encryption processing unit 110 as the ciphertext data 20 or provides the data to the outside. Or In addition, when performing the decryption, the control unit 100 provides the ciphertext data 20 to the decryption processing unit 120 and records the data output from the decryption processing unit 120 as the plaintext data 10 or externally. Or provide.

本発明の暗号化および復号化においては、平文データ10および暗号文データ20が、2のn乗数のサイズでそれぞれ、暗号化処理部110、復号化処理部120に提供されることにより、乗算はもちろん除算をも用いない方法で計算が行われ、結果的に計算量の大幅な低減が図られるため、制御部100は、平文データ10を暗号化処理部110に提供する際、または暗号文データ20を復号化処理部120に提供する際に、これらのデータを、所定の「2のn乗数」のサイズのデータにブロック化する。また、制御部100は、暗号化処理部110から、ブロック化された平文データを暗号化した暗号文データを受け取った場合、これらの暗号文データを結合して、元の平文データ10に対応する暗号文データ20とする。復号化処理部120から、ブロック化された暗号文データを復号した平文データを受け取った場合も同様である。   In the encryption and decryption of the present invention, the plaintext data 10 and the ciphertext data 20 are provided to the encryption processing unit 110 and the decryption processing unit 120, respectively, in a size of 2 n multipliers. Of course, the calculation is performed by a method that does not use division, and as a result, the amount of calculation is significantly reduced. Therefore, the control unit 100 provides the plaintext data 10 to the encryption processing unit 110 or the ciphertext data. When 20 is provided to the decryption processing unit 120, these data are blocked into data having a size of a predetermined “n-multiplier of 2”. When the control unit 100 receives ciphertext data obtained by encrypting the blocked plaintext data from the encryption processing unit 110, the control unit 100 combines these ciphertext data to correspond to the original plaintext data 10. The ciphertext data 20 is assumed. The same applies when plaintext data obtained by decrypting the block ciphertext data is received from the decryption processing unit 120.

また、平文データ10や暗号文データ20が、上記所定の「2のn乗数」で割りきれない場合は、少なくとも1回、「2のn乗数」でないサイズのデータを、暗号化処理部110または復号化処理部120に提供する必要がある。しかしながら、制御部100は、平文データ10や暗号文データ20の最後にダミーデータを加えて各データを「2のn乗数」の倍数になるようにし、暗号化処理部110または復号化処理部120に、「2のn乗数」でないサイズのデータが1回も提供されないようコントロールすることもできる。   If the plaintext data 10 and the ciphertext data 20 cannot be divided by the predetermined “2n multiplier”, the data having a size other than the “2n multiplier” is sent at least once to the encryption processing unit 110 or It is necessary to provide it to the decryption processing unit 120. However, the control unit 100 adds dummy data to the end of the plaintext data 10 or the ciphertext data 20 so that each data becomes a multiple of “n multiplier of 2”, and the encryption processing unit 110 or the decryption processing unit 120. In addition, it is also possible to control so that data having a size other than “2n multiplier” is never provided.

暗号化処理部110は、平文データ10の全部または一部を受け取ると、暗号鍵テーブル210を参照して、受け取った平文データ10を所定の平文文字単位で暗号化し、この処理を必要に応じて繰り返し、最終的に暗号化されたデータ(暗号文データ)を生成する。   When the encryption processing unit 110 receives all or part of the plaintext data 10, the encryption processing unit 110 refers to the encryption key table 210, encrypts the received plaintext data 10 in units of predetermined plaintext characters, and performs this processing as necessary. Repeatedly, finally encrypted data (ciphertext data) is generated.

ここで、平文データを、1バイト(8ビット)といったサイズの平文文字を暗号化単位として暗号化するものとすると、8ビットで表現されるビットパターンの数は256であるため、この1バイトのすべてのパターンに対して暗号文字を対応付けることができるように、暗号鍵テーブル210は、256のエントリーを有する。また、暗号鍵テーブル210の各エントリーは、平文データを暗号化する暗号化単位と同じ1バイト(8ビット)で構成され、そこで、各エントリーに格納される値(暗号鍵)は、他のエントリーと重複しない必要があるため、0から255の数(すなわち、8ビットのすべて(256通り)のビットパターン)となる。なお、本明細書では、平文文字や暗号文字などのように、「文字」という用語を便宜上用いているが、これらのデータはどのようなサイズのデータであってもよい。   Here, if plaintext data is encrypted using a plaintext character having a size of 1 byte (8 bits) as an encryption unit, the number of bit patterns represented by 8 bits is 256. The encryption key table 210 has 256 entries so that encryption characters can be associated with all patterns. Each entry of the encryption key table 210 is composed of the same 1 byte (8 bits) as the encryption unit for encrypting plaintext data, and the value (encryption key) stored in each entry is another entry. Therefore, the number is 0 to 255 (that is, all 8 bits (256 patterns)). In the present specification, the term “character” is used for convenience, such as plain text characters and encrypted characters, but these data may be data of any size.

また、本明細書では、最初の配列(エントリー)に格納されたデータを0番目のエントリーのデータ(または単に0番目のデータ)といった表現で表し、最後の配列(エントリー)を、たとえば256個の配列がある場合は、255番目のエントリーのデータ(または単に255番目のデータ)といった表現で表す。こうした表現は、暗号鍵テーブル210、復号鍵テーブル220、平文データ、および暗号文データで共通である。   Further, in this specification, data stored in the first array (entry) is represented by an expression such as data of the 0th entry (or simply 0th data), and the last array (entry) is represented by, for example, 256 pieces of data. When there is an array, it is expressed by an expression such as data of the 255th entry (or simply the 255th data). Such expressions are common to the encryption key table 210, the decryption key table 220, the plaintext data, and the ciphertext data.

復号化処理部120は、暗号文データ20の全部または一部を受け取ると、復号鍵テーブル220を参照して、受け取った暗号文データを、上述の平文文字と同じサイズの暗号文字単位で復号化し、この処理を必要に応じて繰り返し、最終的に復号化されたデータ(平文データ)を生成する。復号鍵テーブル220は、暗号鍵テーブル210と同様、所定の「2のn乗数」と同じ数の要素(エントリー)を備える配列であり、各エントリーには、他のエントリーと重複しない値(復号鍵)が格納される。各エントリーに格納される値は、暗号鍵テーブル210の各エントリーに格納された値に対して所定の関係を有したものとなっているが、詳細については後述する。   When receiving all or a part of the ciphertext data 20, the decryption processing unit 120 refers to the decryption key table 220 and decrypts the received ciphertext data in units of cipher characters having the same size as the above-described plaintext characters. This process is repeated as necessary, and finally decrypted data (plaintext data) is generated. Similarly to the encryption key table 210, the decryption key table 220 is an array including the same number of elements (entries) as a predetermined “n-th power of 2”, and each entry has a value (decryption key) that does not overlap with other entries. ) Is stored. The value stored in each entry has a predetermined relationship with the value stored in each entry of the encryption key table 210. Details will be described later.

上述のように、本発明の暗号化・復号化システム1は、制御部100、暗号化処理部110、および復号化処理部120を含むスタンドアロンコンピュータシステムとして構成することができるが、このような構成に限られるわけではない。たとえば、制御部100、および暗号化処理部110を備えた暗号化装置として、または、制御部100、および復号化処理部120を備えた復号化装置として個々に構成されうる。   As described above, the encryption / decryption system 1 of the present invention can be configured as a stand-alone computer system including the control unit 100, the encryption processing unit 110, and the decryption processing unit 120. It is not limited to. For example, it can be configured individually as an encryption device including the control unit 100 and the encryption processing unit 110, or as a decryption device including the control unit 100 and the decryption processing unit 120.

また、図1の暗号化・復号化システム1は、制御部100、暗号化処理部110、および復号化処理部120を、コンピュータプログラムによって実現する例を示したものであるが、制御部100、暗号化処理部110、復号化処理部120の所定の処理部分を回路により構成することもできる。   In addition, the encryption / decryption system 1 in FIG. 1 shows an example in which the control unit 100, the encryption processing unit 110, and the decryption processing unit 120 are realized by a computer program. Predetermined processing portions of the encryption processing unit 110 and the decryption processing unit 120 can be configured by circuits.

さらに、図1の暗号化・復号化システム1は、制御部100によって平文データ10や暗号文データ20の各処理部への提供等を制御しているが、当該制御処理を暗号化処理部110や復号化処理部120が行うように構成することもできる。また、図1に示す各処理部を1つの処理部が行うように構成することも可能である。   Further, in the encryption / decryption system 1 of FIG. 1, the control unit 100 controls the provision of the plaintext data 10 and the ciphertext data 20 to each processing unit, but the control processing is performed by the encryption processing unit 110. Alternatively, the decoding processing unit 120 may be configured to perform the processing. Further, each processing unit shown in FIG. 1 may be configured to be performed by one processing unit.

次に、図2のフローチャートを参照して、本発明の一実施形態に係る暗号化・復号化システム1の暗号化処理部110で実行される暗号化方法の基本的な例を説明する。まず、ステップS10において、受け取った平文データのサイズ(バイト数)が2のn乗数であるかどうかを判定する。サイズが2のn乗数であるかどうかは、たとえば、サイズと、当該サイズを負の数にしたもの(一般的には、2の補数表現)との論理積(AND演算)の結果が、サイズと同じかどうかを判定することによって把握される。この例では、1バイト(8ビット)単位、すなわち、1文字単位で暗号化が行われ、受け取った平文データは、サイズ(バイト数)と同じ数の要素(エントリー)を備える配列として扱われる。各要素には、1バイト(8ビット)のデータが格納されていることになる。   Next, a basic example of an encryption method executed by the encryption processing unit 110 of the encryption / decryption system 1 according to an embodiment of the present invention will be described with reference to the flowchart of FIG. First, in step S10, it is determined whether the size (number of bytes) of the received plaintext data is an n multiplier of 2. Whether the size is an n multiplier of 2 is determined by, for example, the result of logical product (AND operation) of the size and a negative number (generally, 2's complement representation) of the size. It is grasped by judging whether or not. In this example, encryption is performed in units of 1 byte (8 bits), that is, in units of 1 character, and the received plaintext data is handled as an array having the same number of elements (entries) as the size (number of bytes). Each element stores 1 byte (8 bits) of data.

ステップS10で、サイズが2のn乗数である場合、ステップS20に進み、ステップS20からステップS25までのループ1Aが実行される。図1に関して説明したように、制御部100によって平文データ10が2のn乗数のサイズでブロック化されて暗号化処理部110に提供されるので、ほとんどの平文データのブロックに関して、ループ1Aが実行されることになる。ループ1Aでは、1ずつ増加するカウンタcが、0から始まって、サイズから1を減じた数になるまで繰り返される。すなわち、カウンタcは、ループ1Aのそれぞれにおいて、2のn乗数のサイズの平文データを、最初のエントリーから最後のエントリーまで、順に1文字(1バイト文字)ずつ指し示すことになり、こうして指示された文字が1つずつ、当該ループにおいて暗号化の対象となる。   In step S10, when the size is an n multiplier of 2, the process proceeds to step S20, and the loop 1A from step S20 to step S25 is executed. As described with reference to FIG. 1, since the plaintext data 10 is blocked by the control unit 100 in a size of an n-multiplier of 2 and provided to the encryption processing unit 110, the loop 1A is executed for most plaintext data blocks. Will be. In the loop 1A, the counter c that is incremented by 1 starts from 0 and is repeated until it becomes a number obtained by subtracting 1 from the size. That is, in each of the loops 1A, the counter c indicates plaintext data having a size of 2 n multipliers, one character (one byte character) in order from the first entry to the last entry. One character at a time is subject to encryption in the loop.

次に、ステップS21において、インデックスiを決定する。インデックスiは、暗号化された平文データの1文字を格納する暗号文データのエントリーであり、これによって、平文データのc番目にある文字が暗号化され、暗号文データのi番目に格納されることが決定される。ここで、インデックスiは、平文データの各文字を、暗号文データの異なるエントリーにそれぞれ振り分けることができるように求められる必要があり、ここでは、カウンタcを平文データのサイズ(size)で割った余り(すなわち、c mod size)をインデックスiとしている。そして、これを求める計算式は、たとえば、カウンタcと、平文データのサイズから1を減じた数との論理積(AND演算)となる(すなわち、i=c&(size−1))。サイズが2のn乗数のときには、こうした計算式により、剰余を、除算を用いることなく求めることができるのであり、暗号化処理において、大きな負荷となる除算を使わないようにすることができる。   Next, in step S21, the index i is determined. The index i is an entry of ciphertext data that stores one character of the encrypted plaintext data, whereby the c-th character of the plaintext data is encrypted and stored in the i-th portion of the ciphertext data. It is decided. Here, the index i needs to be obtained so that each character of the plaintext data can be assigned to different entries of the ciphertext data. Here, the counter c is divided by the size (size) of the plaintext data. The remainder (that is, c mod size) is the index i. The calculation formula for obtaining this is, for example, the logical product (AND operation) of the counter c and the number obtained by subtracting 1 from the size of the plaintext data (that is, i = c & (size-1)). When the size is an n-multiplier of 2, it is possible to obtain a remainder without using division by such a calculation formula, and it is possible to avoid using a division that is a heavy load in the encryption processing.

その後、ステップS22において、平文データのc番目にある文字を平文文字hとして、ブロック化された平文データから抽出し、ステップS23において、その平文文字hに対応する暗号文字(暗号鍵)eを算出する。ここで、暗号文字eは、暗号鍵テーブルのh番目のエントリーに格納されているデータである。たとえば、平文文字hは、1バイト(8ビット)なので、ビット列のパターンとしては、0x00(「0x」は、その後の数が16進数であることを意味する)から0xFFまでの256通りが考えられる。これを、暗号鍵テーブルの0から255までの256個のエントリーのインデックスに対応付けるのである。平文データが、半角英数からなる英文データであるような場合は、平文文字hをASCIIコードのような1バイト系文字コードと考えることができるが、2バイト系文字コードが格納されていてもよいし、その他のどのようなデータであってもよい。   Thereafter, in step S22, the c-th character of the plaintext data is extracted from the plaintext data that has been blocked as the plaintext character h, and in step S23, an encrypted character (encryption key) e corresponding to the plaintext character h is calculated. To do. Here, the encryption character e is data stored in the h-th entry of the encryption key table. For example, since the plaintext character h is 1 byte (8 bits), there are 256 possible bit string patterns from 0x00 ("0x" means that the subsequent number is a hexadecimal number) to 0xFF. . This is associated with an index of 256 entries from 0 to 255 in the encryption key table. When the plaintext data is English data consisting of single-byte alphanumeric characters, the plaintext character h can be considered as a 1-byte character code such as an ASCII code, but even if a 2-byte character code is stored. It may be any other data.

したがって、平文文字hのビット列が0x42(10進数では66)であった場合、暗号鍵テーブルの66番目のエントリーに格納された文字が、平文文字hを暗合した結果として求められる。次に、ステップS24において、ステップS23で求められた暗号文字eが、暗号文データのi番目のエントリーに格納される。同様に、他の平文データの各文字についてステップS21からステップS24までの処理が繰り返される(ループ1A)。   Therefore, when the bit string of the plaintext character h is 0x42 (66 in decimal), the character stored in the 66th entry in the encryption key table is obtained as a result of the encryption of the plaintext character h. Next, in step S24, the cipher character e obtained in step S23 is stored in the i-th entry of the ciphertext data. Similarly, the processing from step S21 to step S24 is repeated for each character of other plaintext data (loop 1A).

一方、ステップS10で、サイズが2のn乗数でない場合、ステップS30に進み、ステップS30からステップS35までのループ1Bが実行される。図1に関して説明したように、制御部100によって平文データ10が2のn乗数のサイズでブロック化されて暗号化処理部110に送られてくるので、そのような制御により平文データが提供される場合は、平文データ10の暗号化処理において、多くても1回、ステップS10の判定がNOとなる。   On the other hand, if the size is not an n multiplier of 2 in step S10, the process proceeds to step S30, and the loop 1B from step S30 to step S35 is executed. As described with reference to FIG. 1, the plaintext data 10 is blocked by the control unit 100 in a size of 2n multipliers and sent to the encryption processing unit 110, so plaintext data is provided by such control. In this case, in the encryption processing of the plaintext data 10, the determination in step S10 is NO at most.

ループ1BのステップS31では、ループ1AのステップS21とは異なる計算式が用いられる。すなわち、ステップS31では、インデックスiを求める計算式が、(i=c%size)といったものとなり(「%」はcをsizeで割った余りを返す)、この場合は、除算が用いられることになる。   In step S31 of the loop 1B, a calculation formula different from that in step S21 of the loop 1A is used. That is, in step S31, the calculation formula for obtaining the index i is (i = c% size) (“%” returns the remainder obtained by dividing c by size). In this case, division is used. Become.

ループ1Bの他の部分は、ループ1Aと同じであるため、説明は省略する。図2のフローチャートに示すような処理手順により、暗号化処理において、計算量(処理時間)の観点から負荷の高い乗算や除算(とりわけ、除算について)の実行回数を大幅に減らすことができる。また、平文データ10が2のn乗数の倍数であったり、制御部100によって平文データ10が2のn乗数の倍数に調整されたりする場合は、ステップS31の処理は行われず、その場合、この暗号化処理では除算が全く使われないことになる。   Since the other part of the loop 1B is the same as the loop 1A, description is abbreviate | omitted. With the processing procedure shown in the flowchart of FIG. 2, the number of executions of heavy multiplication and division (particularly, division) can be significantly reduced from the viewpoint of calculation amount (processing time) in the encryption processing. Further, when the plaintext data 10 is a multiple of 2n multiplier or the plaintext data 10 is adjusted to a multiple of 2n multiplier by the control unit 100, the process of step S31 is not performed. In the encryption process, division is not used at all.

上述のように、本明細書の例では、平文データは、2のn乗数である256(バイト)のサイズにブロック化され、暗号化処理部110に提供されるが、他の2のn乗数(たとえば、1024や2048など)のサイズでブロック化されてもよい。また、この例では、平文データを1バイト(8ビット)といった暗号化単位で暗号化しているが、その他の暗号化単位(たとえば、4ビットや2バイトなど)で、暗号化を行うようにもできる。ただし、4ビット単位に暗号化を行う場合、暗号鍵テーブル210は、4ビットのビットパターンすべてに対応するように、16のエントリーを備え、各エントリーは4ビットで構成されることが好ましい。また、2バイト単位に暗号化を行う場合、暗号鍵テーブル210は、2バイトのビットパターンすべてに対応するように、65536のエントリーを備え、各エントリーは2バイトで構成されることが好ましい。また、この例では、2のn乗数のサイズの平文データが提供されたときに、乗算や除算を回避するような方法で演算が行われるが、本発明の暗号化・復号化システム1では、他にもいくつかの特徴を有しており、このような、乗算や除算を回避するための演算を必須とするものではない。   As described above, in the example of this specification, the plaintext data is blocked to a size of 256 (bytes), which is an n multiplier of 2, and is provided to the encryption processing unit 110. You may block by the size (for example, 1024, 2048, etc.). In this example, the plaintext data is encrypted with an encryption unit such as 1 byte (8 bits), but may be encrypted with another encryption unit (for example, 4 bits or 2 bytes). it can. However, when encryption is performed in units of 4 bits, the encryption key table 210 preferably includes 16 entries so as to correspond to all the 4-bit bit patterns, and each entry is preferably configured with 4 bits. When encryption is performed in units of 2 bytes, the encryption key table 210 preferably includes 65536 entries so as to correspond to all 2-byte bit patterns, and each entry is preferably configured with 2 bytes. In this example, when plaintext data having a size of 2n multiplier is provided, the calculation is performed in such a way as to avoid multiplication or division. In the encryption / decryption system 1 of the present invention, It has some other features and does not necessarily require such an operation to avoid multiplication and division.

次に、図3の例を参照して、図2のフローチャートに示した暗号化処理をより具体的に説明する。図3には、上から、平文データ、暗号鍵テーブル、暗号文データの順で、データの内容が表示され、最下部には、まとめとして、平文データと、その平文データを暗号化処理した結果得られた暗号文データが示されている。図中の矢印は、データの対応付けや操作対象等を表している。   Next, the encryption process shown in the flowchart of FIG. 2 will be described more specifically with reference to the example of FIG. In FIG. 3, the contents of the data are displayed in the order of plaintext data, encryption key table, and ciphertext data from the top, and the plaintext data and the result of encrypting the plaintext data as a summary at the bottom. The obtained ciphertext data is shown. Arrows in the figure indicate data association, operation targets, and the like.

この例では、平文データが256バイト単位でブロック化された後に提供され、平文データが256バイトである場合にループ1Aの処理が行われる。256バイトの平文データは、エントリー0からエントリー255までの256個のエントリーからなる配列である。その平文データには、ASCIIコードが格納され、所定のプログラムで表示または印刷を行うと、エントリー0から順に、「CBADFG・・・GFBA」といった文字が出力される。平文データを16進数で表現すると、エントリー0から順に、0x434241444647・・・47464241となる。ここでは、暗号化単位は1バイトであり、平文データが1バイトごとに暗号化される。   In this example, the plaintext data is provided after being blocked in units of 256 bytes, and when the plaintext data is 256 bytes, the process of loop 1A is performed. The 256-byte plaintext data is an array composed of 256 entries from entry 0 to entry 255. In the plaintext data, an ASCII code is stored, and when displayed or printed by a predetermined program, characters such as “CBADFG... GFBA” are output in order from entry 0. When the plaintext data is expressed in hexadecimal, it becomes 0x434424144647... Here, the encryption unit is 1 byte, and plaintext data is encrypted for each byte.

この平文データについて、図2のフローチャートに示した暗号化処理を実行する。まず、ループ1Aの第1ループでカウンタcが0の場合の暗号化処理が行われる。最初に、インデックスiが計算され(i=0 mod 256)、i=0が求められる(ステップS21)。次に、平文データのエントリー0が抽出される(ステップS22)。エントリー0には、0x43(文字「C」)のデータが格納されており、これは10進数にすると67である。ここで、暗号鍵テーブルの67番目のエントリーに格納されている文字「F」を暗号文字eとして決定する(ステップS23)。最後に、インデックスi=0により、「F」を暗号文データのエントリー0に格納する(ステップS24)。   The encryption processing shown in the flowchart of FIG. 2 is executed for this plaintext data. First, encryption processing is performed when the counter c is 0 in the first loop of the loop 1A. First, the index i is calculated (i = 0 mod 256), and i = 0 is obtained (step S21). Next, entry 0 of plaintext data is extracted (step S22). The entry 0 stores data of 0x43 (character “C”), which is 67 in decimal. Here, the character “F” stored in the 67th entry of the encryption key table is determined as the encryption character e (step S23). Finally, “F” is stored in entry 0 of the ciphertext data with index i = 0 (step S24).

次に、ループ1Aの第2ループでカウンタcが1の場合の暗号化処理が行われる。最初に、インデックスiが計算され(i=1 mod 256)、i=1が求められる(ステップS21)。次に、平文データのエントリー1が抽出される(ステップS22)。エントリー1には、0x42(文字「B」)のデータが格納されており、これは10進数にすると66である。ここで、暗号鍵テーブルの66番目のエントリーに格納されている文字「C」を暗号文字eとして決定する(ステップS23)。最後に、インデックスi=1により、「C」を暗号文データのエントリー1に格納する(ステップS24)。   Next, encryption processing is performed when the counter c is 1 in the second loop of the loop 1A. First, an index i is calculated (i = 1 mod 256), and i = 1 is obtained (step S21). Next, entry 1 of plaintext data is extracted (step S22). Entry 1 stores data of 0x42 (character “B”), which is 66 in decimal. Here, the character “C” stored in the 66th entry of the encryption key table is determined as the encryption character e (step S23). Finally, “C” is stored in entry 1 of the ciphertext data with index i = 1 (step S24).

以下、同様にループ1A内の処理を合計で256回繰り返すことにより、提供された256バイトの平文データのそれぞれの文字(バイトデータ)が、暗号鍵テーブルの対応する文字(バイトデータ)に置き換えられる(暗号化される)。平文データ内の各文字は、その文字のコードをインデックスとして暗号鍵テーブルにアクセスした場合に、対応する暗号鍵テーブルのエントリーに格納されている文字によって置き換えられる。この結果、平文データ「CBADFG・・・GFBA」は、図3の最下部に示すように、暗号文データ「FCBAEH・・・HECB」に暗号化される。また、提供された平文データが256バイトでない場合は、ループ1Bが実行されるが、上述のように、インデックスiを求める計算方法以外に異なるところはない。   Similarly, by repeating the process in the loop 1A 256 times in total, each character (byte data) of the 256-byte plaintext data provided is replaced with a corresponding character (byte data) in the encryption key table. (Encrypted). Each character in the plaintext data is replaced by the character stored in the corresponding encryption key table entry when the encryption key table is accessed using the character code as an index. As a result, the plaintext data “CBADFG... GFBA” is encrypted into ciphertext data “FCBAEH... HECB” as shown at the bottom of FIG. When the provided plaintext data is not 256 bytes, the loop 1B is executed, but there is no difference except for the calculation method for obtaining the index i as described above.

次に、図4を参照して、本発明で用いられる2つのビット演算の例について説明する。第1の演算例は、暗号化処理部110で、提供された平文データのサイズが2のn乗数であるかどうかを判定するための演算についてである。図2のステップS10では、平文データのサイズと、当該サイズを負の数にしたものとの論理積(AND演算)の結果が、平文データのサイズと同じであれば、そのサイズが2のn乗であると判断する。   Next, an example of two bit operations used in the present invention will be described with reference to FIG. The first calculation example is a calculation for determining whether or not the size of the provided plaintext data is an n multiplier of 2 in the encryption processing unit 110. In step S10 of FIG. 2, if the result of the logical product (AND operation) between the size of the plaintext data and the negative size is the same as the size of the plaintext data, the size is n. Judged to be a power.

図4Aは、ビット列Aとして示されているサイズが、256の値を有する場合のビット演算を示している。ビット列Bは、ビット列Aを負の数として表現している(2の補数表現)。ここで、ビット列Aとビット列Bの論理積(AND演算)を行うと、演算結果は、ビット列Aと同じであり、値256が2のn乗であることが分かる。   FIG. 4A shows bit operations when the size indicated as bit string A has 256 values. The bit string B represents the bit string A as a negative number (2's complement expression). Here, when a logical product (AND operation) of the bit string A and the bit string B is performed, it can be seen that the calculation result is the same as that of the bit string A, and the value 256 is 2 to the nth power.

図4Bは、ビット列Aとして示されているサイズが、258の値を有する場合のビット演算を示している。ビット列Bは、ビット列Aを負の数として表現している(2の補数表現)。ここで、ビット列Aとビット列Bの論理積(AND演算)を行うと、演算結果は、ビット列Aと同じにはならない。よって、値258が2のn乗でないことが分かる。   FIG. 4B shows bit operations when the size shown as bit string A has a value of 258. The bit string B represents the bit string A as a negative number (2's complement expression). Here, when the logical product (AND operation) of the bit string A and the bit string B is performed, the calculation result is not the same as that of the bit string A. Therefore, it can be seen that the value 258 is not 2 to the power of n.

図4Cは、ビット列Aとして示されているサイズが、128の値を有する場合のビット演算を示している。ビット列Bは、ビット列Aを負の数として表現している(2の補数表現)。ここで、ビット列Aとビット列Bの論理積(AND演算)を行うと、演算結果は、ビット列Aと同じであり、値128が2のn乗であることが分かる。   FIG. 4C shows bit operations when the size shown as the bit string A has a value of 128. The bit string B represents the bit string A as a negative number (2's complement expression). Here, when the logical product (AND operation) of the bit string A and the bit string B is performed, the calculation result is the same as that of the bit string A, and it can be seen that the value 128 is 2 to the nth power.

第2の演算例は、暗号化処理部110で、カウンタcを平文データのサイズで割った余りを求めるための演算についてである。図2のステップS21では、カウンタcと、平文データのサイズから1を減じた数との論理積(AND演算)の結果が、剰余(カウンタcを平文データのサイズで割った余り)であると判断する。   The second calculation example is a calculation for obtaining the remainder obtained by dividing the counter c by the size of the plain text data in the encryption processing unit 110. In step S21 of FIG. 2, the result of the logical product (AND operation) of the counter c and the number obtained by subtracting 1 from the size of the plaintext data is a remainder (the remainder obtained by dividing the counter c by the size of the plaintext data). to decide.

図4Dは、ビット列Aとして示されているカウンタcが、2の値を有する場合のビット演算を示している。ビット列Bは、平文データのサイズから1を減じた数255を表している。ここで、ビット列Aとビット列Bの論理積(AND演算)を行うと、演算結果は、2となり、2を256で割った余りとなっている。   FIG. 4D shows bit operations when the counter c shown as the bit string A has a value of 2. The bit string B represents a number 255 obtained by subtracting 1 from the size of the plain text data. Here, when the logical product (AND operation) of the bit string A and the bit string B is performed, the operation result is 2, and the remainder obtained by dividing 2 by 256 is obtained.

図4Eは、ビット列Aとして示されているカウンタcが、256の値を有する場合のビット演算を示している。ビット列Bは、平文データのサイズから1を減じた数255を表している。ここで、ビット列Aとビット列Bの論理積(AND演算)を行うと、演算結果は、0となり、256を256で割った余りとなっている。   FIG. 4E shows bit operation when the counter c shown as the bit string A has 256 values. The bit string B represents a number 255 obtained by subtracting 1 from the size of the plain text data. Here, when the logical product (AND operation) of the bit string A and the bit string B is performed, the operation result is 0, and the remainder is obtained by dividing 256 by 256.

次に、図5のフローチャートを参照して、本発明の一実施形態に係る暗号化・復号化システム1の暗号化処理部110で実行される別の暗号化方法の例を説明する。この例では、図2のフローチャートで示された暗号化方法が、パスの値の制御により、複数回繰り返されるようになっている。また、ここでも、暗号化単位は1バイトであり、平文データが1バイトごとに暗号化される。   Next, an example of another encryption method executed by the encryption processing unit 110 of the encryption / decryption system 1 according to an embodiment of the present invention will be described with reference to the flowchart of FIG. In this example, the encryption method shown in the flowchart of FIG. 2 is repeated a plurality of times by controlling the path value. Also in this case, the encryption unit is 1 byte, and plaintext data is encrypted for each byte.

まず、ステップS40において、パスpが0から3になるまで、4回繰り返される(ループ2A)。次に、ループ2Aにおける第2回目のループ以降で、暗号文データを平文データにコピーする。これは、ループ2Aにおける第1回目のループで、暗号化された平文データが暗号文データに格納されるので、第2回目以降のループでは、その暗号化されたデータをさらに暗号化するために、暗号文データを平文データとしてコピーし、この平文データに対してさらに暗号化処理を行うものである。   First, in step S40, the process is repeated four times (loop 2A) until the path p is changed from 0 to 3. Next, the ciphertext data is copied to the plaintext data after the second loop in the loop 2A. This is because the encrypted plaintext data is stored in the ciphertext data in the first loop in the loop 2A. In order to further encrypt the encrypted data in the second and subsequent loops. The ciphertext data is copied as plaintext data, and the plaintext data is further encrypted.

その後、図2のフローチャートで示された暗号化方法と同じ処理が行われる。ただし、インデックスiの計算(ステップS51、ステップS61)においては、カウンタcとパスpとの和を、平文データのサイズで割った余りがインデックスiとして求められる。そして、ステップS51においては、上述のように、除算を用いずにインデックスiが求められる。   Thereafter, the same processing as the encryption method shown in the flowchart of FIG. 2 is performed. However, in the calculation of the index i (steps S51 and S61), the remainder obtained by dividing the sum of the counter c and the path p by the size of the plaintext data is obtained as the index i. In step S51, as described above, the index i is obtained without using division.

次に、図6の例を参照して、図5のフローチャートに示した暗号化処理をより具体的に説明する。図6には、上から、平文データ、暗号鍵テーブル、暗号文データの順で、データの内容が表示され、最下部には、まとめとして、平文データと、その平文データをパス0で暗号化処理した結果得られた暗号文データ、さらにその暗号文データをパス1で暗号化処理した結果得られた暗号文データが示されている。図中の矢印は、データの対応付けや置き換え等を表している。   Next, the encryption process shown in the flowchart of FIG. 5 will be described more specifically with reference to the example of FIG. In FIG. 6, the contents of the data are displayed in the order of plaintext data, encryption key table, and ciphertext data from the top. At the bottom, the plaintext data and the plaintext data are encrypted with pass 0 as a summary. The ciphertext data obtained as a result of processing and the ciphertext data obtained as a result of encrypting the ciphertext data in pass 1 are shown. Arrows in the figure represent data association and replacement.

この例では、図5のループ2Aにおける第2回目のループの様子が示されており、提供された平文データは、すでに1回暗号化処理が行われた暗号文データ(図3に示された暗号文データと同じ)であり、エントリー0から順に、「FCBAEH・・・HECB」の文字が格納されている。また、この平文データを16進数で表現すると、エントリー0から順に、0x464342414548・・・48454342となる。   In this example, the state of the second loop in the loop 2A of FIG. 5 is shown, and the provided plaintext data has already been encrypted once (as shown in FIG. 3). The character “FCBAEH... HECB” is stored in order from the entry 0. Further, when this plaintext data is expressed in hexadecimal, it becomes 0x464434414548 ... 48454342 in order from entry 0.

この平文データについて、図5のフローチャートに示した暗号化処理のループ2A(第2ループ)におけるループ2Bを実行する。まず、ループ2Bの第1ループで、カウンタcが0でパスpが1の場合の暗号化処理が行われる。最初に、インデックスiが計算され(i=1 mod 256)、i=1が求められる(ステップS51)。次に、平文データのエントリー0が抽出される(ステップS52)。エントリー0には、0x46(文字「F」)のデータが格納されており、これは10進数にすると70である。ここで、暗号鍵テーブルの70番目のエントリーに格納されている文字「E」を暗号文字(暗号鍵)eとして決定する(ステップS53)。最後に、インデックスi=1により、「E」を暗号文データのエントリー1に格納する(ステップS54)。   For this plaintext data, the loop 2B in the loop 2A (second loop) of the encryption process shown in the flowchart of FIG. 5 is executed. First, encryption processing is performed when the counter c is 0 and the path p is 1 in the first loop of the loop 2B. First, an index i is calculated (i = 1 mod 256), and i = 1 is obtained (step S51). Next, entry 0 of plaintext data is extracted (step S52). Entry 0 stores data of 0x46 (character “F”), which is 70 in decimal. Here, the character “E” stored in the 70th entry of the encryption key table is determined as the encryption character (encryption key) e (step S53). Finally, “E” is stored in entry 1 of the ciphertext data with index i = 1 (step S54).

以下、同様に処理を繰り返し、ループ2A(第2ループ)におけるループ2Bの最終ループで、カウンタcが255でパスpが1の場合の暗号化処理が行われる。最初に、インデックスiが計算され(i=256 mod 256)、i=0が求められる(ステップS51)。次に、平文データのエントリー255が抽出される(ステップS52)。エントリー255には、0x42(文字「B」)のデータが格納されており、これは10進数にすると66である。ここで、暗号鍵テーブルの66番目のエントリーに格納されている文字「C」を暗号文字eとして決定する(ステップS53)。最後に、インデックスi=0により、「C」を暗号文データのエントリー0に格納する(ステップS54)。また、提供された平文データが256バイトでない場合は、ループ2Cが実行されるが、インデックスiを求める計算方法以外に異なるところはない。   Thereafter, the processing is repeated in the same manner, and encryption processing is performed when the counter c is 255 and the path p is 1 in the final loop of the loop 2B in the loop 2A (second loop). First, an index i is calculated (i = 256 mod 256), and i = 0 is obtained (step S51). Next, the plaintext data entry 255 is extracted (step S52). The entry 255 stores data of 0x42 (character “B”), which is 66 in decimal. Here, the character “C” stored in the 66th entry of the encryption key table is determined as the encryption character e (step S53). Finally, “C” is stored in entry 0 of the ciphertext data with index i = 0 (step S54). When the provided plaintext data is not 256 bytes, the loop 2C is executed, but there is no difference except for the calculation method for obtaining the index i.

この結果、平文データ「CBADFG・・・GFBA」は、図6の最下部に示すように、パスp=0の暗号化処理では、暗号文データ「FCBAEH・・・HECB」に暗号化され、パスp=1の暗号化処理では、さらに暗号文データ「CEFCBDG・・・GDF」に暗号化される。最終的に、図5に示すフローチャートの暗号化処理では、図2に示すフローチャートの暗号化処理が、パスp=0〜3まで4回繰り返して行われ、その都度、パスpによって、暗号化された平文データを暗号文データに格納する位置がシフトされる。   As a result, the plaintext data “CBADFG... GFBA” is encrypted into the ciphertext data “FCBAEH... HECB” in the encryption process with the path p = 0 as shown in the bottom of FIG. In the encryption process of p = 1, the ciphertext data “CEFCBDG... GDF” is further encrypted. Finally, in the encryption process of the flowchart shown in FIG. 5, the encryption process of the flowchart shown in FIG. 2 is repeated four times from the path p = 0 to 3, and is encrypted by the path p each time. The position where the plaintext data is stored in the ciphertext data is shifted.

このような暗号化処理を複数回繰り返すことによって、ビット変化率および強度の高い暗号が生成される。この例では、パスp=0から3として、暗号化処理を4回繰り返すようにしたが、当該回数は任意に設定することができる。ただし、当該回数を多くすると、好適なビット変化率が期待できる一方で、処理時間が長くなってしまうので注意が必要である。   By repeating such encryption processing a plurality of times, a cipher having a high bit change rate and high strength is generated. In this example, the encryption process is repeated four times with the path p = 0 to 3, but the number of times can be arbitrarily set. However, if the number of times is increased, a suitable bit change rate can be expected, but the processing time becomes longer.

次に、図7のフローチャートを参照して、本発明の一実施形態に係る暗号化・復号化システム1の暗号化処理部110で実行される、さらに別の暗号化方法の例を説明する。この例では、図5のフローチャートで示された暗号化方法と同様に、パスの値の制御により、図2のフローチャートで示された暗号化方法を繰り返すとともに、前のループで求められた暗号文字(暗号鍵)に依存する値(ベースB)を用いて暗号文字を計算するようにした。また、ここでも、暗号化単位は1バイトであり、平文データが1バイトごとに暗号化される。   Next, another example of the encryption method executed by the encryption processing unit 110 of the encryption / decryption system 1 according to an embodiment of the present invention will be described with reference to the flowchart of FIG. In this example, similar to the encryption method shown in the flowchart of FIG. 5, the encryption method shown in the flowchart of FIG. 2 is repeated by controlling the path value, and the encrypted character obtained in the previous loop is also obtained. Encryption characters are calculated using a value (base B) that depends on (encryption key). Also in this case, the encryption unit is 1 byte, and plaintext data is encrypted for each byte.

ベースBに関して、まず、ステップS84において、ベースB=パスpとして、ループ3B、ループ3Cを開始する前の初期設定を行う。そして、ベースBは、ループ3BのステップS93(または、ループ3CのステップS103)において、暗号文字eを求めるのに用いられる。すなわち、暗号文字e=暗号鍵テーブル[h]+Bにより求められる。さらに、ステップS93(またはステップS103)で求められたeが、ステップS94(またはステップS104)でベースBに代入され、次のループで、暗号文字eを求めるのに用いられる。このように、ベースBを用いることによって、暗号強度をさらに高めることが出来る。また、ここで、暗号文字eは、8ビットの格納領域であり、ベースBの加算によって値が255を越えた場合(桁あふれが生じた場合)は、再び0に戻ってラップアラウンドする。   Regarding the base B, first, in step S84, the base B is set as the path p, and initial setting before starting the loop 3B and the loop 3C is performed. Then, the base B is used to obtain the cipher character e in step S93 of the loop 3B (or step S103 of the loop 3C). That is, it is obtained by the encryption character e = encryption key table [h] + B. Further, e obtained in step S93 (or step S103) is substituted into the base B in step S94 (or step S104), and used for obtaining the cipher character e in the next loop. In this way, by using the base B, the encryption strength can be further increased. Here, the encryption character e is an 8-bit storage area, and when the value exceeds 255 by the addition of the base B (when overflow occurs), it returns to 0 again and wraps around.

次に、図8の例を参照して、図7のフローチャートに示した暗号化処理をより具体的に説明する。図8には、上から、平文データ、暗号鍵テーブル、暗号文データの順で、データの内容が表示され、最下部には、まとめとして、平文データと、その平文データを暗号化処理した結果得られた暗号文データが示されている。図中の矢印は、データの対応付けや置き換え等を表したものである。   Next, the encryption process shown in the flowchart of FIG. 7 will be described more specifically with reference to the example of FIG. In FIG. 8, the contents of the data are displayed in the order of plaintext data, encryption key table, and ciphertext data from the top, and the plaintext data and the result of encrypting the plaintext data as a summary at the bottom. The obtained ciphertext data is shown. The arrows in the figure represent data association and replacement.

この例では、平文データが256バイトでブロック化されて提供され、ループ3Bの処理が行われる。256バイトの平文データは、エントリー0からエントリー255までの256個のエントリーからなる配列である。その平文データには、ASCIIコードが格納され、所定のプログラムで表示または印刷を行うと、エントリー0から順に、「CBADFG・・・GFBA」といった文字が出力される。平文データを16進数で表現すると、エントリー0から順に、0x434241444647・・・47464241となる。   In this example, plain text data is provided in a block form of 256 bytes, and the process of loop 3B is performed. The 256-byte plaintext data is an array composed of 256 entries from entry 0 to entry 255. In the plaintext data, an ASCII code is stored, and when displayed or printed by a predetermined program, characters such as “CBADFG... GFBA” are output in order from entry 0. When the plaintext data is expressed in hexadecimal, it becomes 0x434424144647...

この平文データについて、図7のフローチャートに示した暗号化処理を実行する。まず、ループ3Aの第1ループで、カウンタcが0、パスPが0、ベースBが0の場合の暗号化処理が開始される。その後、ループ3Bに進み、インデックスiが計算され(i=0 mod 256)、i=0が求められる(ステップS91)。次に、平文データのエントリー0が抽出される(ステップS92)。エントリー0には、0x43(文字「C」)のデータが格納されており、これは10進数にすると67である。ここで、暗号鍵テーブルの67番目のエントリーに格納されているデータ0x46(文字「F」)とベースBを加算した値を暗号文字eとして決定する(ステップS93)。この場合、e=0x46+0x00=0x46(10進数で70)となる。次に、ベースBに0x46をセットする。そして最後に、インデックスi=0により、0x46(文字「F」)を暗号文データのエントリー0に格納する(ステップS95)。   The encryption processing shown in the flowchart of FIG. 7 is executed for this plaintext data. First, in the first loop of the loop 3A, the encryption process is started when the counter c is 0, the path P is 0, and the base B is 0. Thereafter, the process proceeds to loop 3B, the index i is calculated (i = 0 mod 256), and i = 0 is obtained (step S91). Next, entry 0 of plaintext data is extracted (step S92). The entry 0 stores data of 0x43 (character “C”), which is 67 in decimal. Here, a value obtained by adding the data 0x46 (character “F”) stored in the 67th entry of the encryption key table and the base B is determined as the encryption character e (step S93). In this case, e = 0x46 + 0x00 = 0x46 (decimal number 70). Next, 0x46 is set in the base B. Finally, 0x46 (character “F”) is stored in entry 0 of the ciphertext data with index i = 0 (step S95).

次に、ループ3Bの第2ループで、カウンタcが1、パスPが0、ベースBが0x70の場合の暗号化処理が行われる。最初に、インデックスiが計算され(i=1 mod 256)、i=1が求められる(ステップS91)。次に、平文データのエントリー1が抽出される(ステップS92)。エントリー1には、0x42(文字「B」)のデータが格納されており、これは10進数にすると66であり、ここで、暗号鍵テーブルの66番目のエントリーに格納されているデータ0x43(文字「C」)とベースBを加算した値を暗号文字eとして決定する(ステップS93)。この場合、e=0x43+0x46=0x89(10進数で137)となる。次に、ベースBに0x89をセットする。そして最後に、インデックスi=1により、0x89(文字「あ」)を暗号文データのエントリー1に格納する(ステップS95)。   Next, encryption processing is performed when the counter c is 1, the path P is 0, and the base B is 0x70 in the second loop of the loop 3B. First, an index i is calculated (i = 1 mod 256), and i = 1 is obtained (step S91). Next, entry 1 of plaintext data is extracted (step S92). Entry 1 stores data of 0x42 (character “B”), which is 66 in decimal. Here, data 0x43 (character) stored in the 66th entry in the encryption key table is stored. The value obtained by adding “C”) and the base B is determined as the encrypted character e (step S93). In this case, e = 0x43 + 0x46 = 0x89 (decimal number 137). Next, 0x89 is set in the base B. Finally, 0x89 (character “A”) is stored in entry 1 of the ciphertext data with index i = 1 (step S95).

以下、同様に処理を繰り返し、平文データ「CBADFG・・・GFBA」は、図8の最下部に示すように、パスp=0の暗号化処理では、暗号文データ「FあいうQえ・・・」に暗号化される(パスp=1以降の暗号化処理の結果は省略する)。このように、図5に示す暗号化処理と同様、暗号化処理がパスp=0〜3まで4回繰り返して行われ、その都度、パスpによって、暗号文データの格納位置がシフトされるとともに、ベースBによって、暗号文字が以前に求められた暗号文字に関連付けて求められる。このような暗号化処理を行うことによって、より強度の高い暗号が生成される。なお、図8では、暗号文データに格納された文字として「あ」「い」「う」「え」を例示しているが、これは便宜上の表示であり、実際のASCIIコードによる表示とは異なるものである。   Thereafter, the processing is repeated in the same manner, and the plaintext data “CBADFG... GFBA” is encrypted in the encryption process of the path p = 0 as shown in the lowermost part of FIG. (The result of the encryption process after the pass p = 1 is omitted). As described above, as in the encryption processing shown in FIG. 5, the encryption processing is repeated four times from pass p = 0 to 3, and each time the storage position of the ciphertext data is shifted by the pass p. The base B determines the cipher characters in association with the previously determined cipher characters. By performing such an encryption process, a stronger cipher is generated. In FIG. 8, “A”, “I”, “U”, and “E” are illustrated as characters stored in the ciphertext data. However, this is a display for convenience, and what is displayed by an actual ASCII code? Is different.

次に、図9のフローチャートを参照して、本発明の一実施形態に係る暗号化・復号化システム1の復号化処理について説明する。図9に示す復号化処理は、図7のフローチャートに示す暗号化処理によって生成された暗号文データを復号するものであり、提供された暗号文データを平文データに復号する。この復号化処理は、図7のフローチャートに示す暗号化処理と逆の手順を実行するものである。図2のフローチャートに示す暗号化処理に対応する復号化処理、図5のフローチャートに示す暗号化処理に対応する復号化処理は、いずれも、図9の復号化処理を一部省略することにより実現され、容易に類推可能であることから、ここでは詳細な説明を省略する。また、ここでは、上述した暗号化処理と同様に、復号化単位は1バイトであり、暗号文データが1バイトごとに復号化される。   Next, decryption processing of the encryption / decryption system 1 according to an embodiment of the present invention will be described with reference to the flowchart of FIG. The decryption process shown in FIG. 9 decrypts the ciphertext data generated by the encryption process shown in the flowchart of FIG. 7, and decrypts the provided ciphertext data into plaintext data. In this decryption process, the reverse procedure of the encryption process shown in the flowchart of FIG. 7 is executed. The decryption process corresponding to the encryption process shown in the flowchart of FIG. 2 and the decryption process corresponding to the encryption process shown in the flowchart of FIG. 5 are both realized by partially omitting the decryption process of FIG. Since it can be easily analogized, detailed description is omitted here. Here, as in the above-described encryption process, the decryption unit is 1 byte, and the ciphertext data is decrypted for each byte.

復号化処理は、ループ4Aで、パスp=3から0まで4回ループする(ステップS120〜ステップS150)。ループ4Aが開始されると、ステップS122で、最初のループのとき以外、すなわち、パスp<3のときに、平文データを暗号文データにコピーする。これは、図7のステップS82で、暗号文データを平文データにコピーした理由と同じである。次に、ステップS124において、ベースBにパスpがセットされる。   The decoding process loops 4 times from the path p = 3 to 0 in the loop 4A (steps S120 to S150). When the loop 4A is started, the plaintext data is copied to the ciphertext data in step S122 except for the case of the first loop, that is, when the path p <3. This is the same as the reason why the ciphertext data is copied to the plaintext data in step S82 of FIG. Next, in step S124, the path p is set in the base B.

その後、ステップS126において、提供された暗号文データのサイズが2のn乗数かどうかが判定される。ステップS126で、暗号文データのサイズが2のn乗数である場合、ステップS130に進み、ステップS130からステップS136までのループ4Bが実行される。図1に関して説明したように、制御部100によって暗号文データ20が2のn乗数のサイズでブロック化されて復号化処理部120に提供されるので、ほとんどの暗号文データのブロックに関して、ループ4Bが実行されることになる。ループ4Bでは、1ずつ増加するカウンタcが、0から始まって、暗号文データのサイズから1を減じた数になるまで繰り返される。すなわち、カウンタcは、各ループにおいて、2のn乗数のサイズの暗号文データを、最初のエントリーから最後のエントリーまで、順に1文字ずつ指し示すことになり、こうして指示された文字が1つずつ、当該ループにおいて復号化の対象となる。   Thereafter, in step S126, it is determined whether the size of the provided ciphertext data is an n multiplier of 2. If the size of the ciphertext data is an n multiplier of 2 in step S126, the process proceeds to step S130, and the loop 4B from step S130 to step S136 is executed. As described with reference to FIG. 1, since the ciphertext data 20 is blocked by the control unit 100 in a size of an n-multiplier of 2 and provided to the decryption processing unit 120, the loop 4B for most ciphertext data blocks is provided. Will be executed. In the loop 4B, the counter c incremented by 1 starts from 0 and is repeated until the number is obtained by subtracting 1 from the size of the ciphertext data. That is, in each loop, the counter c points to the ciphertext data having a size of 2 n multipliers one by one from the first entry to the last entry. In the loop, it becomes a target of decoding.

次に、ステップS131において、インデックスiを決定する。これによって、暗号文データのi番目にある文字が復号化され、平文データのc番目に格納されることが決定される。ここで、インデックスiは、カウンタcとパスpとの和を暗号文データのサイズ(size)で割った余り(すなわち、(c+p) mod size)である。そして、これを求める計算式は、暗号化処理と同様、i=(c+p)&(size−1)となり、除算を用いることなくこうした剰余を求めることができる。   Next, in step S131, an index i is determined. As a result, it is determined that the i-th character in the ciphertext data is decrypted and stored in the c-th plaintext data. Here, the index i is a remainder (that is, (c + p) mod size) obtained by dividing the sum of the counter c and the path p by the size (size) of the ciphertext data. The calculation formula for obtaining this is i = (c + p) & (size−1), as in the encryption process, and such a remainder can be obtained without using division.

その後、ステップS132において、暗号文データのi番目にある文字を暗号文字(暗号鍵)eとして抽出し、ステップS133において、その暗号文字eに対応する平文文字hを算出する。ここで、平文文字hは、復号鍵テーブルの(e−B)番目のエントリーに格納されているデータである。次に、ステップS134において、ベースBに暗号文字eがセットされる。   Thereafter, in step S132, the i-th character of the ciphertext data is extracted as an encrypted character (encryption key) e, and in step S133, a plaintext character h corresponding to the encrypted character e is calculated. Here, the plaintext character h is data stored in the (e-B) th entry of the decryption key table. Next, in step S134, the encryption character e is set in the base B.

次に、ステップS135において、ステップS133で求められた平文文字hが、平文データのc番目のエントリーに格納される。同様に、他の暗号文データの各文字についてステップS130からステップS136までの処理が繰り返される(ループ4B)。さらに、こうして復号化された平文データを暗号文データとして、次のパス(p=2,1,0)の復号化処理が行われる。   Next, in step S135, the plaintext character h obtained in step S133 is stored in the c-th entry of the plaintext data. Similarly, the processing from step S130 to step S136 is repeated for each character of the other ciphertext data (loop 4B). Further, the decryption processing of the next pass (p = 2, 1, 0) is performed using the decrypted plaintext data as ciphertext data.

一方、ステップS126で、暗号文データのサイズが2のn乗数でない場合、ステップS140に進み、ステップS140からステップS146までのループ4Cが実行される。図1に関して説明したように、制御部100によって暗号文データ20が2のn乗数のサイズでブロック化されて復号化処理部120に送られてくるので、そのような制御により暗号文データが提供される場合は、暗号文データ20の復号化処理において、多くても1回、ステップS126における判定がNOとなる。   On the other hand, if the size of the ciphertext data is not an n multiplier of 2 in step S126, the process proceeds to step S140, and the loop 4C from step S140 to step S146 is executed. As described with reference to FIG. 1, the ciphertext data 20 is blocked by the control unit 100 in the size of the n-th power of 2 and sent to the decryption processing unit 120, so that ciphertext data is provided by such control. In the case where the ciphertext data 20 is decrypted, the determination in step S126 is NO at most.

ループ4Bの処理とループ4Cの処理はほとんど同じであるが、ループ4BのステップS131では、インデックスiを求めるのに除算を用いないのに対し、ループ4CのステップS141では、インデックスiを求める計算式が、(i=c%size)といったものとなり(「%」はcをsizeで割った余りを返す)、除算が用いられる。   The processing of the loop 4B and the processing of the loop 4C are almost the same, but in step S131 of the loop 4B, division is not used to obtain the index i, whereas in step S141 of the loop 4C, the calculation formula for obtaining the index i. (I = c% size) (“%” returns the remainder of c divided by size), and division is used.

また、暗号文データ20が2のn乗数の倍数であったり、制御部100によって暗号文データ20が2のn乗数の倍数に調整されたりする場合は、ステップS141の処理は行われず、この復号化処理において除算が全く使われないことになる。   Further, when the ciphertext data 20 is a multiple of 2 n multipliers or the ciphertext data 20 is adjusted to a multiple of 2 n multipliers by the control unit 100, the process of step S141 is not performed and this decryption is performed. Division is not used at all.

次に、図10を参照して、図9のフローチャートに示した復号化処理を、より具体的に説明する。図10には、上から、暗号文データ、復号鍵テーブル、平文データの順で、データの内容が表示され、最下部には、まとめとして、暗号文データと、その暗号文データを復号化処理した結果得られた平文データが示されている。図中の矢印は、データの対応付けや置き換え等を表したものである。   Next, the decoding process shown in the flowchart of FIG. 9 will be described more specifically with reference to FIG. In FIG. 10, the data contents are displayed in the order of ciphertext data, decryption key table, and plaintext data from the top, and at the bottom, the ciphertext data and the ciphertext data are decrypted as a summary. The plaintext data obtained as a result is shown. The arrows in the figure represent data association and replacement.

この例では、暗号文データが256バイトでブロック化されて提供され、ループ4Bの処理が行われる。256バイトの暗号文データは、エントリー0からエントリー255までの256個のエントリーからなる配列である。その暗号文データには、ASCIIコードが格納され、所定のプログラムで表示または印刷を行うと、エントリー0から順に、「FあいうQえ・・・」といった文字が出力される。   In this example, the ciphertext data is provided by being blocked in 256 bytes, and the process of the loop 4B is performed. The 256-byte ciphertext data is an array composed of 256 entries from entry 0 to entry 255. In the ciphertext data, an ASCII code is stored. When displayed or printed by a predetermined program, characters such as “F that Q ...” are output in order from entry 0.

この暗号文データについて、図9のフローチャートに示した復号化処理を実行する。また、図10では、図9のループ4Aの第4ループで、カウンタcが0、パスPが0、ベースBが0の場合の復号化処理を示している。ループ4Aの第4ループが開始されると、処理はループ4Bに進み、そこでインデックスiが計算され(i=(0+0) mod 256)、i=0が求められる(ステップS131)。次に、暗号文データのエントリー0が暗号文字eとして抽出される(ステップS132)。エントリー0には、文字「F」のデータが格納されており、これは10進数にすると70である。ここで、この70からベースBが減算され(このとき、ベースBは0であるため、結果は70)、復号鍵テーブルの70番目のエントリーに格納されているデータ(文字「C」)が平文文字hとして決定される(ステップS133)。次に、ステップS134で、ベースBに暗号文字e(10進数の70)をセットする。そして最後に、インデックスc=0により、平文文字h(文字「C」)を平文データのエントリー0に格納する(ステップS135)。   For this ciphertext data, the decryption process shown in the flowchart of FIG. 9 is executed. FIG. 10 shows a decoding process when the counter c is 0, the path P is 0, and the base B is 0 in the fourth loop of the loop 4A in FIG. When the fourth loop of the loop 4A is started, the process proceeds to the loop 4B, where the index i is calculated (i = (0 + 0) mod 256), and i = 0 is obtained (step S131). Next, entry 0 of the ciphertext data is extracted as the cipher character e (step S132). Entry 0 stores data of character “F”, which is 70 in decimal. Here, base B is subtracted from 70 (the result is 70 because base B is 0 at this time), and the data (character “C”) stored in the 70th entry of the decryption key table is plaintext. The character h is determined (step S133). Next, in step S134, the encryption character e (decimal number 70) is set in the base B. Finally, the plaintext character h (character “C”) is stored in entry 0 of the plaintext data with the index c = 0 (step S135).

次に、ループ4Bの第2ループで、カウンタcが1、パスPが0、ベースBが70の場合の復号化処理が行われる。最初に、インデックスiが計算され(i=(1+0) mod 256)、i=1が求められる(ステップS131)。次に、暗号文データのエントリー1が暗号文字eとして抽出される(ステップS132)。エントリー1には、(文字「あ」)のデータが格納されており、これは10進数にすると137である。ここで、この137からベースB(70)が減算され(結果は67)、復号鍵テーブルの67番目のエントリーに格納されているデータ(文字「B」)が平文文字hとして決定される(ステップS133)。次に、ステップS134で、ベースBに暗号文字e(10進数の137)をセットする。そして最後に、インデックスc=1により、平文文字h(文字「B」)を平文データのエントリー1に格納する(ステップS135)。   Next, in the second loop of the loop 4B, decoding processing is performed when the counter c is 1, the path P is 0, and the base B is 70. First, an index i is calculated (i = (1 + 0) mod 256), and i = 1 is obtained (step S131). Next, entry 1 of the ciphertext data is extracted as the cipher character e (step S132). Entry 1 stores data of (character “A”), which is 137 in decimal. Here, base B (70) is subtracted from this 137 (result is 67), and the data (character “B”) stored in the 67th entry in the decryption key table is determined as plaintext character h (step). S133). Next, in step S134, the encryption character e (decimal number 137) is set in the base B. Finally, the plaintext character h (character “B”) is stored in entry 1 of the plaintext data with the index c = 1 (step S135).

以下、同様に処理を繰り返し、暗号文データ(パスp=1で得られた平文データ)「FあいうQえ・・・」は、図10の最下部に示すように、パスp=0の復号化処理で、平文データ「CBADFG・・・GFBA」に復号化される。この復号化処理は、ちょうど、図8で示した暗号化と逆のデータ変換になっている。なお、図10では、図8と同様、暗号文データに格納された文字として「あ」「い」「う」「え」を例示しているが、これは便宜上の表示であり、実際のASCIIコードによる表示とは異なるものである。   Thereafter, the processing is repeated in the same manner, and the ciphertext data (plaintext data obtained with the path p = 1) “F that Qe ...” is decrypted with the path p = 0 as shown at the bottom of FIG. The plaintext data “CBADFG... GFBA” is decrypted by the conversion processing. This decryption processing is just data conversion opposite to the encryption shown in FIG. In FIG. 10, as in FIG. 8, “a”, “i”, “u”, “e” are illustrated as characters stored in the ciphertext data, but this is a display for convenience and actual ASCII. It is different from the code display.

次に、図11を参照して、暗号鍵テーブル210を作成する処理の一例について説明する。暗号鍵テーブル210の各エントリーには、他のエントリーとは異なるユニークな値が格納されていればよく、この図に示すようなシャッフルによって暗号鍵テーブル210を作成する方法は一例に過ぎない。たとえば、ランダムな値をエントリーごとに生成し、値が重複した場合には、値の生成をやり直すようにしても同様のテーブルを作成できるし、エントリー順に1ずつ増加する(あるいは1ずつ減少する)数字を単純に格納していくようにして生成することもできる。   Next, an example of processing for creating the encryption key table 210 will be described with reference to FIG. Each entry of the encryption key table 210 only needs to store a unique value different from other entries, and the method of creating the encryption key table 210 by shuffling as shown in this figure is merely an example. For example, if a random value is generated for each entry and the value is duplicated, a similar table can be created even if the value is generated again, and it is incremented by 1 (or decreased by 1) in the order of entry. It can also be generated by simply storing numbers.

図11Aのフローチャートは、暗号鍵テーブル210を作成する処理手順を示すものである。この例では、暗号鍵テーブル210が、エントリー0からエントリー255までの256のエントリーを有し、初期状態では、0から255までの数字が、エントリー順に格納されているものとする。また、共通鍵テーブルは、暗号鍵テーブル210と同様、256のエントリーを有し、各エントリーには、他のエントリーとは異なるユニークな値(ここでは、0から255までの整数)が不規則に格納されている。   The flowchart in FIG. 11A shows a processing procedure for creating the encryption key table 210. In this example, the encryption key table 210 has 256 entries from entry 0 to entry 255, and in the initial state, numbers from 0 to 255 are stored in the order of entry. The common key table, like the encryption key table 210, has 256 entries, and each entry is randomly assigned a unique value (an integer from 0 to 255 in this case) different from the other entries. Stored.

この状態で、ステップS160からステップS164までの処理が、インデックスi=0から255まで、256回繰り返される(ループ5)。ループ5に入ると、ステップS162で、暗号鍵のシャッフルが行われる。すなわち、ここで、暗号鍵テーブル210のi番目のエントリーに格納された値と、暗号鍵テーブル210のj番目のエントリーに格納された値が交換される。ここで、jは、共通鍵テーブルのi番目のエントリーに格納された値である。   In this state, the processing from step S160 to step S164 is repeated 256 times from index i = 0 to 255 (loop 5). When the loop 5 is entered, the encryption key is shuffled in step S162. That is, here, the value stored in the i-th entry of the encryption key table 210 and the value stored in the j-th entry of the encryption key table 210 are exchanged. Here, j is a value stored in the i-th entry of the common key table.

次に、図11Bを参照して、暗号鍵テーブル210を作成する処理手順の例をより具体的に説明する。ここでは、共通鍵テーブルと暗号鍵テーブル210はともに、エントリー0からエントリー4までの5つのエントリーを有する。また、共通鍵テーブルは、エントリー0から順に、3、4、1、2、0の各値を格納し、暗号鍵テーブル210は、初期状態、すなわちシャッフル前では、エントリー0から順に、0、1、2、3、4の各値を格納している。   Next, an example of a processing procedure for creating the encryption key table 210 will be described more specifically with reference to FIG. 11B. Here, both the common key table and the encryption key table 210 have five entries from entry 0 to entry 4. The common key table stores values 3, 4, 1, 2, 0 in order from entry 0, and the encryption key table 210 stores 0, 1 in order from entry 0 in the initial state, that is, before shuffling. Each value of 2, 3, 4 is stored.

ループ5の第1ループ(シャッフル(1))で、暗号鍵テーブル210の0番目のエントリーに格納された値「0」と、暗号鍵テーブル210の3番目(3は、共通鍵テーブルの0番目のエントリーに格納された値)のエントリーに格納された値「3」を交換する。次に、ループ5の第2ループ(シャッフル(2))で、暗号鍵テーブル210の1番目のエントリーに格納された値「1」と、暗号鍵テーブル210の4番目(4は、共通鍵テーブルの1番目のエントリーに格納された値)のエントリーに格納された値「4」を交換する。   In the first loop (shuffle (1)) of loop 5, the value “0” stored in the 0th entry of the encryption key table 210 and the 3rd (3 is the 0th of the common key table) of the encryption key table 210. The value “3” stored in the entry) is exchanged. Next, in the second loop (shuffle (2)) of the loop 5, the value “1” stored in the first entry of the encryption key table 210 and the fourth (4 is the common key table) of the encryption key table 210. The value “4” stored in the first entry) is exchanged.

次に、ループ5の第3ループ(シャッフル(3))で、暗号鍵テーブル210の2番目のエントリーに格納された値「2」と、暗号鍵テーブル210の1番目(1は、共通鍵テーブルの2番目のエントリーに格納された値)のエントリーに格納された値「4」を交換する。次に、ループ5の第4ループ(シャッフル(4))で、暗号鍵テーブル210の3番目のエントリーに格納された値「0」と、暗号鍵テーブル210の2番目(2は、共通鍵テーブルの3番目のエントリーに格納された値)のエントリーに格納された値「4」を交換する。   Next, in the third loop (shuffle (3)) of loop 5, the value “2” stored in the second entry of the encryption key table 210 and the first (1 is the common key table) of the encryption key table 210. The value “4” stored in the second entry) is exchanged. Next, in the fourth loop of loop 5 (shuffle (4)), the value “0” stored in the third entry of the encryption key table 210 and the second (2 is the common key table) of the encryption key table 210. The value “4” stored in the third entry) is exchanged.

最後に、ループ5の第5ループ(シャッフル(5))で、暗号鍵テーブル210の4番目のエントリーに格納された値「1」と、暗号鍵テーブル210の0番目(0は、共通鍵テーブルの4番目のエントリーに格納された値)のエントリーに格納された値「3」を交換する。このシャッフルの結果をまとめると、シャッフル後の暗号鍵テーブル210は、エントリー0から順に、1、2、0、4、3となる。   Finally, in the fifth loop (shuffle (5)) of loop 5, the value “1” stored in the fourth entry of the encryption key table 210 and the 0th (0 is the common key table) of the encryption key table 210 The value “3” stored in the fourth entry) is exchanged. To summarize the shuffle results, the shuffled cipher key table 210 is 1, 2, 0, 4, 3 in order from entry 0.

次に、図12を参照して、復号鍵テーブル220を作成する処理の一例について説明する。復号鍵テーブル220の各エントリーには、暗号鍵テーブル210と同様、他のエントリーとは異なるユニークな値が格納されている必要があり、さらに、対応する暗号鍵テーブル210を元に、一定の規則で作成されなければならない。   Next, an example of processing for creating the decryption key table 220 will be described with reference to FIG. Each entry of the decryption key table 220 needs to store a unique value different from the other entries as in the encryption key table 210. Furthermore, based on the corresponding encryption key table 210, a certain rule is stored. Must be created with.

図12Aのフローチャートは、復号鍵テーブル220を作成する処理手順を示したものである。この例では、暗号鍵テーブル210と復号鍵テーブル220がそれぞれ、エントリー0からエントリー255までの256のエントリーを有しているものとする。そして暗号鍵テーブル210の各エントリーには、図11Aのフローチャートに示す処理によって、他のエントリーとは異なるユニークな値(ここでは、0から255までの整数)が格納されているものとする。その状態で、ステップS170からステップS174までの処理が、インデックスi=0から255まで、256回繰り返される(ループ6)。ループ6に入ると、ステップS172で、復号鍵のセットが行われる。すなわち、復号鍵テーブル220のj番目のエントリーに、iの値そのものが格納される。ここで、jは、暗号鍵テーブル210のi番目のエントリーに格納されている値(すなわち、0から255までのどれかひとつ)である。   The flowchart in FIG. 12A shows a processing procedure for creating the decryption key table 220. In this example, it is assumed that the encryption key table 210 and the decryption key table 220 have 256 entries from entry 0 to entry 255, respectively. Each entry of the encryption key table 210 is assumed to store a unique value (in this case, an integer from 0 to 255) different from the other entries by the process shown in the flowchart of FIG. 11A. In this state, the processing from step S170 to step S174 is repeated 256 times from index i = 0 to 255 (loop 6). When loop 6 is entered, a decryption key is set in step S172. That is, the i value itself is stored in the j-th entry of the decryption key table 220. Here, j is a value (that is, any one of 0 to 255) stored in the i-th entry of the encryption key table 210.

次に、図12Bを参照して、復号鍵テーブル220を作成する処理手順の例をより具体的に説明する。ここでは、暗号鍵テーブル210と復号鍵テーブル220はともに、エントリー0からエントリー4までの5つのエントリーを有する。また、暗号鍵テーブル210はシャッフルにより、エントリー0から順に、1、2、0、4、3の各値を格納しており、復号鍵テーブル220の各エントリーには、なにも格納されていない状態である。   Next, an example of a processing procedure for creating the decryption key table 220 will be described more specifically with reference to FIG. 12B. Here, both the encryption key table 210 and the decryption key table 220 have five entries from entry 0 to entry 4. Also, the encryption key table 210 stores values 1, 2, 0, 4, 3 in order from entry 0 by shuffling, and nothing is stored in each entry of the decryption key table 220. State.

ループ6の第1ループ(セット(1))で、復号鍵テーブル220の1番目(1は、暗号鍵テーブル210の0番目に格納されている値)のエントリーに、値「0」がセットされる。次に、ループ6の第2ループ(セット(2))で、復号鍵テーブル220の2番目(2は、暗号鍵テーブル210の1番目に格納されている値)のエントリーに、値「1」がセットされ、ループ6の第3ループ(セット(3))で、復号鍵テーブル220の0番目(0は、暗号鍵テーブル210の2番目に格納されている値)のエントリーに、値「2」がセットされる。   In the first loop of loop 6 (set (1)), the value “0” is set in the first entry (1 is the value stored in the 0th of the encryption key table 210) of the decryption key table 220. The Next, in the second loop (set (2)) of the loop 6, the value “1” is entered in the second entry (2 is the first value stored in the encryption key table 210) of the decryption key table 220. In the third loop of loop 6 (set (3)), the value “2” is entered in the 0th entry of the decryption key table 220 (0 is the second value stored in the encryption key table 210). Is set.

その後、ループ6の第4ループ(セット(4))で、復号鍵テーブル220の4番目(4は、暗号鍵テーブル210の3番目に格納されている値)のエントリーに、値「3」がセットされ、次に、ループ6の第5ループ(セット(5))で、復号鍵テーブル220の3番目(3は、暗号鍵テーブル210の4番目に格納されている値)のエントリーに、値「4」がセットされる。この処理の結果をまとめると、最終的な復号鍵テーブル220は、エントリー0から順に、2、0、1、4、3となる。   Thereafter, in the fourth loop (set (4)) of the loop 6, the value “3” is entered in the fourth entry (4 is the third value stored in the encryption key table 210) of the decryption key table 220. Next, in the fifth loop of loop 6 (set (5)), a value is entered in the third entry of the decryption key table 220 (3 is the fourth value stored in the encryption key table 210). “4” is set. To summarize the results of this process, the final decryption key table 220 is 2, 0, 1, 4, 3 in order from entry 0.

このように、復号鍵テーブル220の各エントリーに格納される値は、暗号鍵テーブル210の各エントリーに格納された値に対して、上記のような所定の関係をもって求められ、セットされる。すなわち、復号鍵テーブル220では、データの格納位置を示す値(エントリーを表す値)数と、当該エントリーに格納されている値との関係が、暗号鍵テーブル210とは逆になっている。たとえば、図12Bの例では、復号鍵テーブル220のエントリー「0」には値「2」が格納され、暗号鍵テーブル210のエントリー「2」には値「0」が格納される。   As described above, the value stored in each entry of the decryption key table 220 is obtained and set with the predetermined relationship as described above with respect to the value stored in each entry of the encryption key table 210. That is, in the decryption key table 220, the relationship between the number of values indicating data storage positions (values representing entries) and the values stored in the entries is opposite to that of the encryption key table 210. For example, in the example of FIG. 12B, the value “2” is stored in the entry “0” of the decryption key table 220, and the value “0” is stored in the entry “2” of the encryption key table 210.

そして、暗号鍵テーブル210と復号鍵テーブル220をこのような関係で準備しておくことにより、図10に示すように、暗号鍵テーブル210を用いて暗号化した暗号文データ20を、復号鍵テーブル220を用いて平文データ10に復号化することができる。   Then, by preparing the encryption key table 210 and the decryption key table 220 in such a relationship, as shown in FIG. 10, the encrypted text data 20 encrypted using the encryption key table 210 is converted into the decryption key table. 220 can be used to decrypt the plaintext data 10.

次に、図13を参照して、本発明の暗号化・復号化システム1を実現するコンピュータのハードウエア構成の例について説明する。ただし、図13のコンピュータ300は、暗号化・復号化システム1を実現するためのコンピュータとして代表的な構成を例示したにすぎない。また、暗号化・復号化システム1を、暗号化装置および復号化装置といった、処理ごとの個別のコンピュータで構成することもできるが、これらのコンピュータも同様の構成要素により構成される。また、本発明の暗号化・復号化システム1は、パーソナルコンピュータ(デスクトップタイプ、ノートタイプ)、携帯電話機、PDA、メモリーカード、ICカードなど、CPUを備えた様々なタイプのコンピュータによって実現可能である。   Next, an example of the hardware configuration of a computer that implements the encryption / decryption system 1 of the present invention will be described with reference to FIG. However, the computer 300 in FIG. 13 merely illustrates a typical configuration as a computer for realizing the encryption / decryption system 1. The encryption / decryption system 1 can also be configured by individual computers for each process, such as an encryption device and a decryption device, and these computers are also configured by similar components. Further, the encryption / decryption system 1 of the present invention can be realized by various types of computers including a CPU, such as a personal computer (desktop type, notebook type), a mobile phone, a PDA, a memory card, and an IC card. .

コンピュータ300は、CPU(Central Processing Unit)301、メモリ302、音声出力装置303、ネットワークインタフェース304、ディスプレイコントローラ305、ディスプレイ306、入力機器インタフェース307、キーボード308、マウス309、外部記憶装置310、外部記録媒体駆動装置311、およびこれらの構成要素を互いに接続するバス312を含んでいる。   The computer 300 includes a CPU (Central Processing Unit) 301, a memory 302, an audio output device 303, a network interface 304, a display controller 305, a display 306, an input device interface 307, a keyboard 308, a mouse 309, an external storage device 310, and an external recording medium. It includes a drive 311 and a bus 312 that connects these components to each other.

CPU301は、コンピュータ300の各構成要素の動作を制御し、OSの制御下で、本発明に係る暗号化・復号化システム1の機能を実行する。たとえば、制御部100における平文データ10や暗号文データ20のハンドリング、暗号化処理部110における暗号化処理、および復号化処理部120における復号化処理を制御する。   The CPU 301 controls the operation of each component of the computer 300, and executes the functions of the encryption / decryption system 1 according to the present invention under the control of the OS. For example, the control unit 100 controls the handling of the plaintext data 10 and the ciphertext data 20, the encryption processing in the encryption processing unit 110, and the decryption processing in the decryption processing unit 120.

メモリ302は通常、不揮発性メモリであるROM(Read Only Memory)、および揮発性メモリであるRAM(Random Access Memory)から構成される。ROMには、コンピュータ300の起動時に実行されるプログラム等が格納される。RAMには、CPU301で実行される各機能を実現するためのプログラムや、それらのプログラムが実行中に使用するデータが一時的に格納される。   The memory 302 is generally composed of a ROM (Read Only Memory) that is a nonvolatile memory and a RAM (Random Access Memory) that is a volatile memory. The ROM stores a program executed when the computer 300 is started up. The RAM temporarily stores programs for realizing the functions executed by the CPU 301 and data used during the execution of these programs.

音声出力装置303は、たとえば、スピーカ等の機器であり、動画プレイヤー等から音声データを受け取り、音声を出力する。ネットワークインタフェース304は、ネットワーク320に接続するためのインタフェースである。ネットワーク320は、たとえば、LANやインターネットといったネットワークである。   The audio output device 303 is, for example, a device such as a speaker, and receives audio data from a video player or the like and outputs audio. The network interface 304 is an interface for connecting to the network 320. The network 320 is a network such as a LAN or the Internet, for example.

ディスプレイコントローラ305は、CPU301が発行する描画命令を実際に処理するための専用コントローラである。ディスプレイコントローラ305で処理された描画データは、一旦グラフィックメモリに書き込まれ、その後、ディスプレイ306に出力される。ディスプレイ306は、たとえば、LCD(Liquid Crystal Display)やCRT(Cathode Ray Tube)で構成される表示装置である。   The display controller 305 is a dedicated controller for actually processing a drawing command issued by the CPU 301. The drawing data processed by the display controller 305 is once written in the graphic memory and then output to the display 306. The display 306 is a display device configured by, for example, an LCD (Liquid Crystal Display) or a CRT (Cathode Ray Tube).

入力機器インタフェース307は、キーボード308やマウス309から入力された信号を受信して、その信号パターンに応じて所定の指令をCPU301に送信する。   The input device interface 307 receives a signal input from the keyboard 308 or the mouse 309 and transmits a predetermined command to the CPU 301 according to the signal pattern.

外部記憶装置310は、たとえば、ハードディスクドライブ(HDD)のような記憶装置であり、この装置内には上述したプログラムやデータが記録され、実行時に、必要に応じてそこからメモリ302のRAMにロードされる。たとえば、暗号鍵テーブル210や復号鍵テーブル220がこの記憶装置に格納される。   The external storage device 310 is, for example, a storage device such as a hard disk drive (HDD), in which the above-described programs and data are recorded, and loaded from there to the RAM of the memory 302 as necessary at the time of execution. Is done. For example, the encryption key table 210 and the decryption key table 220 are stored in this storage device.

外部記録媒体駆動装置311は、CD(Compact Disc)、MO(Magneto-Optical Disc)、DVD(Digital Versatile Disc)などの可搬型の外部記録媒体330の記録面にアクセスして、そこに記録されているデータを読み取る装置である。外部記録媒体330には、本発明に係る暗号化・復号化システム1を実現するための暗号化プログラムや復号化プログラムを記録することも可能である。外部記録媒体330に記録されているデータは、外部記録媒体駆動装置311を介して外部記憶装置310に格納され、プログラムであれば、実行時にメモリ302のRAMにロードされる。   The external recording medium driving device 311 accesses the recording surface of a portable external recording medium 330 such as a CD (Compact Disc), an MO (Magneto-Optical Disc), or a DVD (Digital Versatile Disc) and is recorded there. It is a device that reads data. The external recording medium 330 can also record an encryption program and a decryption program for realizing the encryption / decryption system 1 according to the present invention. Data recorded in the external recording medium 330 is stored in the external storage device 310 via the external recording medium driving device 311. If it is a program, it is loaded into the RAM of the memory 302 at the time of execution.

本発明に係る暗号化・復号化システム1を実現するためのプログラムの他の流通形態としては、ネットワーク上の所定のサーバから、ネットワーク320およびネットワークインタフェース304を介して外部記憶装置310に格納されるというルート等も考えられる。こうして格納されたプログラムは、上記と同様に、実行時にメモリ302のRAMにロードされ、実行される。   As another distribution form of the program for realizing the encryption / decryption system 1 according to the present invention, it is stored in the external storage device 310 via a network 320 and a network interface 304 from a predetermined server on the network. Such routes are also conceivable. The program stored in this manner is loaded into the RAM of the memory 302 at the time of execution and executed in the same manner as described above.

たとえば、コンピュータ300のユーザは、キーボード308等を用いて平文データ10を入力することにより、当該データを暗号化処理部110に提供することができる。他方、復号化処理部120は、ユーザの指示に基づき、出力した平文データ10をディスプレイ306に表示したり、外部記憶装置310に記憶したりする。   For example, the user of the computer 300 can provide the data to the encryption processing unit 110 by inputting the plaintext data 10 using the keyboard 308 or the like. On the other hand, the decryption processing unit 120 displays the output plaintext data 10 on the display 306 or stores it in the external storage device 310 based on a user instruction.

また、前述のように、本発明に係る暗号化・復号化システム1を、こうしたプログラムベースのコンピュータシステムを用いずに、回路によって構成することもできる。   Further, as described above, the encryption / decryption system 1 according to the present invention can be configured by a circuit without using such a program-based computer system.

本発明の一実施形態に係る暗号化・復号化システムの概要を示す機能ブロック図である。It is a functional block diagram which shows the outline | summary of the encryption / decryption system which concerns on one Embodiment of this invention. 本発明の一実施形態に係る暗号化・復号化システムにおいて実行される暗号化処理の一例を示すフローチャートである。It is a flowchart which shows an example of the encryption process performed in the encryption / decryption system which concerns on one Embodiment of this invention. 図2のフローチャートに示す暗号化処理によって、平文データが暗号化されていく過程を示した略線図である。FIG. 3 is a schematic diagram illustrating a process in which plaintext data is encrypted by the encryption processing illustrated in the flowchart of FIG. 2. 本発明の一実施形態に係る暗号化・復号化システムで用いられるビット演算の例を示す略線図である。It is a basic diagram which shows the example of the bit operation used with the encryption / decryption system which concerns on one Embodiment of this invention. 本発明の一実施形態に係る暗号化・復号化システムにおいて実行される暗号化処理の別の例を示すフローチャートである。It is a flowchart which shows another example of the encryption process performed in the encryption / decryption system which concerns on one Embodiment of this invention. 図5のフローチャートに示す暗号化処理によって、平文データが暗号化されていく過程を示した略線図である。FIG. 6 is a schematic diagram showing a process in which plaintext data is encrypted by the encryption processing shown in the flowchart of FIG. 5. 本発明の一実施形態に係る暗号化・復号化システムにおいて実行される暗号化処理のさらに別の例を示すフローチャートである。It is a flowchart which shows another example of the encryption process performed in the encryption / decryption system which concerns on one Embodiment of this invention. 図7のフローチャートに示す暗号化処理によって、平文データが暗号化されていく過程を示した略線図である。It is a basic diagram which showed the process in which plaintext data is encrypted by the encryption process shown in the flowchart of FIG. 本発明の一実施形態に係る暗号化・復号化システムにおいて実行される復号化処理の例を示すフローチャートである。It is a flowchart which shows the example of the decoding process performed in the encryption / decryption system which concerns on one Embodiment of this invention. 図9のフローチャートに示す暗号化処理によって、暗号文データが復号化されていく過程を示した略線図である。FIG. 10 is a schematic diagram illustrating a process in which ciphertext data is decrypted by the encryption processing illustrated in the flowchart of FIG. 9. 本発明の一実施形態に係る暗号化・復号化システムで用いられる暗号鍵テーブルを作成するためのフローチャートと、暗号鍵テーブルが作成される過程を示した略線図である。It is the basic diagram which showed the flowchart for producing the encryption key table used with the encryption / decryption system which concerns on one Embodiment of this invention, and the process in which an encryption key table is created. 本発明の一実施形態に係る暗号化・復号化システムで用いられる復号鍵テーブルを作成するためのフローチャートと、復号鍵テーブルが作成される過程を示した略線図である。FIG. 5 is a flowchart for creating a decryption key table used in the encryption / decryption system according to an embodiment of the present invention, and a schematic diagram showing a process of creating the decryption key table. 本発明の一実施形態に係る暗号化・復号化システムを構成するコンピュータのハードウエア構成の例を示す略線図である。It is a basic diagram which shows the example of the hardware constitutions of the computer which comprises the encryption / decryption system which concerns on one Embodiment of this invention.

1・・・暗号化・復号化システム、10・・・平文データ、20・・・暗号文データ、100・・・制御部、110・・・暗号化処理部、120・・・復号化処理部、210・・・暗号鍵テーブル、220・・・復号鍵テーブル、300・・・コンピュータ、301・・・CPU、302・・・メモリ、303・・・音声出力装置、304・・・ネットワークインタフェース、305・・・ディスプレイコントローラ、306・・・ディスプレイ、307・・・入力機器インタフェース、308・・・キーボード、309・・・マウス、310・・・外部記憶装置、311・・・外部記録媒体駆動装置、312・・・バス、320・・・ネットワーク、330・・・外部記録媒体 DESCRIPTION OF SYMBOLS 1 ... Encryption / decryption system, 10 ... Plaintext data, 20 ... Ciphertext data, 100 ... Control part, 110 ... Encryption processing part, 120 ... Decryption processing part , 210 ... Encryption key table, 220 ... Decryption key table, 300 ... Computer, 301 ... CPU, 302 ... Memory, 303 ... Audio output device, 304 ... Network interface, 305 ... Display controller, 306 ... Display, 307 ... Input device interface, 308 ... Keyboard, 309 ... Mouse, 310 ... External storage device, 311 ... External recording medium drive device 312 ... Bus 320 ... Network 330 ... External recording medium

Claims (9)

各エントリーに、それぞれ異なる暗号鍵を格納する暗号鍵テーブルと、
平文データを、平文文字単位で暗号化し暗号文データを生成する暗号化処理を行う暗号化手段とを備え、
前記暗号化手段による暗号化処理は、
前記平文データから、順次平文文字を抽出し、
前記平文文字の内容に基づいて、暗号鍵テーブルのエントリーの順番を決定し、
決定された前記順番のエントリーに記憶される前記暗号鍵テーブルの値と、以前に決定された暗号鍵の値との加算値に基づいて、前記平文文字に対応する暗号鍵を決定し、
決定された前記暗号鍵を、インデックスで指定される暗号文データの位置にセットすることにより暗号文データを生成し、
前記暗号化手段は、前記暗号文データを平文データとして、前記暗号化処理を繰り返し行い、
前記暗号化処理を繰り返し行う場合に、前記インデックスが順次シフトされ、決定された暗号鍵が、対応する平文文字の前記平文データにおける位置とは異なる暗号文データの位置にセットされ、
前記暗号鍵を決定する際に、前記加算値に基づく値が、暗号化単位のサイズを超えた場合は、ラップアラウンドするように調整されることを特徴とする暗号化装置。
An encryption key table storing different encryption keys in each entry; and
Plaintext data, and an encryption unit that performs encryption processing for generating the encrypted ciphertext data in plaintext character by character,
The encryption processing by the encryption means is
Extracting plaintext characters sequentially from the plaintext data,
Based on the contents of the plaintext characters, determine the order of the encryption key table entries,
Determining an encryption key corresponding to the plaintext character based on an addition value of the value of the encryption key table stored in the determined order entry and the value of the encryption key determined previously ;
Generating the ciphertext data by setting the determined cipher key at the position of the ciphertext data specified by the index ;
The encryption means repeats the encryption process using the ciphertext data as plaintext data,
When repeatedly performing the encryption process, the index is sequentially shifted, and the determined encryption key is set at a position of ciphertext data different from the position of the corresponding plaintext character in the plaintext data,
When determining the encryption key, if the value based on the added value exceeds the size of the encryption unit, the encryption apparatus is adjusted to wrap around.
請求項1に記載の暗号化装置において、The encryption device according to claim 1,
前記暗号化手段による暗号化処理は、The encryption processing by the encryption means is
前記加算値に基づく値が、さらに前記暗号化処理の繰り返しごとに設定される値を含むことを特徴とする暗号化装置。A value based on the added value further includes a value set for each repetition of the encryption process.
請求項1に記載の暗号化装置において、
前記インデックスを、前記平文データにおける前記平文文字の位置、および前記平文データのサイズを用いて計算し、
前記サイズが2のn乗数である場合に、除算を用いない方法で前記計算が行われることを特徴とする暗号化装置。
The encryption device according to claim 1 ,
The index is calculated using the position of the plaintext character in the plaintext data and the size of the plaintext data,
When the size is an n multiplier of 2, the calculation is performed by a method that does not use division.
各エントリーに、それぞれ異なる復号鍵を格納する復号鍵テーブルと、
暗号文を、暗号文字単位で復号化し平文データを生成する復号化手段とを備え、
前記復号化手段は、
前記暗号文データから、前記暗号文字を抽出し、
前記暗号文字の値から、以前に求められた前記暗号文字の値を減算した減算値に基づいて、復号鍵テーブルのエントリーの順番を決定し、
決定された前記順番のエントリーに記憶される前記復号鍵テーブルの値に基づいて、前記暗号文字に対応する復号鍵を決定し、
決定された前記復号鍵を、インデックスで指定される平文データの位置にセットすることにより平文データを生成し、
前記復号化手段は、前記平文データを暗号文データとして、前記復号化処理を繰り返し行い、
前記復号化処理を繰り返し行う場合に、前記インデックスが順次シフトされ、決定された復号鍵が、対応する暗号文字の前記暗号文データにおける位置とは異なる平文データの位置にセットされ、
前記復号鍵テーブルのエントリーの順番を決定する際に、前記減算値に基づく値が、負の値になった場合は、ラップアラウンドするように調整されることを特徴とする復号化装置。
A decryption key table storing a different decryption key in each entry; and
Decryption means for decrypting the ciphertext in units of cipher characters and generating plaintext data,
The decoding means includes
Extracting the cipher characters from the ciphertext data;
Based on the subtracted value obtained by subtracting the previously obtained value of the encrypted character from the value of the encrypted character, the order of entries in the decryption key table is determined,
Based on the value of the decryption key table stored in the determined order entry, determine a decryption key corresponding to the encrypted character;
Generating plaintext data by setting the determined decryption key at the position of the plaintext data specified by the index ;
The decryption means repeatedly performs the decryption process using the plaintext data as ciphertext data,
When repeatedly performing the decryption process, the index is sequentially shifted, and the determined decryption key is set at a position of plaintext data different from the position of the corresponding cipher character in the ciphertext data,
In determining the order of entries in the decryption key table value based on the subtraction value is, if a negative value, the decoding device according to claim Rukoto be adjusted to wrap around.
各エントリーに、それぞれ異なる暗号鍵を格納する暗号鍵テーブルと、
平文データを、平文文字単位で暗号化し暗号文データを生成する暗号化処理を行う暗号化手段と、
前記暗号文データを復号化する復号化処理を行う復号化手段とを備え、
前記暗号化手段は、
前記平文データから、順次平文文字を抽出し、
前記平文文字の内容に基づいて、暗号鍵テーブルのエントリーの順番を決定し、
決定された前記順番のエントリーに記憶される前記暗号鍵テーブルの値と、以前に決定された暗号鍵の値との加算値に基づいて、前記平文文字に対応する暗号鍵を決定し、
決定された前記暗号鍵を、第1インデックスで指定される暗号文データの位置にセットすることにより暗号文データを生成し、
前記暗号化手段は、前記暗号文データを平文データとして、前記暗号化処理を繰り返し行い、
前記暗号化処理を繰り返し行う場合に、前記第1インデックスが順次シフトされ、決定された暗号鍵が、対応する平文文字の前記平文データにおける位置とは異なる暗号文データの位置にセットされ、
前記暗号鍵を決定する際に、前記加算値に基づく値が、暗号化単位のサイズを超えた場合は、ラップアラウンドするように調整され、
前記復号化手段は、
前記暗号文データから、前記平文文字と同じ単位で順次暗号文字を抽出し、
前記暗号文字の値から、以前に求められた前記暗号文字の値を減算した減算値に基づいて、復号鍵テーブルのエントリーの順番を決定し、
決定された前記順番のエントリーに記憶される前記復号鍵テーブルの値に基づいて、前記暗号文字に対応する復号鍵を決定し、
決定された前記復号鍵を、第2インデックスで指定される平文データの位置にセットすることにより平文データを生成し、
前記復号化手段は、前記平文データを暗号文データとして、前記復号化処理を繰り返し行い、
前記復号化処理を繰り返し行う場合に、前記第2インデックスが順次シフトされ、決定された復号鍵が、対応する暗号文字の前記暗号文データにおける位置とは異なる平文データの位置にセットされ、
前記復号鍵テーブルのエントリーの順番を決定する際に、前記減算値に基づく値が、負の値になった場合は、ラップアラウンドするように調整されることを特徴とする暗号化・復号化システム。
An encryption key table storing different encryption keys in each entry; and
Encryption means for performing encryption processing for encrypting plaintext data in plaintext characters and generating ciphertext data;
Decrypting means for performing decryption processing for decrypting the ciphertext data,
The encryption means includes
Extracting plaintext characters sequentially from the plaintext data,
Based on the contents of the plaintext characters, determine the order of the encryption key table entries,
Determining an encryption key corresponding to the plaintext character based on an addition value of the value of the encryption key table stored in the determined order entry and the value of the encryption key determined previously ;
Generating the ciphertext data by setting the determined cipher key at the position of the ciphertext data designated by the first index ;
The encryption means repeats the encryption process using the ciphertext data as plaintext data,
When repeatedly performing the encryption process, the first index is sequentially shifted, and the determined encryption key is set to a position of ciphertext data different from the position of the corresponding plaintext character in the plaintext data,
When determining the encryption key, if the value based on the added value exceeds the size of the encryption unit, it is adjusted to wrap around,
The decoding means includes
From the ciphertext data, sequentially extract cipher characters in the same units as the plaintext characters,
Based on the subtracted value obtained by subtracting the previously obtained value of the encrypted character from the value of the encrypted character, the order of entries in the decryption key table is determined,
Based on the value of the decryption key table stored in the determined order entry, determine a decryption key corresponding to the encrypted character;
Generating plaintext data by setting the determined decryption key at the position of the plaintext data specified by the second index ;
The decryption means repeatedly performs the decryption process using the plaintext data as ciphertext data,
When repeatedly performing the decryption process, the second index is sequentially shifted, and the determined decryption key is set to a position of plaintext data different from the position of the corresponding cipher character in the ciphertext data,
In determining the order of entries in the decryption key table value based on the subtraction value is, if a negative value, the encryption-decryption system according to claim Rukoto adjusted to wrap around .
請求項5に記載の暗号化・復号化システムにおいて、
前記復号鍵テーブルは、エントリーの順番を表す値と当該エントリーに格納されている値との関係が、前記暗号鍵テーブルとは逆になるように設定されていることを特徴とする暗号化・復号化システム。
The encryption / decryption system according to claim 5 ,
The encryption / decryption is characterized in that the decryption key table is set so that a relationship between a value representing an entry order and a value stored in the entry is opposite to that of the encryption key table. System.
平文データを暗号化する暗号化装置で用いられる暗号化方法であって、An encryption method used in an encryption device for encrypting plaintext data,
前記暗号化装置は、各エントリーに、それぞれ異なる暗号鍵を格納する暗号鍵テーブルを有し、The encryption device has an encryption key table for storing different encryption keys in each entry,
前記暗号化方法は、The encryption method is:
(1)前記平文データから、順次平文文字を抽出するステップと、(1) extracting plaintext characters sequentially from the plaintext data;
(2)前記平文文字の内容に基づいて、暗号鍵テーブルのエントリーの順番を決定するステップと、(2) determining the order of entries in the encryption key table based on the contents of the plaintext characters;
(3)決定された前記順番のエントリーに記憶される前記暗号鍵テーブルの値と、以前に決定された暗号鍵の値との加算値に基づいて、前記平文文字に対応する暗号鍵を決定するステップと、(3) Determine an encryption key corresponding to the plaintext character based on an addition value of the value of the encryption key table stored in the determined entry in the determined order and the value of the encryption key determined previously. Steps,
(4)決定された前記暗号鍵を、インデックスで指定される暗号文データの位置にセットすることにより暗号文データを生成ステップと、(4) generating the ciphertext data by setting the determined cipher key at the position of the ciphertext data specified by the index;
(5)前記暗号文データを平文データとして、前記(1)ないし(4)のステップを繰り返し行うステップとを有し、(5) repetitively performing the steps (1) to (4) using the ciphertext data as plaintext data,
前記(1)ないし(4)のステップを繰り返し行う場合に、前記インデックスが順次シフトされ、決定された暗号鍵が、対応する平文文字の前記平文データにおける位置とは異なる暗号文データの位置にセットされ、When the steps (1) to (4) are repeatedly performed, the index is sequentially shifted, and the determined encryption key is set at a position of ciphertext data different from the position of the corresponding plaintext character in the plaintext data. And
前記暗号鍵を決定する際に、前記加算値に基づく値が、暗号化単位のサイズを超えた場合は、ラップアラウンドするように調整されることを特徴とする暗号化方法。When determining the encryption key, if the value based on the added value exceeds the size of the encryption unit, the encryption method is adjusted to wrap around.
暗号文データを復号化する復号化装置で用いられる復号化方法であって、A decryption method used in a decryption device for decrypting ciphertext data,
前記復号化装置は、各エントリーに、それぞれ異なる復号鍵を格納する復号鍵テーブルを有し、The decryption device has a decryption key table storing different decryption keys in each entry,
前記復号化方法は、The decoding method is:
(1)前記暗号文データから、前記暗号文字を抽出するステップと、(1) extracting the cipher characters from the ciphertext data;
(2)前記暗号文字の値から、以前に求められた前記暗号文字の値を減算した減算値に基づいて、復号鍵テーブルのエントリーの順番を決定するステップと、(2) determining the order of entries in the decryption key table based on a subtraction value obtained by subtracting the value of the encryption character obtained previously from the value of the encryption character;
(3)決定された前記順番のエントリーに記憶される前記復号鍵テーブルの値に基づいて、前記暗号文字に対応する復号鍵を決定するステップと、(3) determining a decryption key corresponding to the encrypted character based on a value of the decryption key table stored in the determined entry of the order;
(4)決定された前記復号鍵を、インデックスで指定される平文データの位置にセットすることにより平文データを生成するステップと、(4) generating plaintext data by setting the determined decryption key at a position of plaintext data specified by an index;
(5)前記平文データを暗号文データとして、前記(1)ないし(4)のステップを繰り返し行い、(5) Repeating steps (1) to (4) using the plaintext data as ciphertext data,
前記(1)ないし(4)のステップを繰り返し行う場合に、前記インデックスが順次シフトされ、決定された復号鍵が、対応する暗号文字の前記暗号文データにおける位置とは異なる平文データの位置にセットされ、When the steps (1) to (4) are repeatedly performed, the index is sequentially shifted, and the determined decryption key is set at a position of plaintext data different from the position of the corresponding cipher character in the ciphertext data. And
前記復号鍵テーブルのエントリーの順番を決定する際に、前記減算値に基づく値が、負の値になった場合は、ラップアラウンドするように調整されることを特徴とする復号化方法。When the order of entries in the decryption key table is determined, if the value based on the subtraction value becomes a negative value, the decryption method is adjusted to wrap around.
平文データを暗号化する暗号化装置のためのプログラムであって、A program for an encryption device for encrypting plaintext data,
前記暗号化装置は、各エントリーに、それぞれ異なる暗号鍵を格納する暗号鍵テーブルを有し、The encryption device has an encryption key table for storing different encryption keys in each entry,
前記プログラムは、前記暗号化装置のコンピュータに対して、The program is for the computer of the encryption device.
(1)前記平文データから、順次平文文字を抽出するステップと、(1) extracting plaintext characters sequentially from the plaintext data;
(2)前記平文文字の内容に基づいて、暗号鍵テーブルのエントリーの順番を決定するステップと、(2) determining the order of entries in the encryption key table based on the contents of the plaintext characters;
(3)決定された前記順番のエントリーに記憶される前記暗号鍵テーブルの値と、以前に決定された暗号鍵の値との加算値に基づいて、前記平文文字に対応する暗号鍵を決定するステップと、(3) Determine an encryption key corresponding to the plaintext character based on an addition value of the value of the encryption key table stored in the determined entry in the determined order and the value of the encryption key determined previously. Steps,
(4)決定された前記暗号鍵を、インデックスで指定される暗号文データの位置にセットすることにより暗号文データを生成ステップと、(4) generating the ciphertext data by setting the determined cipher key at the position of the ciphertext data specified by the index;
(5)前記暗号文データを平文データとして、前記(1)ないし(4)のステップを繰り返し行うステップとを有し、(5) repetitively performing the steps (1) to (4) using the ciphertext data as plaintext data,
前記(1)ないし(4)のステップを繰り返し行う場合に、前記インデックスが順次シフトされ、決定された暗号鍵が、対応する平文文字の前記平文データにおける位置とは異なる暗号文データの位置にセットされ、When the steps (1) to (4) are repeatedly performed, the index is sequentially shifted, and the determined encryption key is set at a position of ciphertext data different from the position of the corresponding plaintext character in the plaintext data. And
前記暗号鍵を決定する際に、前記加算値に基づく値が、暗号化単位のサイズを超えた場合は、ラップアラウンドするように調整されるように制御することを特徴とするプログラム。When determining the encryption key, if the value based on the added value exceeds the size of the encryption unit, the program is controlled to be adjusted so as to wrap around.
JP2009095456A 2009-04-10 2009-04-10 Encryption / decryption system, encryption device, decryption device, encryption method, decryption method, and program Expired - Fee Related JP4733793B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2009095456A JP4733793B2 (en) 2009-04-10 2009-04-10 Encryption / decryption system, encryption device, decryption device, encryption method, decryption method, and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2009095456A JP4733793B2 (en) 2009-04-10 2009-04-10 Encryption / decryption system, encryption device, decryption device, encryption method, decryption method, and program

Publications (2)

Publication Number Publication Date
JP2010246055A JP2010246055A (en) 2010-10-28
JP4733793B2 true JP4733793B2 (en) 2011-07-27

Family

ID=43098544

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2009095456A Expired - Fee Related JP4733793B2 (en) 2009-04-10 2009-04-10 Encryption / decryption system, encryption device, decryption device, encryption method, decryption method, and program

Country Status (1)

Country Link
JP (1) JP4733793B2 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5589958B2 (en) * 2011-05-24 2014-09-17 株式会社デンソー Electronic control unit
CN108718235A (en) * 2018-04-28 2018-10-30 王萍 A kind of stream encryption and decryption method

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2003324423A (en) * 2002-05-01 2003-11-14 Nec Electronics Corp Data processing method, encryption method, encryption method, authentication method and apparatus therefor
JP2008152059A (en) * 2006-12-19 2008-07-03 Fujitsu Broad Solution & Consulting Inc Encryption processing program, encryption processing method and encryption processing device

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2003324423A (en) * 2002-05-01 2003-11-14 Nec Electronics Corp Data processing method, encryption method, encryption method, authentication method and apparatus therefor
JP2008152059A (en) * 2006-12-19 2008-07-03 Fujitsu Broad Solution & Consulting Inc Encryption processing program, encryption processing method and encryption processing device

Also Published As

Publication number Publication date
JP2010246055A (en) 2010-10-28

Similar Documents

Publication Publication Date Title
JP7370402B2 (en) Encryption method and terminal in terminal device
CN103957100B (en) AES encryption or decryption are executed in various modes using single instrction
US20120269340A1 (en) Hierarchical encryption/decryption device and method thereof
JP2005505069A (en) Memory encryption
KR102297536B1 (en) Apparatus for processing non-polynomial operation on encrypted messages and methods thereof
JP2009245227A (en) Information storage device
JP4758904B2 (en) Confidential information processing method
CN101604369A (en) Information concealing method and information concealment device
JP2014207717A (en) Exponent obfuscation
KR20050069924A (en) Block encoding/decoding method, circuit, and device
JP7170878B2 (en) Apparatus and method for performing non-polynomial arithmetic on ciphertext
JP2003318883A (en) Key generation device, encrypting/decrypting device and data receiver
WO2019043921A1 (en) Encryption device, decryption device, encryption method, decryption method, encryption program, and decryption program
JP4733793B2 (en) Encryption / decryption system, encryption device, decryption device, encryption method, decryption method, and program
JP5188414B2 (en) Information processing apparatus, information processing method, and program
US8494169B2 (en) Validating encrypted archive keys
KR20060110383A (en) Multi-mode ciphering apparatus for network security processor
KR20220121221A (en) Apparatus for conversion of homomorphic encrypted messase and method thereof
JP4857230B2 (en) Pseudorandom number generator and encryption processing device using the same
US20050232414A1 (en) Block encoding method and block encoding/decoding circuit
JP2015004743A (en) Encryption processing device and information processing apparatus
JP4644053B2 (en) Encryption apparatus and method, decryption apparatus and method
JP3389210B2 (en) Extended key generation device, encryption / decryption device, extended key generation method, and storage medium
JP2006135969A (en) Information processor, information processing method and program
JP4941192B2 (en) Encryption processing system

Legal Events

Date Code Title Description
A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20110324

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: 20110423

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

Free format text: PAYMENT UNTIL: 20200428

Year of fee payment: 9

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

Ref document number: 4733793

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

LAPS Cancellation because of no payment of annual fees