KR20030039913A - Algorithm for embodying a shift register in software - Google Patents

Algorithm for embodying a shift register in software Download PDF

Info

Publication number
KR20030039913A
KR20030039913A KR1020010071307A KR20010071307A KR20030039913A KR 20030039913 A KR20030039913 A KR 20030039913A KR 1020010071307 A KR1020010071307 A KR 1020010071307A KR 20010071307 A KR20010071307 A KR 20010071307A KR 20030039913 A KR20030039913 A KR 20030039913A
Authority
KR
South Korea
Prior art keywords
variable
values
variables
memory
lfsr
Prior art date
Application number
KR1020010071307A
Other languages
Korean (ko)
Other versions
KR100427672B1 (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 KR10-2001-0071307A priority Critical patent/KR100427672B1/en
Publication of KR20030039913A publication Critical patent/KR20030039913A/en
Application granted granted Critical
Publication of KR100427672B1 publication Critical patent/KR100427672B1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/58Random or pseudo-random number generators
    • G06F7/582Pseudo-random number generators
    • G06F7/584Pseudo-random number generators using finite field arithmetic, e.g. using a linear feedback shift register

Landscapes

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

Abstract

PURPOSE: A software implementation algorithm of a shift register is provided to reduce a waste of a memory and reduce the number of iterative statements required as a degree of primitive polynomial. CONSTITUTION: The number of variables is calculated, variables for storing the 'n' number of LFSR(Linear Feedback Shift Register) values and new value are calculated, and a temp to be stored is declared and a temporary variable is declared(30). The 'n' number of values given as an initial value is assigned to the variables for the storing the LFSR values and stored, and the left memory portion of the remaining variables are filled with '0'(31). The variables for storing the 'n' number of LFSR values are stored in a memory of a temporary variable sequentially using a memory shift calculation and an exclusive OR operation according to bits, combines the variables for storing the 'n' number of LFSR values, and stores the variables in a memory of a temporary variable sequentially(32). Temps for storing the 'n' number of LFSR values are calculated(33). A variable substitution is executed for updating new LFSR values(34). The above stages(32-34) are repeated until an output of a wanted bit is obtained(35).

Description

시프트 레지스터의 소프트웨어 구현 알고리즘 {Algorithm for embodying a shift register in software}Algorithm for embodying a shift register in software

본 발명은 시프트 레지스터를 소프트웨어로 구현하기 위한 알고리즘에 관한 것으로, 특히, 스트림 암호의 대표적인 생성 논리로 이용되는 LFSR과 FCSR의 소프트웨어 구현 알고리즘에 관한 것이다.TECHNICAL FIELD The present invention relates to algorithms for implementing shift registers in software, and more particularly, to software implementation algorithms for LFSR and FCSR that are used as representative generation logic for stream ciphers.

LFSR(Linear Feedback Shift Register)과 FCSR(Feedback Carry Shift Register)는 스트림 암호를 대표하는 논리들이며, 간단한 구조와 함께 높은 주기를 수학적으로 보장해 주기 때문에 많은 분야에서 사용된다. LFSR과 FCSR는 하드웨어로 구현 시 적은 게이트 복잡도를 가지면서 하나의 클록에 1 비트의 출력을 얻을 수 있어 매우 효율적이라고 알려져 있지만, 소프트웨어로 구현 시에는 각각의 비트들을 반복적으로 이동시키는 과정을 포함하고 있어 매우 느린 속도를 보일 뿐 아니라, 1 비트의 정보를 표현하는 데 있어 최소한 8 비트의 자료 구조를 사용해야 하기 때문에 메모리의 낭비가 심한 단점을 가진다.Linear Feedback Shift Registers (LFSRs) and Feedback Carry Shift Registers (FCSRs) are logics that represent stream ciphers and are used in many fields because they provide a simple structure and mathematically high cycles. LFSR and FCSR are known to be very efficient because they can achieve 1-bit output on one clock with low gate complexity when implemented in hardware, but in software, they involve moving each bit repeatedly. Not only does it show very slow speeds, but at least 8 bits of data structures must be used to represent 1 bit of information, which is a waste of memory.

그러면 LFSR과 FCSR의 기본 논리를 설명하면 다음과 같다.The basic logic of LFSR and FCSR is as follows.

LFSR의 기본 논리Basic logic of LFSR

유한 체 GF(2) 위에 정의된 n차의 LFSR는 GF(2) 위의 n차 원시 다항식인 하기의 수학식 1로부터 생성된다.The nth order LFSR defined above the finite sieve GF (2) is generated from Equation 1 below, which is the nth order primitive polynomial above the GF (2).

주어진 초기치 n 비트로부터 연속된 2n-1 비트의 출력을 얻을 수 있으며, k번째 비트는 이전의 n 비트로부터 얻을 수 있다. 즉, 하기의 수학식 2와 같은 관계를 만족한다.From the given initial value n bits, we can get the output of consecutive 2 n -1 bits, and the k th bit can be obtained from the previous n bits. That is, the relationship as shown in Equation 2 below is satisfied.

여기에서,는 비트별 배타적 논리합(XOR) 연산을 의미하며, LFSR의 동작 방식은 도 1과 같이 표현된다.From here, Denotes a bitwise exclusive OR operation, and an operation method of the LFSR is represented as shown in FIG. 1.

그러면 상기 수학식 1의 원시 다항식 f(x)에 의해 생성되는 LFSR를 소프트웨어로 구현하기 위한 종래의 알고리즘을 도 2를 통해 설명하면 다음과 같다.A conventional algorithm for implementing the LFSR generated by the primitive polynomial f (x) of Equation 1 in software will now be described with reference to FIG. 2.

LFSR를 소프트웨어로 구현하기 위한 종래의 알고리즘은 크게 4 단계로 이루어진다.The conventional algorithm for implementing LFSR in software consists of four steps.

[알고리즘 1] LFSR를 소프트웨어로 구현하기 위한 종래의 알고리즘Algorithm 1 Conventional Algorithm for Implementing LFSR in Software

단계 1(변수 선언) : n개의 LFSR 값을 저장할 크기 n인 배열 A[]와 새로운 값을 계산하여 저장할 템프(Temp) 변수를 선언한다. Step 1 (Declare Variable): Declare an array A [] of size n to store n LFSR values and a Temp variable to store the new value.

단계 2(초기값 할당) : 배열 A[]에 LFSR의 n개의 초기값을 할당한다. 이 부분은 변수 선언 부분과 더불어 출력 수열의 수에 관계없이 한 번만 수행된다. Step 2 (initial value assignment): assigns n initial values of LFSR to array A []. This part, along with the variable declaration part, is executed only once, regardless of the number of output sequences.

단계 3(새로운 값 계산) : 상기 수학식 2로부터 새로운 항을 생성하여 템프 변수에 저장한다. Step 3 (Calculate New Value): A new term is generated from Equation 2 and stored in the temp variable.

단계 4(변수 치환) : 도 1에 도시된 바와 같이 새로운 LFSR의레지스터(Register)를 갱신하기 위하여 배열 A[]에 저장된 값들을 한 항씩 이동시키고, 마지막 A[n-1]번째 항에 새로운 값 템프(Temp)를 저장한다. Step 4 (variable substitution): move the values stored in the array A [] by one term to update the register of the new LFSR as shown in FIG. 1, and add the new value to the last A [n-1] th term. Save the Temp.

단계 5: 상기 단계 4 (변수 치환) 과정이 종료되면 새로운 LFSR 1 비트가 생성되는데, 원하는 비트의 출력을 얻기 위하여 상기 단계 3 및 4의 과정을 반복 진행한다. Step 5 : When the step 4 (variable substitution) process is completed, a new LFSR 1 bit is generated, and the steps 3 and 4 are repeated to obtain an output of a desired bit.

그런데 상기와 같은 종래의 알고리즘을 사용하게 되면 상기 단계 1에서 원시 다항식의 차수 만큼의 변수를 선언하여야 한다. 그러므로 LFSR 한 항의 실제 정보량은 1 비트이지만, 대부분의 프로그램 언어에서는 최소 8 비트의 크기를 가지는 데이터 구조에 저장할 수 밖에 없기 때문에 메모리의 낭비가 많아진다. 또한, 상기 단계 4에서 LFSR 1 비트를 생성하기 위하여 원시 다항식의 차수 만큼의 변수 치환이 이루어져야 하는데, 원시 다항식의 차수가 보통 100 정도인 것을 감안하면 매우 비효율적이라는 것을 알 수 있다.However, when using the conventional algorithm as described above, in step 1, variables corresponding to the order of the primitive polynomial should be declared. Therefore, the actual amount of information in one term of the LFSR is 1 bit, but in most programming languages, it is only necessary to store it in a data structure having a size of at least 8 bits. In addition, in step 4, in order to generate one bit of LFSR, variable substitution of the order of the primitive polynomial should be performed.

FCSR의 기본 논리Basic Logic of FCSR

2가 아닌 소수(Prime number) q에 대하여 하기의 수학식 3과 같이 이진 전개가 주어졌다면, 이때, q를 연결수로 하는 FCSR는 r개의 레지스터와 메모리 m으로 구성된다.If binary expansion is given to a prime number q other than 2 as shown in Equation 3 below, the FCSR having q as the number of connections is composed of r registers and a memory m.

레지스터의 값이이라 하고 메모리를이라 하면 시각 k에서 FCSR의 생성 방식은 도 3과 같이 표현된다.The value of the register Called memory In this case, the generation method of the FCSR at time k is expressed as shown in FIG. 3.

단계 10: 하기의 수학식 4와 같은 관계식으로 정수합을 구한다. Step 10 : Integer sum is expressed by the following equation (4) Obtain

단계 11: 레지스터의 내용을 오른쪽으로 한칸씩 이동시킨다. Step 11 : Move the contents of the register one space to the right.

단계 12:(mod 2)를 시프트 레지스터의 최상위 레지스터에 대치시킨다. Step 12 : Replace (mod 2) with the top register of the shift register.

단계 13: 메모리로 바꾼다. Step 13 : Memory of Change to

그러면 상기 수학식 3의 연결수 q에 의해 생성되는 FCSR를 소프트웨어로 구현하기 위한 종래의 알고리즘을 도 4를 통해 설명하기로 한다.Next, a conventional algorithm for implementing the FCSR generated by the connection number q of Equation 3 in software will be described with reference to FIG. 4.

FCSR를 소프트웨어로 구현하기 위한 종래의 알고리즘은 크게 5 단계로 이루어진다.The conventional algorithm for implementing FCSR in software consists of five steps.

[알고리즘 2] FCSR를 소프트웨어로 구현하기 위한 종래의 알고리즘Algorithm 2 Conventional Algorithm for Implementing FCSR in Software

단계 20(변수 선언) : n개의 FCSR 값을 저장할 크기 n인 배열 A[]와 새로운 값을 계산하여 저장할 템프(Temp) 변수 및 메모리 변수 M을 선언한다. Step 20 (Declare Variable): Declare an array A [] of size n to store n FCSR values, and a Temp variable and a memory variable M to calculate and store the new value.

단계 21(초기값 할당) : 배열 A[]에 FCSR의 n개의 초기값을, 변수 M에 초기 메모리값을 할당한다. Step 21 (Initial Value Allocation): Assigns n initial values of FCSR to array A [] and an initial memory value to variable M.

단계 22(새로운 값 계산) : 상기 수학식 4와 같은 관계식으로부터 새로운항을 생성하여 템프(Temp) 변수에 저장한다. Step 22 (Calculate New Value): A new term is generated from a relation such as Equation 4 and stored in a Temp variable.

단계 23(변수 치환) : 도 3에서와 같이 새로운 FCSR의 레지스터를 갱신하기 위하여 배열 A[]에 저장된 값들을 한 항씩 이동시킨다. Step 23 (variable substitution): move the values stored in the array A [] by one term to update the register of the new FCSR as shown in FIG.

단계 24(새로운 항 계산 및 M값 갱신) : A[n-1] = Temp (mod 2)를 계산하고, M = ( Temp - A[n-1]) / 2 를 계산한다. Step 24 (calculate new term and update M value): calculate A [n-1] = Temp (mod 2) and calculate M = (Temp-A [n-1]) / 2.

단계 25: 상기 단계 24 (새로운 항 계산 및 M값 갱신) 과정이 완료되면 새로운 FCSR 1 비트가 A[n-1]에 생성되게 되는데, 원하는 비트의 출력을 얻을 때까지 상기 단계 22 내지 24의 과정을 반복 진행한다. Step 25 : When step 24 (new term calculation and M value update) is completed, a new FCSR 1 bit is generated in A [n-1], and the process of steps 22 to 24 until an output of a desired bit is obtained. Repeat the process.

그러나 상술한 바와 같은 종래의 방법을 사용하면 LFSR의 경우와 마찬가지로 메모리의 낭비가 많아지며, 비효율적인 반복문을 사용해야 하는 단점이 있다.However, when using the conventional method as described above, as in the case of the LFSR, the waste of memory increases, and there is a disadvantage that an inefficient loop is used.

따라서 본 발명은 불필요한 메모리의 낭비와 원시 다항식의 차수만큼 소요되었던 반복문의 횟수를 감소시키므로써 상기한 단점을 해소할 수 있는 속도가 빠른 LFSR과 FCSR의 소프트웨어 구현 알고리즘을 제공하는 데 그 목적이 있다.Accordingly, an object of the present invention is to provide a fast software implementation algorithm of LFSR and FCSR that can solve the above-mentioned disadvantages by reducing the number of unnecessary loops and the number of iterations required by the order of primitive polynomials.

상기한 목적을 달성하기 위한 본 발명에 따른 시프트 레지스터의 소프트웨어 구현 알고리즘은 변수의 갯수(k)를 계산한 후 n개의 LFSR 값을 저장하기 위한 변수와 새로운 값을 계산하여 저장할 템프를 선언하고 임시변수를 선언하는 제 1 단계와, 초기값으로 주어진 n개의 값을 LFSR 값을 저장하기 위한 변수에 대입하여 저장한 후 남은 변수의 왼쪽 메모리 부분을 0으로 채우는 제 2 단계와, n개의 LFSR 값을 저장하기 위한 변수를 메모리 시프트 연산과 비트별 배타적 논리합 연산을 이용하여 임시변수의 메모리에 순차적으로 저장한 후 n개의 LFSR 값을 저장하기 위한 변수를 조합하여 임시변수의 메모리에 순차적으로 저장하는 제 3 단계와, n개의 LFSR 값을 저장하기 위한 템프를 계산하는 제 4 단계와, 새로운 LFSR 값들을 갱신하기 위하여 변수 치환을 실시하는 제 5 단계와, 원하는 비트의 출력을 얻을 때까지 제 3 내지 제 5 단계의 과정을 반복 진행하는 제 6 단계를 포함하여 이루어지는 것을 특징으로 한다.The software implementation algorithm of the shift register according to the present invention for achieving the above object, after calculating the number (k) of the variable, the variable for storing the n LFSR value and the new value to declare the temp to store and store the temporary variable A first step of declaring a second value, a second step of filling the left memory part of the remaining variable with zero after assigning n values given as initial values to a variable for storing an LFSR value, and storing n LFSR values A third step of sequentially storing the variable to be stored in the memory of the temporary variable using a memory shift operation and an exclusive OR operation for each bit, and then sequentially storing the variable for storing n LFSR values in the memory of the temporary variable And a fourth step of calculating a temp to store the n LFSR values, and performing variable substitution to update the new LFSR values. And 5, characterized in that formed by until you get the desired output of the bit a sixth step of proceeding the third to repeat the process of the fifth step.

또한, 본 발명에 따른 다른 시프트 레지스터의 소프트웨어 구현 알고리즘은 변수의 갯수(k)를 계산한 후 n개의 FCSR 값을 저장하기 위한 변수와 메모리 값을 저장할 메모리 변수 및 새로운 값을 계산하여 저장할 임시 변수들을 선언하고 n개의 FCSR 값을 저장하기 위한 변수에 저장된 값들을 분할하여 저장할 때 필요한 변수를 선언하는 제 1 단계와, 초기값으로 주어진 n개의 값을 n개의 FCSR 값을 저장하기 위한 변수에 대입하여 저장하고 남은 변수의 왼쪽 메모리 부분을 0으로 채운 다음 초기값으로 주어진 메모리값을 메모리 변수에 저장하고 메모리 변수를 왼쪽으로 메모리 시프트시키는 제 2 단계와, 초기변수에 저장된 초기값을 네 개의 변수로 분할하여 저장하는 제 3 단계와, 제 3 단계에서 생성된 분할된 변수들을 이용하여 LFSR의 임시변수를 계산한 후 계산된 임시변수를 정수연산으로 더하여 저장하는 제 4 단계와, FCSR의 새로운 항을 생성하기 위하여 전 항에서 갱신된 메모리를 정수합에 더해주는 과정을 임시변수들에 저장된 변수에 대해 순차적으로 진행하는 제 5 단계와, 각각의 정수합이 저장된 메모리 중 오른 쪽에서 두번째의 값을 메모리 값으로 갱신하는 제 6 단계와, 새로운 32 비트 FCSR 값을 얻고난 후 다음 32 비트를 얻기 위하여 변수를 치환하는 제 7 단계와, 원하는 비트의 출력을 얻을 때까지 제 4 단계 및 제 7 단계의 과정을 반복 실시하는 제 8 단계를 포함하여 이루어지는 것을 특징으로 한다.In addition, the software implementation algorithm of another shift register according to the present invention calculates the number of variables (k) and then calculates variables for storing n FCSR values, memory variables for storing memory values, and temporary variables for calculating new values. The first step of declaring a variable required for declaring and dividing and storing values stored in a variable for storing n FCSR values, and assigning and storing n values given as initial values into a variable for storing n FCSR values. After filling the left memory part of the remaining variable with 0, the second step of storing the memory value given as the initial value in the memory variable and shifting the memory variable to the left, and dividing the initial value stored in the initial variable into four variables After calculating the temporary variable of the LFSR using the third step of storing and the partitioned variables generated in the third step A fifth step of adding and storing the calculated temporary variable as an integer operation; and a fifth step of sequentially adding the memory updated in the previous term to the integer sum to generate a new term of the FCSR, for the variables stored in the temporary variables. A sixth step of updating a second value from the right of the memory storing each integer sum to a memory value, a seventh step of obtaining a new 32-bit FCSR value and then substituting a variable to obtain the next 32 bits; And an eighth step of repeating the processes of the fourth and seventh steps until an output of a desired bit is obtained.

도 1은 LFSR의 동작 방식을 도시한 생성 구조도.1 is a generation structure diagram illustrating an operation method of an LFSR.

도 2는 LFSR의 소프트웨어를 구현하기 위한 종래 알고리즘의 흐름도.2 is a flow diagram of a conventional algorithm for implementing software of LFSR.

도 3은 FCSR의 동작 방식을 도시한 생성 구조도.3 is a generation structure diagram showing an operation method of FCSR.

도 4는 FCSR의 소프트웨어를 구현하기 위한 종래 알고리즘의 흐름도.4 is a flow diagram of a conventional algorithm for implementing software of FCSR.

도 5는 본 발명에 따른 LFSR의 소프트웨어 구현 알고리즘을 설명하기 위한 흐름도.5 is a flowchart illustrating a software implementation algorithm of the LFSR in accordance with the present invention.

도 6은 본 발명의 알고리즘을 특정한 LFSR의 소프트웨어 구현에 적용했을 경우 메모리의 상태도.6 is a state diagram of a memory when the algorithm of the present invention is applied to a software implementation of a particular LFSR.

도 7은 본 발명에 따른 FCSR의 소프트웨어 구현 알고리즘을 설명하기 위한 흐름도.7 is a flowchart illustrating a software implementation algorithm of FCSR in accordance with the present invention.

도 8은 도 7의 단계 42를 설명하기 위한 예시도.FIG. 8 is an exemplary view for explaining step 42 of FIG. 7. FIG.

도 9는 도 7의 단계 44를 설명하기 위한 흐름도.9 is a flowchart for explaining step 44 of FIG.

본 발명은 32 비트 자료형 변수에 32개의 정보를 담아 1회의 알고리즘 동작으로 LFSR 및 FCSR를 32 비트씩 생성하고 반복문의 횟수도 획기적으로 감소시킨다. 그러면 본 발명에서 제시하는 LFSR과 FCSR의 소프트웨어 구현 알고리즘을 첨부된 도면을 참조하여 상세히 설명하기로 한다.According to the present invention, 32 bits of 32-bit data type variables contain 32 pieces of information and generate 32 bits of LFSR and FCSR by one algorithm operation, and dramatically reduce the number of iterations. Then, the software implementation algorithm of the LFSR and FCSR proposed in the present invention will be described in detail with reference to the accompanying drawings.

도 5는 본 발명에 따른 LFSR의 소프트웨어 구현 알고리즘을 설명하기 위한 흐름도이다.5 is a flowchart illustrating a software implementation algorithm of the LFSR according to the present invention.

LFSR를 생성하는 원시 다항식의 차(degree)수가 n이고 단(tap) 수가 t라고 하자. 설명의 편의를 위하여 상기 수학식 1의 원시 다항식을 계수가 0이 아닌 항의 합만으로 표현하면 하기의 수학식 5와 같다.Assume that the number of degrees of the primitive polynomial that produces the LFSR is n and the number of taps is t. For convenience of description, the raw polynomial of Equation 1 is expressed by Equation 5 below by expressing only the sum of terms whose coefficients are not zero.

(0 = n1<n2<...<nt=n) (0 = n 1 <n 2 <... <n t = n)

그러면, 상기 수학식 5에 의해 생성되는 LFSR {ai}의 관계식은 하기의 수학식 6과 같이 표현된다.Then, the relational expression of LFSR {a i } generated by Equation 5 is expressed as Equation 6 below.

(k = 0, 1, 2,....) (k = 0, 1, 2, ....)

[알고리즘 3] LFSR를 소프트웨어로 구현하기 위한 본 발명의 알고리즘[Algorithm 3] Algorithm of the Invention for Implementing LFSR in Software

단계 30: 변수 선언 Step 30 : Declare a Variable

을 계산한다. Calculate

n개의 LFSR 값을 저장하기 위한 변수의 갯수를 계산한다. [a]는 a보다 같거나 작은 최대 정수를 의미한다. n개의 LFSR 값을 한 변수에 32개씩 저장할 것이므로, k개 만큼의 변수가 필요하며, 이 과정은 실제 알고리즘 상에 나타나지 않는다.Calculate the number of variables to store n LFSR values. [a] means the maximum integer less than or equal to a. Since we will store 32 n LFSR values in one variable, we need as many as k variables, and this process does not appear in the actual algorithm.

② 32 비트형 변수 A1, A2, ...., Ak, Temp를 선언한다.② Declare 32-bit variables A 1 , A 2 , ...., A k , and Temp.

n개의 LFSR 값을 저장하기 위한 변수 Ai(1≤i≤k)와 새로운 값을 계산하여 저장할 템프(Temp)를 선언한다. 변수의 크기는 16, 32, 64 등이 모두 가능하나 현재 프로세서 환경과 사용되고 있는 LFSR의 차수를 고려할 때 32 비트형 변수를 사용하는 것이 가장 적절할 것으로 판단된다.Declare a variable A i (1≤i≤k) for storing n LFSR values and a temp to store the new value. The size of the variable can be 16, 32, 64, etc. However, considering the current processor environment and the order of the LFSR being used, it is most appropriate to use a 32-bit variable.

③ 32 비트형 변수 T1, T2,....., Tt-1를 선언한다.③ Declare 32-bit variables T 1 , T 2 , ....., T t-1 .

하기의 단계 32를 알고리즘에 포함시킬 경우 필요한 t-1개의 임시변수를 선언한다.If the following step 32 is included in the algorithm, t-1 temporary variables are declared.

단계 31: 초기값 설정 Step 31 : Set Initial Value

① 초기값으로 주어진 n개의 값 a0, a1,.....,an-1을 A1, A2,....., Ak에 저장한다.① Stores n values a 0 , a 1 , ....., a n-1 given as initial values in A 1 , A 2 , ....., A k .

Ak의 32개 메모리 중에서 가장 오른쪽에 an-1의 값이, 가장 왼쪽 메모리에 an-32의 값이 대입되도록 32개의 값을 Ak의 각각의 메모리에 순차적으로 대입한다.To the far right in the memory 32 of the A k, the value of a n-1, is sequentially assigned to the 32 value in each memory of A k to a value of a n-32 substituted into the left-most memory.

비슷한 방법으로, Ak-1, Ak-2,....., A1에 ai들의 값을 순차적으로 대입한다.In a similar way, the values of a i are sequentially assigned to A k-1 , A k-2 , ....., A 1 .

② a0의 값까지 대입하고 남은 A1의 왼쪽 메모리 부분은 0으로 채운다.② assignment to a value of 0, and the left portion of memory of the remaining A 1 is filled with zero.

단계 32: 임시 변수 Tj(1≤j≤t-1) 계산 Step 32 : calculate the temporary variable T j (1≤j≤t-1)

① A1, A2,....., Ak를 메모리 시프트 연산과 비트별 배타적 논리합(XOR) 연산을 적절히 사용하여 T1의 메모리 가장 왼쪽에 an1(=a0)이, 가장 오른쪽에 an1+31(=a31)이 순차적으로 저장되도록 한다. 이 과정은 2번의 메모리 시프트 연산과 1번의 배타적 논리합(XOR) 연산으로 해결할 수 있다.① By using A 1 , A 2 , ....., A k as the memory shift operation and the bitwise exclusive OR (XOR) operation, a n1 (= a 0 ) is located at the far left of the memory in T 1 Let a n1 + 31 (= a 31 ) be stored sequentially. This process can be solved by two memory shift operations and one exclusive OR operation.

② 비슷한 방법으로 A1, A2,....., Ak를 적절히 조합하여 Tj(≤j≤t-1)의 메모리 가장 왼쪽에 anj가, 가장 오른쪽에 anj+31이 순차적으로 저장되도록 한다.② a method similar to the A 1, A 2, ....., by suitably combining the A k in the memory of the left-most T j (≤j≤t-1) is a nj, the rightmost a nj + 31 sequentially To be stored.

단계 33: 템프(Temp) 계산 Step 33 : calculate temp

① 하기의 수학식 7을 이용하여 템프(Temp)를 계산한다.① Calculate Temp using Equation 7 below.

② 템프(Temp)에는 새로운 32개의 LFSR 값들이 저장되게 된다. 상기 수학식 7에서 각각의 Tj(≤j≤t-1) 자리에 상기 단계 32의 Tj를 구하는 식을 직접 대입하면 상기 단계 32의 과정을 알고리즘에서 제외시킬 수 있다. 그 경우에는 연산 속도에는 영향이 없으나, 사용하는 메모리의 양을 감소시킬 수 있다.② The new 32 LFSR values will be stored in Temp. If the equation for obtaining T j of step 32 is directly substituted for each T j (≦ j ≦ t−1) in Equation 7, the process of step 32 may be excluded from the algorithm. In that case, the operation speed is not affected, but the amount of memory used can be reduced.

단계 34: 변수 치환 Step 34 : Replace Variables

① 새로운 LFSR 값들을 갱신하기 위하여 하기의 수학식 8과 같이 변수 치환을 한다.① Variable substitution is performed as shown in Equation 8 below to update new LFSR values.

A1= A2, A2=A3,....., Ak-1=Ak, Ak= TempA 1 = A 2 , A 2 = A 3 , ....., A k-1 = A k , A k = Temp

단계 35: 상기 단계 34의 과정이 완료되면 새로운 LFSR 32 비트가 Ak에 생성되게 되고, 다음 32 비트를 생성하기 위한 초기값 설정까지 마치게 된다. m 비트의 출력을 원한다면회만큼 상기 단계 32 내지 단계 34까지의 과정을 반복 진행한다. 여기서, m은 출력비트 수를 나타낸다. Step 35 : When the process of step 34 is completed, a new LFSR 32 bit is generated in A k , and the initial value setting for generating the next 32 bit is completed. If you want to output m bits The process from step 32 to step 34 is repeated for each time. Where m represents the number of output bits.

그러면 상기와 같이 이루어지는 알고리즘 3을 이용하여 LFSR의 소프트웨어를 구현하는 실시예를 설명하기로 한다.Next, an embodiment of implementing the software of the LFSR using the above algorithm 3 will be described.

원시 다항식에 의해서 생성되는 LFSR를 C 프로그램 언어로 구현한 소오스 코드는 다음과 같다. 이 경우 원시 다항식의 차수 n은 89,단수 t는 5가 되며, 따라서 상기 단계 30의 k값은이 된다.Primitive polynomials The source code that implements the LFSR generated by the C programming language is as follows. In this case, the order n of the primitive polynomial becomes 89 and the singular t becomes 5. Thus, the k value of step 30 is Becomes

#include <stdio.h>#include <stdio.h>

void main()void main ()

{{

int i, Print_Number;int i, Print_Number;

unsigned long A1,A2,A3, Temp ; // 단계 30-②unsigned long A1, A2, A3, Temp; // step 30-②

unsigned long T1,T2,T3,T4 ; // 단계 30-③unsigned long T1, T2, T3, T4; // step 30-③

A_1 = 0x01555555 ; // 단계 31-②A_1 = 0x01555555; // step 31-②

A_2 = 0x55555555 ; A_3 = 0x55555555 ; // 단계 31-①A_2 = 0x55555555; A_3 = 0x55555555; // step 31-①

Print_Number = 10000000 ; // 출력비트수 지정Print_Number = 10000000; // specify the number of output bits

Print_Number = Print_Number/32 + 1; // 반복문 횟수 지정Print_Number = Print_Number / 32 + 1; // specify the number of loops

for(i = 0 ; i < Print_Number ; i++)for (i = 0; i <Print_Number; i ++)

{{

T1 = ( A1 << 7 ) ^ ( A2 >> 25 ) ; // 단계 32T1 = (A1 << 7) ^ (A2 >> 25); // step 32

T2 = ( A1 << 10 ) ^ ( A2 >> 22 ) ; // 단계 32T2 = (A1 << 10) ^ (A2 >> 22); // step 32

T3 = ( A2 << 21 ) ^ ( A3 >> 11 ) ; // 단계 32T3 = (A2 << 21) ^ (A3 >> 11); // step 32

T4 = ( A2 << 25 ) ^ ( A3 >> 7 ) ; // 단계 32T4 = (A2 << 25) ^ (A3 >> 7); // step 32

Temp = T1 ^ T2 ^ T3 ^ T4 ; // 단계 33Temp = T1 ^ T2 ^ T3 ^ T4; // step 33

A1 = A2 ; A2 = A3 ; A3 = Temp ; // 단계 34A1 = A2; A2 = A3; A3 = Temp; // step 34

printf("%08x",A3) ; // 출력printf ("% 08x", A3); // Print

}}

}}

상기와 같은 프로그램이 1회 수행될 경우, 변수 A1,A2,A3,T1,T2,T3,T4,Temp의 메모리에 저장되는 LFSR의 항들은 도 6과 같다. 편의상 도 6에서 ai는 i로 표현했으며, A1의 "X" 부분은 실제의 데이터값이 0인 부분을 나타낸다.When the program is executed once, the terms of the LFSR stored in the memory of the variables A1, A2, A3, T1, T2, T3, T4, and Temp are as shown in FIG. For convenience, a i is represented by i in FIG. 6, and an “X” portion of A1 represents a portion where an actual data value is zero.

다음으로, FCSR를 소프트웨어로 구현하기 위한 본 발명의 알고리즘을 설명하면 다음과 같다.Next, the algorithm of the present invention for implementing FCSR in software is as follows.

FCSR를 소프트웨어로 구현하기 위한 알고리즘은 상기한 LFSR를 소프트웨어로 구현하기 위한 알고리즘을 응용하여 실현하였다. 단, FCSR는 LFSR보다 생성원리가 복잡하기 때문에 일반적인 경우의 알고리즘은 구성할 수 없고, 약간의 제약을 가진 FCSR의 경우에만 적용이 가능하다.The algorithm for implementing the FCSR in software has been realized by applying the algorithm for implementing the LFSR in software. However, since FCSR is more complicated to generate than LFSR, general algorithm cannot be configured, and it can be applied only to FCSR with some restrictions.

FCSR를 생성하는 연결수도 LFSR의 원시 다항식처럼 차수와 단수를 비슷하게 정의할 수 있다. 연결수 q의 차수가 n이고 단수가 t라고 하자. 설명의 편의를 위하여 상기 수학식 3의 연결수를 계수가 0이 아닌 항의 합만으로 표현하면 하기의 수학식 9와 같이 된다.The number of concatenations that generate FCSRs can be similarly defined in degree and singularity, as in the LFSR's primitive polynomials. Assume that the order q of the coupling q is n and the singular t. For convenience of explanation, if the number of connections in Equation 3 is expressed only by the sum of terms whose coefficients are not zero, Equation 9 will be given.

(0<n1<n2<.....<nt=n) (0 <n 1 <n 2 <..... <n t = n)

따라서, 상기 수학식 4는 하기의 수학식 10과 같이 변형될 수 있다.Therefore, Equation 4 may be modified as in Equation 10 below.

FCSR를 소프트웨어로 구현하기 위한 본 발명의 알고리즘은 상기 수학식 9에서 연결수 q의 단수가 11 이하이고, n1이 32 이상인 경우에 대해서만 적용 가능하다. 실제 스트림 암호에서 FCSR가 사용될 때에는 10 정도의 단수를 가지는 100차 정도의 소수를 사용하고, 그 경우 n1이 32 이상되는 소수는 많이 있으므로 상기한 제약 조건은 실용적인 관점에서 보았을 때 큰 문제가 되지 않는다.The algorithm of the present invention for implementing FCSR in software is applicable only to the case where the number of connections q is 11 or less in Equation 9 and n 1 is 32 or more. When FCSR is used in a real stream cipher, a decimal number of about 100 orders of magnitude is used. In this case, n 1 is 32 or more, so there are many prime numbers. .

이하에서는 상기한 조건을 만족하는 연결수에 의해 생성되는 FCSR의 새로운 소프트웨어 구현 알고리즘을 도 7의 흐름도를 참고하여 설명하기로 한다. 상기한 LFSR의 소프트웨어 구현 알고리즘에서 설명한 것과 중복되는 설명은 생략하기로 한다.Hereinafter, a new software implementation algorithm of FCSR generated by the number of connections satisfying the above condition will be described with reference to the flowchart of FIG. 7. Descriptions overlapping with those described in the software implementation algorithm of the LFSR will be omitted.

[알고리즘 4] FCSR를 소프트웨어로 구현하기 위한 본 발명의 알고리즘[Algorithm 4] Algorithm of the Invention for Implementing FCSR in Software

단계 40: 변수 선언 Step 40 : Declare a Variable

을 계산한다. Calculate

② 32 비트형 변수 A1,A2,.....,Ak,T1,T2,T3,T4,M을 선언한다.② Declare 32 bit variables A 1 , A 2 , ....., A k , T 1 , T 2 , T 3 , T 4 , M.

n개의 FCSR 값을 저장하기 위한 변수 Ai(1≤i≤k)와 메모리값을 저장할 M, 그리고 부분적으로 새로운 값을 계산하여 저장할 임시 변수들을 선언하는 과정이다.The process of declaring variables A i (1≤i≤k) for storing n FCSR values, M for storing memory values, and temporary variables for partially calculating new values.

③ 32 비트형 변수 A11,A12,A13,A14,.....,Ak1,Ak2,Ak3,Ak4를 선언한다.③ Declare 32-bit variables A 11 , A 12 , A 13, A 14, ....., A k1 , A k2 , A k3 , A k4 .

Aij들은 하기의 단계 42에서 Ai에 저장된 값들을 분할하여 저장할 때 필요한 변수들이다.A ij are variables necessary for dividing and storing the values stored in A i in step 42 below.

단계 41: 초기값 설정 Step 41 : Set Initial Value

① 상기 LFSR의 소프트웨어 구현 알고리즘의 단계 31과 같은 방법으로 초기값을 설정한다.① Set an initial value in the same manner as in step 31 of the software implementation algorithm of the LFSR.

② 초기값으로 주어진 메모리값 m을 M에 저장하고, M을 왼쪽으로 28번 메모리 시프트(memory shift)시킨다. 즉, M = ( M << 28 ).② Store the given memory value m in M as the initial value, and shift M to the left by 28 times. That is, M = (M << 28).

단계 42: 변수 분할 Step 42 : Split Variable

① 초기변수 Ai(1≤i≤k)를 하기와 같은 연산을 시행하여 네 개의 변수 Ai1,Ai2,Ai3,Ai4로 분할한다.① The initial variable A i (1≤i≤k) is divided into four variables A i1 , A i2 , A i3 and A i4 by performing the following operation.

- Ai1(Ai>> 3) & 0x11111111-A i1 (A i >> 3) & 0x11111111

- Ai2(Ai>> 2) & 0x11111111-A i2 (A i >> 2) & 0x11111111

- Ai3(Ai>> 1) & 0x11111111-A i3 (A i >> 1) & 0x11111111

- Ai2(Ai) & 0x11111111-A i2 (A i ) & 0x11111111

여기서, 연산자 & 는 비트별 논리곱을 의미하고, ( B >> j )는 변수 B를 오른쪽으로 j 비트만큼 메모리 시프트하는 연산을 의미한다.Here, the operator & means logical bitwise, and (B >> j) denotes an operation of memory shifting the variable B to the right by j bits.

단계 42에서는 Ai에 저장되어 있는 32개의 초기값을 4개의 변수에 8개씩 분할하여 저장한다. 이때, 8개의 초기값은 32개의 메모리 공간 중 왼쪽으로부터 4, 8, 12, 16, 20, 24, 28, 32번째 위치에만 놓여지게 된다. 여기서는 이 위치의 비트들을 MSB( Most Significant Bit)라 한다.In step 42, 32 initial values stored in A i are divided and stored in four variables, each of eight. At this time, the eight initial values are placed only in 4th, 8th, 12th, 16th, 20th, 24th, 28th and 32nd positions from the left of the 32 memory spaces. The bits in this location are referred to here as MSB (Most Significant Bit).

변수 A1에 a0부터 a31까지의 초기값이 저장되어 있다고 가정하고, A1에 대하여 변수 분할을 하였을 때 각각의 변수에 저장되는 초기값들을 나타내면 도 8과 같다. 도 8에서는 수열 ai를 i로 간단히 표기하였다.When assuming that the initial values of the variables A 1 from a 0 to a 31 stored and hayeoteul the variable division with respect to A 1 shown in Fig. 8 indicates the initial value is stored for each variable. In Figure 8 it was simply denote the sequence a i a i.

단계 43: T1, T2, T3, T4계산 Step 43 : Calculate T 1 , T 2 , T 3 , T 4

① 상기 단계 42에서 생성한 Aij들을 이용하여, LFSR의 소프트웨어 구현 알고리즘의 단계 32와 비슷한 방법으로 T1j(1≤j≤t-1)를 계산한다. 단, 이 경우에는 Aij의 MSB들에만 실제 데이터들이 저장되어 있으므로, T1j변수들도 중요 비트 8곳에만놓이도록 LFSR의 소프트웨어 구현 알고리즘의 단계 32를 약간 변형시켜 적용한다. 즉, LFSR의 경우 메모리의 가장 왼쪽 비트는 FCSR의 경우 '중요 비트' 8곳 중 가장 왼쪽을 의미하는 것으로 변형하여 적용시킨다.① Using A ij generated in step 42, T 1j (1 ≦ j ≦ t-1) is calculated in a similar manner to step 32 of the software implementation algorithm of the LFSR. In this case, however, since the actual data is stored only in the MSBs of A ij , step 32 of the software implementation algorithm of the LFSR is slightly modified so that the T 1j variables are placed only in eight significant bits. That is, in the case of LFSR, the leftmost bit of the memory is transformed to mean the leftmost of eight 'critical bits' in the case of FCSR.

② 상기 ①에서 생성한 T1j(1≤j≤t-1)들을 정수 연산으로 더하여 T1에 저장한다.② Add T 1j (1 ≦ j ≦ t-1) generated in ① to an integer operation and store in T 1 .

③ 상기 ①과 ②의 과정을 T2, T3, T4에도 비슷하게 적용한다.③ The above steps ① and ② apply similarly to T 2 , T 3 and T 4 .

상기 ①의 과정은 메모리의 불필요한 낭비를 막기 위하여 실제 알고리즘 상에는 포함시키지 않고 상기 알고리즘 3의 단계 33에서 설명한 것과 같은 방법으로 상기 ②의 과정에 포함시킨다.In order to prevent unnecessary waste of the memory, the process of ① is included in the process of ② in the same manner as described in Step 33 of Algorithm 3, rather than included in the actual algorithm.

상기 ②의 과정에서, FCSR를 생성하는 연결수의 단수를 11 이하로 가정하였고, T1j(1≤j≤t-1)에 저장되는 각 항이 차지하는 메모리 공간이 4 비트이기 때문에, '중요 비트'들 사이의 덧셈으로 인한 자리올림(Carry)은 다른 비트에 영향을 주지 않는다.In the process of ②, it is assumed that the number of stages for generating the FCSR is 11 or less, and since the memory space occupied by each term stored in T 1j (1 ≦ j ≦ t-1) is 4 bits, 'significant bits' Carry due to addition between them does not affect the other bits.

단계 43은 상기 수학식 4의 계산 과정 중에서 하기의 수학식 11까지를 계산해 T1, T2, T3, T4에 저장한 것이다.In step 43, the following equation 11 is calculated and stored in T 1 , T 2 , T 3 , and T 4 of the calculation process of Equation 4 above.

단계 44:계산 및 M 값 갱신 Step 44 : Calculate and update M value

FCSR의 새로운 항 ak를 생성하려면, 바로 전 항에서 갱신되는 mk-1에 더해주어야 하는데, 이는 T1, T2, T3, T4변수들에 저장되어 있는 32개의 변수에 대해 순차적으로 진행한다. 이 과정을 표현하면 도 9와 같다. 도 9에서 연산기호(S1 내지 S4)는 모드(mod) 232의 정수 덧셈을, 기호 &는 비트별 논리곱을 의미하며, C[j] ( 0 ≤ j ≤ 7) 값들은 하기의 수학식 12와 같이 표현된다.To create a new term a k of FCSR, we update m k-1 which is updated in the previous term. You need to add to, which proceeds sequentially for the 32 variables stored in the T 1 , T 2 , T 3 , and T 4 variables. This process is represented in FIG. In FIG. 9, the operation symbols S1 to S4 denote integer addition of mod 2 32 , the symbol & denotes a logical bit-by-bit, and C [j] (0 ≦ j ≦ 7). It is expressed as

C[j] = (0xe0000000) >> (j×4) , ( 0 ≤ j ≤ 7)C [j] = (0xe0000000) >> (j × 4), (0 ≤ j ≤ 7)

즉, C[0] = 0xe0000000 이고, C[7] = 0x0000000e 이다.That is, C [0] = 0xe0000000 and C [7] = 0x0000000e.

한편, j = 7 일 때는 {( & C[j] ) >> 5} 연산은 의미에 맞도록 { ( & C[j] ) << 27}로 변형시켜 적용한다.On the other hand, when j = 7, the {(& C [j]) >> 5} operation is transformed into {(& C [j]) << 27} to fit the meaning.

상기 단계 44를 거치고 나면, Ti변수들에는 각각 4 비트 단위마다 상기 수학식 4의값이 저장되게 된다.After the step 44, the T i variables are expressed in Equation 4 every 4 bits. The value will be saved.

도 9의 알고리즘에서 M 값을 갱신하는 부분은, mi의 값이의 값을 이진 전개했을 때 일차항의 계수가 된다는 점에 착안하여 구성한 것이다. 즉, 각각의값이 저장된 4 비트 메모리 중 오른쪽에서 두 번째 메모리의 값을 M 값으로 취한 것이다.In the algorithm of FIG. 9, the value of M i is equal to m i . It is constructed by paying attention to the coefficient of the first term when the value of binary is expanded. That is, each The value of the second memory from the right of the 4-bit memory where the value is stored is taken as the M value.

단계 45: 변수 치환 및 새로운 항 생성 Step 45 : Replace Variables and Create New Terms

새로운 32 비트 FCSR 값을 얻고, 다음 32 비트를 얻기 위하여 다음과 같이변수를 치환한다.To get the new 32-bit FCSR value and replace the variable to get the next 32 bits:

① Ai1=A(i+1)1,Ai2=A(i+1)2,Ai3=A(i+1)3,Ai4=A(i+1)4(1 ≤ i ≤ k-1)① A i1 = A (i + 1) 1 , A i2 = A (i + 1) 2 , A i3 = A (i + 1) 3 , A i4 = A (i + 1) 4 (1 ≤ i ≤ k -One)

② Akj=Tj& 0x11111111 (1 ≤ j ≤ 4)② A kj = T j & 0x11111 111 (1 ≤ j ≤ 4)

③ Ak=(Ak1≪ 3)(Ak2≪ 2)(Ak3≪ 1)(Ak4)③ A k = (A k1 ≪ 3) (A k2 ≪ 2) (A k3 ≪ 1) (A k4 )

단계 46: 상기 단계 45의 과정이 종료되면 새로운 FCSR 32 비트가 Ak에 생성되게 되고, 다음 32 비트를 생성하기 위한 초기값 설정까지 마치게 된다. m 비트의 출력을 원한다면회만큼 상기 단계 43 내지 단계 45를 반복 실시한다.(원문에는 상기 단계 3 내지 단계 6 즉, 단계 42 내지 단계 45를 반복 실시한다고 되어있으나, 도 7을 보면 상기 단계 43 내지 단계 45를 반복 실시하는 것으로 되어 있습니다. 이 부분에 대한 확인을 부탁드립니다) Step 46 : When the process of step 45 is completed, a new FCSR 32 bits are generated in A k , and the initial value setting for generating the next 32 bits is completed. If you want to output m bits Repeat steps 43 to 45 for each time. (Originally, steps 3 to 6, that is, steps 42 to 45 are repeated, but in FIG. 7, the steps 43 to 45 are repeated. Please confirm this part.)

그러면 상기와 같은 알고리즘 4를 이용하여 FCSR을 소프트웨어로 구현하는 실시예를 설명하기로 한다.An embodiment of implementing FCSR in software using Algorithm 4 as described above will now be described.

연결수 q=289+286+243+239-1에 의해서 생성되는 FCSR를 C 프로그램 언어로 구현한 소오스 코드는 다음과 같다.The source code that implements the FCSR generated by the number of connections q = 2 89 +2 86 +2 43 +2 39 -1 in C programming language is as follows.

#include <stdio.h>#include <stdio.h>

void main()void main ()

{{

int i,j, Print_Number;int i, j, Print_Number;

unsigned long A1,A2,A3,T1,T2,T3,T4,M ; // 단계 40-②unsigned long A1, A2, A3, T1, T2, T3, T4, M; // step 40-②

unsigned long A11,A12,A13,A14,A21,A22,A23,A24unsigned long A11, A12, A13, A14, A21, A22, A23, A24

A31,A32,A33,A34 ; // 단계 40-③A31, A32, A33, A34; // step 40-③

unsigned long int K, C[8] ;unsigned long int K, C [8];

C[0] = 0xe0000000 ; // C[] : m 값을C [0] = 0xe0000000; // C []: set the value of m

C[1] = 0x0e000000 ; // update할 때 사용C [1] = 0x0e000000; // used to update

C[2] = 0x00e00000 ; // 사용C [2] = 0x00e00000; // use

C[3] = 0x000e0000 ;C [3] = 0x000e0000;

C[4] = 0x0000e000 ;C [4] = 0x0000e000;

C[5] = 0x00000e00 ;C [5] = 0x00000e00;

C[6] = 0x000000e0 ;C [6] = 0x000000e0;

C[7] = 0x0000000e ;C [7] = 0x0000000e;

K = 0x11111111 ; // 변수분할에 사용K = 0x11111111; // used for variable partitioning

A_1 = 0x55555555 ; // 단계 41A_1 = 0x55555555; // step 41

A_2 = 0x55555555 ;A_2 = 0x55555555;

A_3 = 0x55555555 ;A_3 = 0x55555555;

M = 0x00000000 << 28 ;M = 0x00000000 << 28;

Print_Number = 10000000 ; // 출력비트수 지정Print_Number = 10000000; // specify the number of output bits

Print_Number = Print_Number/32 + 1; // 반복문 횟수 지정Print_Number = Print_Number / 32 + 1; // specify the number of loops

A11 = ( A1 >> 3 ) & K ; A12 = ( A1 >> 2 ) & K ; // 단계 42A11 = (A1 >> 3) &K; A12 = (A1 >> 2) &K; // step 42

A13 = ( A1 >> 1 ) & K ; A14 = ( A1 ) & K ; // 단계 42A13 = (A1 >> 1) &K; A14 = (A1) &K; // step 42

A21 = ( A2 >> 3 ) & K ; A22 = ( A2 >> 2 ) & K ; // 단계 42A21 = (A2 >> 3) &K; A22 = (A2 >> 2) &K; // step 42

A23 = ( A2 >> 1 ) & K ; A24 = ( A2 ) & K ; // 단계 42A23 = (A2 >> 1) &K; A24 = (A2) &K; // step 42

A31 = ( A3 >> 3 ) & K ; A32 = ( A3 >> 2 ) & K ; // 단계 42A31 = (A3 >> 3) &K; A32 = (A3 >> 2) &K; // step 42

A33 = ( A3 >> 1 ) & K ; A34 = ( A3 ) & K ; // 단계 42A33 = (A3 >> 1) &K; A34 = (A3) &K; // step 42

for(i = 0 ; i < Print_Number ; i++)for (i = 0; i <Print_Number; i ++)

{{

T1 = (A14 << 4 )+(A24 >> 28) + (A13 << 8 )+(A23 >> 24) // 단계 43T1 = (A14 << 4) + (A24 >> 28) + (A13 << 8) + (A23 >> 24) // step 43

+ (A22 << 20)+(A32 >> 12) + (A22 << 24)+(A32 >> 8 ) // 단계 43+ (A22 << 20) + (A32 >> 12) + (A22 << 24) + (A32 >> 8) // step 43

T2 = (A11 << 8 )+(A21 >> 24) + (A14 << 8 )+(A24 >> 24) // 단계 43T2 = (A11 << 8) + (A21 >> 24) + (A14 << 8) + (A24 >> 24) // step 43

+ (A23 << 20)+(A33 >> 12) + (A23 << 24)+(A33 >> 8 ) // 단계 43+ (A23 << 20) + (A33 >> 12) + (A23 << 24) + (A33 >> 8) // step 43

T3 = (A12 << 8 )+(A22 >> 24) + (A11 << 12)+(A21 >> 20) // 단계 43T3 = (A12 << 8) + (A22 >> 24) + (A11 << 12) + (A21 >> 20) // step 43

+ (A24 << 20)+(A34 >> 12) + (A24 << 24)+(A34 >> 8 ) // 단계 43+ (A24 << 20) + (A34 >> 12) + (A24 << 24) + (A34 >> 8) // step 43

T4 = (A13 << 8 )+(A23 >> 24) + (A12 << 12)+(A22 >> 20) // 단계 43T4 = (A13 << 8) + (A23 >> 24) + (A12 << 12) + (A22 >> 20) // step 43

+ (A22 << 24)+(A31 >> 8 ) + (A22 << 28)+(A31 >> 4 ) // 단계 43+ (A22 << 24) + (A31 >> 8) + (A22 << 28) + (A31 >> 4) // step 43

for( j = 0 ; j < 7 ; j ++ )for (j = 0; j <7; j ++)

{{

T1 = T1 + M ; // 단계 44T1 = T1 + M; // step 44

M = ( T1 & C[j] ) >> 1 ; // 단계 44M = (T1 & C [j]) >> 1; // step 44

T2 = T2 + M ; // 단계 44T2 = T2 + M; // step 44

M = ( T2 & C[j] ) >> 1 ; // 단계 44M = (T2 & C [j]) >> 1; // step 44

T3 = T3 + M ; // 단계 44T3 = T3 + M; // step 44

M = ( T3 & C[j] ) >> 1 ; // 단계 44M = (T3 & C [j]) >> 1; // step 44

T4 = T4 + M ; // 단계 44T4 = T4 + M; // step 44

M = ( T4 & C[j] ) >> 5 ; // 단계 44M = (T4 & C [j]) >> 5; // step 44

}}

T1 = T1 + M ; // 단계 44T1 = T1 + M; // step 44

M = ( T1 & C[j] ) >> 1 ; // 단계 44M = (T1 & C [j]) >> 1; // step 44

T2 = T2 + M ; // 단계 44T2 = T2 + M; // step 44

M = ( T2 & C[j] ) >> 1 ; // 단계 44M = (T2 & C [j]) >> 1; // step 44

T3 = T3 + M ; // 단계 44T3 = T3 + M; // step 44

M = ( T3 & C[j] ) >> 1 ; // 단계 44M = (T3 & C [j]) >> 1; // step 44

T4 = T4 + M ; // 단계 44T4 = T4 + M; // step 44

M = ( T4 & C[j] ) << 27; // 단계 44M = (T4 & C [j]) << 27; // step 44

A11 = A21 ; A12 = A22 ; A13 = A23 ; A14 = A24 ; // 단계 45-①A11 = A21; A12 = A22; A13 = A23; A14 = A24; // step 45-①

A21 = A31 ; A22 = A32 ; A23 = A33 ; A24 = A34 ; // 단계 45-①A21 = A31; A22 = A32; A23 = A33; A24 = A34; // step 45-①

A31 = T1 & K ; A32 = T2 & K ; // 단계 45-②A31 = T1 &K; A32 = T2 &K; // step 45-②

A33 = T3 & K ; A34 = T4 & K ; // 단계 45-②A33 = T3 &K; A34 = T4 &K; // step 45-②

A3 = ( A31 << 3) ^ ( A32 << 2 ) ^ ( A33 << 1) ^ A34 ; // 단계 45-③A3 = (A31 << 3) ^ (A32 << 2) ^ (A33 << 1) ^ A34; // step 45-③

printf("%08x",A3) ; // 출력printf ("% 08x", A3); // Print

}}

}}

상술한 바와 같이 본 발명은 불필요한 메모리의 낭비와 원시 다항식의 차수만큼 소요되었던 반복문의 횟수를 감소시킨다. 그러므로 종래의 FCSR 및 LFSR의 소프트웨어 구현 방식보다 30배 내지 300배 정도 빠른 알고리즘의 구현이 가능해지며, 알고리즘을 구현하는 데 필요한 메모리도 감소된다.As described above, the present invention reduces unnecessary memory waste and the number of iterations that were required by the order of the primitive polynomial. Therefore, the algorithm can be implemented 30 to 300 times faster than the software implementation of the conventional FCSR and LFSR, and the memory required to implement the algorithm is also reduced.

스트림 암호는 실제 대부분 응용환경에서 16 내지는 32 비트 단위로 전송되는데, 1 비트씩 생성되는 기존의 LFSR의 소프트웨어 구현 방식은 전송 단위만큼의 데이터가 만들어질 때까지 메모리에 저장되므로 이를 위한 별도의 저장 공간과 알고리즘을 필요로 했다. 그러나 본 발명의 알고리즘을 스트림 암호의 내부 논리로 사용하면 이러한 문제가 효과적으로 해결된다. 또한, 동일한 알고리즘을 하드웨어에 적용시킴으로써 하드웨어적으로도 고속 구현이 가능해진다.Stream ciphers are actually transmitted in 16 or 32 bit units in most application environments. The existing LFSR software implementation, which is generated by 1 bit, is stored in memory until data as much as the transmission unit is created. And needed an algorithm. However, using the algorithm of the present invention as the internal logic of the stream cipher effectively solves this problem. In addition, by applying the same algorithm to the hardware, it is possible to implement a high speed in hardware.

Claims (6)

변수의 갯수(k)를 계산한 후 n개의 LFSR 값을 저장하기 위한 변수와 새로운 값을 계산하여 저장할 템프를 선언하고 임시변수를 선언하는 제 1 단계와,A first step of declaring a variable to store the number of LFSR values after calculating the number of variables (k), declaring a temp to store the new value, and declaring a temporary variable; 초기값으로 주어진 n개의 값을 상기 LFSR 값을 저장하기 위한 변수에 대입하여 저장한 후 남은 변수의 왼쪽 메모리 부분을 0으로 채우는 제 2 단계와,A second step of filling the left memory part of the remaining variable with zero by assigning n values given as initial values to a variable for storing the LFSR value, and 상기 n개의 LFSR 값을 저장하기 위한 변수를 메모리 시프트 연산과 비트별 배타적 논리합 연산을 이용하여 임시변수의 메모리에 순차적으로 저장한 후 상기 n개의 LFSR 값을 저장하기 위한 변수를 조합하여 임시변수의 메모리에 순차적으로 저장하는 제 3 단계와,The variables for storing the n LFSR values are sequentially stored in the memory of the temporary variable by using a memory shift operation and an exclusive OR operation for each bit, and then the variables for storing the n LFSR values are combined to store the memory of the temporary variable. A third step of storing sequentially in n개의 LFSR 값을 저장하기 위한 템프를 계산하는 제 4 단계와,a fourth step of calculating a temp for storing n LFSR values, 새로운 LFSR 값들을 갱신하기 위하여 변수 치환을 실시하는 제 5 단계와,A fifth step of performing variable substitution to update new LFSR values; 원하는 비트의 출력을 얻을 때까지 상기 제 3 내지 제 5 단계의 과정을 반복 진행하는 제 6 단계를 포함하여 이루어지는 것을 특징으로 하는 시프트 레지스터의 소프트웨어 구현 알고리즘.And a sixth step of repeating the processes of the third to fifth steps until an output of a desired bit is obtained. 제 1 항에 있어서,The method of claim 1, 상기 제 1 단계에서 상기 변수의 갯수(k)는 하기의 수학식 13에 의해 계산되는 것을 특징으로 하는 시프트 레지스터의 소프트웨어 구현 알고리즘.The number k of the variable in the first step is calculated by the following equation (13). 변수의 갯수(k)를 계산한 후 n개의 FCSR 값을 저장하기 위한 변수와 메모리 값을 저장할 메모리 변수 및 새로운 값을 계산하여 저장할 임시 변수들을 선언하고 상기 n개의 FCSR 값을 저장하기 위한 변수에 저장된 값들을 분할하여 저장할 때 필요한 변수를 선언하는 제 1 단계와,After calculating the number of variables (k), declare a variable to store n FCSR values, a memory variable to store memory values, and temporary variables to calculate and store a new value, and store the variable to store the n FCSR values. A first step of declaring a variable necessary for dividing and storing the values; 초기값으로 주어진 n개의 값을 상기 n개의 FCSR 값을 저장하기 위한 변수에 대입하여 저장하고 남은 변수의 왼쪽 메모리 부분을 0으로 채운 다음 초기값으로 주어진 메모리값을 상기 메모리 변수에 저장하고 상기 메모리 변수를 왼쪽으로 메모리 시프트시키는 제 2 단계와,The n values given as initial values are stored in the variables for storing the n FCSR values, the left memory portion of the remaining variables are filled with 0, and the memory values given as initial values are stored in the memory variables. A second step of memory shifting to the left; 초기변수에 저장된 초기값을 네 개의 변수로 분할하여 저장하는 제 3 단계와,A third step of dividing and storing the initial value stored in the initial variable into four variables; 상기 제 3 단계에서 생성된 분할된 변수들을 이용하여 LFSR의 임시변수를 계산한 후 계산된 상기 임시변수를 정수연산으로 더하여 저장하는 제 4 단계와,A fourth step of calculating a temporary variable of the LFSR using the divided variables generated in the third step and storing the calculated temporary variable by adding it to an integer operation; FCSR의 새로운 항을 생성하기 위하여 전 항에서 갱신된 메모리를 정수합에 더해주는 과정을 임시변수들에 저장된 변수에 대해 순차적으로 진행하는 제 5 단계와,A fifth step of sequentially adding the memory updated in the previous term to the integer sum to generate a new term of the FCSR, for the variables stored in the temporary variables; 각각의 정수합이 저장된 메모리 중 오른 쪽에서 두번째의 값을 메모리 값으로 갱신하는 제 6 단계와,A sixth step of updating a second value from the right of the memory in which each integer sum is stored to the memory value; 새로운 32 비트 FCSR 값을 얻고난 후 다음 32 비트를 얻기 위하여 변수를 치환하는 제 7 단계와,A seventh step of obtaining a new 32-bit FCSR value and substituting a variable to obtain the next 32 bits, 원하는 비트의 출력을 얻을 때까지 상기 제 4 단계 및 제 7 단계의 과정을 반복 실시하는 제 8 단계를 포함하여 이루어지는 것을 특징으로 하는 시프트 레지스터의 소프트웨어 구현 알고리즘.And an eighth step of repeating the steps of the fourth and seventh steps until an output of a desired bit is obtained. 제 3 항에 있어서,The method of claim 3, wherein 상기 제 1 단계에서 상기 변수의 갯수(k)는 하기의 수학식 14에 의해 계산되는 것을 특징으로 하는 시프트 레지스터의 소프트웨어 구현 알고리즘.The number k of the variable in the first step is calculated by the following equation (14). 제 3 항에 있어서,The method of claim 3, wherein 상기 제 3 단계에서 상기 변수의 분할은 하기와 같이 이루어지는 것을 특징으로 하는 시프트 레지스터의 소프트웨어 구현 알고리즘.And wherein said partitioning of said variable in said third step is performed as follows. ① Ai1(Ai>> 3) & 0x11111111① A i1 (A i >> 3) & 0x11111111 ② Ai2(Ai>> 2) & 0x11111111② A i2 (A i >> 2) & 0x11111111 ③ Ai3(Ai>> 1) & 0x11111111③ A i3 (A i >> 1) & 0x11111111 ④ Ai2(Ai) & 0x11111111④ A i2 (A i ) & 0x11111111 제 3 항에 있어서,The method of claim 3, wherein 상기 제 7 단계의 변수 치환은 하기와 같이 이루어지는 것을 특징으로 하는 시프트 레지스터의 소프트웨어 구현 알고리즘.The variable substitution of the seventh step is performed as follows. ① Ai1=A(i+1)1,Ai2=A(i+1)2,Ai3=A(i+1)3,Ai4=A(i+1)4(1 ≤ i ≤ k-1)① A i1 = A (i + 1) 1 , A i2 = A (i + 1) 2 , A i3 = A (i + 1) 3 , A i4 = A (i + 1) 4 (1 ≤ i ≤ k -One) ② Akj=Tj& 0x11111111 (1 ≤ j ≤ 4)② A kj = T j & 0x11111 111 (1 ≤ j ≤ 4) ③ Ak=(Ak1≪ 3)(Ak2≪ 2)(Ak3≪ 1)(Ak4)③ A k = (A k1 ≪ 3) (A k2 ≪ 2) (A k3 ≪ 1) (A k4 )
KR10-2001-0071307A 2001-11-16 2001-11-16 Method for embodying a shift register in software KR100427672B1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
KR10-2001-0071307A KR100427672B1 (en) 2001-11-16 2001-11-16 Method for embodying a shift register in software

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
KR10-2001-0071307A KR100427672B1 (en) 2001-11-16 2001-11-16 Method for embodying a shift register in software

Publications (2)

Publication Number Publication Date
KR20030039913A true KR20030039913A (en) 2003-05-22
KR100427672B1 KR100427672B1 (en) 2004-04-28

Family

ID=29569748

Family Applications (1)

Application Number Title Priority Date Filing Date
KR10-2001-0071307A KR100427672B1 (en) 2001-11-16 2001-11-16 Method for embodying a shift register in software

Country Status (1)

Country Link
KR (1) KR100427672B1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100945241B1 (en) * 2008-09-04 2010-03-03 한국전자통신연구원 The method of software implementation of feedback with carry shift register

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101700350B1 (en) 2016-08-10 2017-01-31 주식회사 픽슨 Strong corrosion-resistant spiral rib steel pipe a manufacture method

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH03204721A (en) * 1990-01-08 1991-09-06 Hitachi Ltd Random number generating circuit
KR100206128B1 (en) * 1996-10-21 1999-07-01 윤종용 Built-in self test circuit
KR100250468B1 (en) * 1997-12-19 2000-04-01 정선종 A method to build a random number generator using correlation immune function
KR100308893B1 (en) * 1999-04-16 2001-09-26 권 기 홍 Extended rc4 chipher algorithm using lfsr

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100945241B1 (en) * 2008-09-04 2010-03-03 한국전자통신연구원 The method of software implementation of feedback with carry shift register

Also Published As

Publication number Publication date
KR100427672B1 (en) 2004-04-28

Similar Documents

Publication Publication Date Title
US4493046A (en) Apparatus for generation of binary pseudo-random numbers
CN102084335B (en) Implementation of arbitrary galois field arithmetic on a programmable processor
JP4460047B2 (en) Galois field multiplication system
JP5266354B2 (en) Galois expansion field, integration / integration addition, product-sum operation unit
US20030061561A1 (en) Method, apparatus, and product for use in generating CRC and other remainder based codes
KR100309724B1 (en) Reed solomon coding apparatus and reed solomon coding method
US20030135530A1 (en) Flexible galois field multiplier
US10768898B2 (en) Efficient modulo calculation
EP3769208B1 (en) Stochastic rounding logic
JP3274668B2 (en) Arithmetic processing device and arithmetic processing method
CN112650471A (en) Processor and method for processing masked data
US6751773B2 (en) Coding apparatus capable of high speed operation
JP2008304921A (en) Improved modular reduction operator
KR100427672B1 (en) Method for embodying a shift register in software
US6609142B1 (en) Method of performing multiplication with accumulation in a Galois body
Jeong et al. VLSI array synthesis for polynomial GCD computation and application to finite field division
US6484192B1 (en) Root finding method and root finding circuit of quadratic polynomial over finite field
US6138134A (en) Computational method and apparatus for finite field multiplication
JP2004038020A (en) Cryptographic pseudo-random number generator and program
US5862159A (en) Parallelized cyclical redundancy check method
JP2004220377A (en) Reconfigurable circuit, and integrated circuit device and data conversion device capable of using it
Jeong et al. VLSI array synthesis for polynomial GCD computation
Fúster-Sabater et al. A simple computational model for acceptance/rejection of binary sequence generators
US6470369B1 (en) Euclid mutual division arithmetic circuit and processing circuit
KR100761132B1 (en) Apparatus and method for computing SHA-1

Legal Events

Date Code Title Description
A201 Request for examination
E902 Notification of reason for refusal
E701 Decision to grant or registration of patent right
GRNT Written decision to grant
FPAY Annual fee payment

Payment date: 20090324

Year of fee payment: 6

LAPS Lapse due to unpaid annual fee