Abstract:
A block-based stream encryption/decryption processing method for applying a matrix architecture of diffusion algebra includes the steps of (a) selecting a private key and a pairing private key; (b) selecting a plaintext and multiplying the plaintext with the private key to produce a ciphertext; (c) multiplying the ciphertext with the pairing private key to obtain the plaintext; and (d) repeating the steps (b) and (c) to produce encrypted or decrypted block streams.

Description:
BACKGROUND OF THE INVENTION 
       [0001]    1. Field of the Invention 
         [0002]    The present invention relates to a real-time encryption/decryption method for stream images, and more particularly to a method of encrypting/decrypting a block matrix by diffusion algebra. 
         [0003]    2. Description of the Related Art 
         [0004]    In a traditional stream encryption/decryption method, the operation of nonlinear combined functions and the feedback of shift registers are used to obtain a plurality of bits continuously and sequentially from the registers and perform an XOR operation with a plaintext stream to produce a ciphertext stream. As to decryptions, a similar XOR operation is performed with the ciphertext stream to sequentially obtain the plaintext stream. 
         [0005]    One of the requirements for a real time encryption/decryption is to minimize the wait time of an encryption/decryption process, and the prior art uses a bit as a unit for the simple and quick operations of the one-bit encryption and the real time one-bit decryption. 
         [0006]    The output value of the prior art depends on the nonlinear functions and encryption streams, and thus images have to be played from the beginning and cannot be accessed randomly. Based on the consideration of safety, one bit can be processed at a time, if a bit is used as the unit of processing an encryption/decryption. 
       SUMMARY OF THE INVENTION  
       [0007]    The comparison between the prior art and the present invention is described below: 
         [0008]    1. Output: The prior art outputs one bit at a time, and the present invention outputs a block at a time. 
         [0009]    2. Playback: The prior art has to start from the beginning, and the present invention accesses randomly. 
         [0010]    3. Cracking: The present invention adopts a two-dimensional matrix multiplication for converting plaintext and ciphertext, and thus the level of difficulty for the decryption is higher and more complicated than the one-dimensional matrix multiplication of the prior art. 
         [0011]    4. Speed: The matrix multiplication method adopts an instruction to complete a Single Instruction Multiple Data (SIMD) operation to comply with the real time requirement. 
         [0012]    The technical measures taken by the present invention are described as follows: 
         [0013]    The present invention adopts a matrix architecture of diffusion algebra directly to carry out the steps of selecting a private key and a pairing private key, multiplying the private key with a plaintext to produce a ciphertext, multiplying the pairing private key with the ciphertext to obtain the plaintext, and using a single instruction operation to produce a block stream quickly. 
     
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         [0014]      FIG. 1  is a flow chart of a private key and a pairing private key in accordance with the present invention; 
           [0015]      FIG. 2  is a flow chart of encrypting and decrypting a block stream in accordance with the present invention; 
           [0016]      FIG. 3A  is a plaintext image in accordance with the present invention; 
           [0017]      FIG. 3B  is a ciphertext image in accordance with the present invention; 
           [0018]      FIG. 4A  is a grid plaintext image in accordance with the present invention; 
           [0019]      FIG. 4B  is a grid ciphertext image in accordance with the present invention; 
           [0020]      FIG. 5  is a flow chart of encryption and decryption using two pairs of keys in accordance with the present invention; 
           [0021]      FIG. 6A  is a ciphertext image encrypted by the two keys in accordance with the present invention; 
           [0022]      FIG. 6B  is a grid ciphertext image encrypted by the two keys in accordance with the present invention; 
       
    
    
     DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS 
       [0023]    The block-based stream encryption/decryption method of the invention directly applies a matrix architecture of diffusion algebra, and the method comprises: 
         [0024]    I. Symbols and Definitions of Diffusion Algebra 
         [0025]    S: Bit matrix composed of n×n elements, where n&gt;0. 
         [0026]    I: Unit matrix of S 
         [0027]    ⊕: Bit addition is the same as the XOR operation of Boolean algebra. 
         [0028]    For example, (a) 1⊕0=1 and (b) 1⊕1=0 
         [0029]    {circle around (×)}: Bit multiplication is the same as the AND operation of Boolean algebra. 
         [0030]    For example, (a) 1{circle around (×)}0=0 and (b) 1{circle around (×)}1=1 
         [0031]    +: Matrix addition, such as (a) S=A+B         s i,j =a i,j ⊕b i,j    
         [0032]    ×: Matrix multiplication, such as (a) 
         [0000]    
       
         
           
             S 
             = 
             
               
                 
                   A 
                   × 
                   B 
                 
                 ⇒ 
                 
                   s 
                   
                     i 
                     , 
                     j 
                   
                 
               
               = 
               
                 
                   ⊕ 
                   
                     k 
                     = 
                     1 
                   
                   n 
                 
                  
                 
                   
                     a 
                     
                       i 
                       , 
                       k 
                     
                   
                   ⊗ 
                   
                     b 
                     
                       k 
                       , 
                       j 
                     
                   
                 
               
             
           
         
       
     
         [0033]    S i : S to the power of i. 
         [0034]    For example, (a) S 0 =S, (b) S 1 =S×S (c) S i ×S j =S i+j+1    
         [0035]    T: a cycle, S T =S, T&gt;0. 
         [0036]    P: a prime number, SεP         S T−1 =I. NP: a non prime number. 
         [0037]    For example, (a) IεP, (b) P×PεP and (c) P×NPεNP 
         [0038]    II. Relation Between Diffusion Algebra and Linear Algebra 
         [0039]    a. Matrix Product of Diffusion Algebra 
         [0040]    (1) The S-bit matrix is composed of n×n elements, where n&gt;0. In other words, the S-bit matrix is a square matrix composed of 0 and 1. 
         [0041]    (2) The product of the diffusion is a remainder obtained by dividing the matrix product by 2 in linear algebra, and 0 remains unchanged, and an even number equal to 0, and an odd number equals to 1. 
         [0042]    (3) S multiplied by a unit matrix I is equal to S. 
         [0043]    b. Determination of a Prime Number 
         [0044]    Power Operation S T−1 =I of Diffusion algebra. 
         [0045]    The bit matrix keeps multiplying itself to form a n×n unit matrix. 
         [0046]    Determinant Operation |S|=1 of Diffusion algebra 
         [0047]    The value of a determinant of a matrix is calculated by linear algebra for determining the existence of an inverse matrix. As interpreted by diffusion algebra, the positive or negative sign of the value of a number represents the number; the even number is equal to 0, and the odd number is equal to 1. Therefore, |S|=1, where S is a prime number. 
         [0048]    c. Formation of Private Key 
         [0049]    A private key is formed by a private key e and a pairing private key d as follows: 
         [0050]    e=S and d=S T−2  of diffusion algebra. 
         [0051]    and S T =S, T&gt;0, where T is a cycle period. 
         [0052]    e=S and d=S −1  of Linear Algebra 
         [0053]    If the value of the determinant of the linear algebra is an odd number, then the inverse matrix can be replaced with an adjoint matrix by diffusion algebra, and the value of its even number is changed to 0, and the value of its odd number is changed to 1. 
         [0054]    III. Basic Principle of Encryption and Decryption 
         [0055]    a. Process of selecting a private key: 
         [0056]    A private key e and a pairing private key d as shown in  FIG. 1  are selected: 
         [0057]    1. |S|=1; 
         [0058]    2. S T−1 =I; 
         [0059]    3. if e=S then d=S T−2 ; 
         [0060]    b. Process of Encryption/Decryption: 
         [0061]    The two types of operations are shown in  FIG. 2 : 
         [0062]    1. C=M×e (Encryption); M=C×d (Decryption). 
         [0063]    2. C=e×M (Encryption); M=d×C (Decryption). 
         [0064]    A preferred embodiment of the encryption/decryption is described below: 
         [0065]    To make our examiner easier to understand the technical characteristics of the present invention, we give the description on determining a prime number, performing a matrix multiplication and finding a private key by diffusion algebra as follows. An n×n matrix, where n=8 (which is an 8×8 matrix) as shown in Table 1 is used for illustration. 
         [0000]    
       
         
               
             
           
               
                 TABLE 1 
               
               
                   
               
             
             
               
                 
                   
                     
                       
                         S 
                         = 
                         
                           [ 
                           
                             
                               
                                 1 
                               
                               
                                 0 
                               
                               
                                 1 
                               
                               
                                 0 
                               
                               
                                 0 
                               
                               
                                 0 
                               
                               
                                 1 
                               
                               
                                 1 
                               
                             
                             
                               
                                 0 
                               
                               
                                 1 
                               
                               
                                 1 
                               
                               
                                 1 
                               
                               
                                 1 
                               
                               
                                 0 
                               
                               
                                 1 
                               
                               
                                 1 
                               
                             
                             
                               
                                 0 
                               
                               
                                 1 
                               
                               
                                 1 
                               
                               
                                 0 
                               
                               
                                 1 
                               
                               
                                 1 
                               
                               
                                 0 
                               
                               
                                 0 
                               
                             
                             
                               
                                 1 
                               
                               
                                 0 
                               
                               
                                 1 
                               
                               
                                 0 
                               
                               
                                 1 
                               
                               
                                 0 
                               
                               
                                 0 
                               
                               
                                 0 
                               
                             
                             
                               
                                 1 
                               
                               
                                 0 
                               
                               
                                 0 
                               
                               
                                 0 
                               
                               
                                 1 
                               
                               
                                 1 
                               
                               
                                 1 
                               
                               
                                 1 
                               
                             
                             
                               
                                 1 
                               
                               
                                 1 
                               
                               
                                 1 
                               
                               
                                 1 
                               
                               
                                 1 
                               
                               
                                 0 
                               
                               
                                 1 
                               
                               
                                 0 
                               
                             
                             
                               
                                 1 
                               
                               
                                 0 
                               
                               
                                 1 
                               
                               
                                 0 
                               
                               
                                 0 
                               
                               
                                 0 
                               
                               
                                 0 
                               
                               
                                 1 
                               
                             
                             
                               
                                 0 
                               
                               
                                 0 
                               
                               
                                 1 
                               
                               
                                 1 
                               
                               
                                 0 
                               
                               
                                 1 
                               
                               
                                 0 
                               
                               
                                 0 
                               
                             
                           
                           ] 
                         
                       
                     
                   
                 
               
               
                   
               
             
          
         
       
     
         [0066]    a. Determination of Prime Number 
         [0067]    The value |S|=−9 of the determinant of a matrix is calculated by linear algebra. As to diffusion algebra, the positive and negative sign of the value of a number represents the number, and the even number is equal to 0, and the odd number is equal to 1. Therefore, |S|=1, where S is a prime number. 
         [0068]    b. Operation of Matrix Multiplication 
         [0069]    The result is the same as the matrix product obtained by linear algebra, and the even number is changed to 0, and the odd number is changed to 1, and thus the S×S matrix is shown in Table 2: 
         [0000]    
       
         
               
             
           
               
                 TABLE 2 
               
               
                   
               
             
             
               
                 
                   
                     
                       
                         
                           S 
                           × 
                           S 
                         
                         = 
                         
                           [ 
                           
                             
                               
                                 0 
                               
                               
                                 1 
                               
                               
                                 0 
                               
                               
                                 1 
                               
                               
                                 1 
                               
                               
                                 0 
                               
                               
                                 1 
                               
                               
                                 0 
                               
                             
                             
                               
                                 1 
                               
                               
                                 0 
                               
                               
                                 1 
                               
                               
                                 0 
                               
                               
                                 0 
                               
                               
                                 1 
                               
                               
                                 0 
                               
                               
                                 1 
                               
                             
                             
                               
                                 0 
                               
                               
                                 1 
                               
                               
                                 1 
                               
                               
                                 0 
                               
                               
                                 0 
                               
                               
                                 0 
                               
                               
                                 1 
                               
                               
                                 0 
                               
                             
                             
                               
                                 0 
                               
                               
                                 1 
                               
                               
                                 0 
                               
                               
                                 0 
                               
                               
                                 0 
                               
                               
                                 0 
                               
                               
                                 0 
                               
                               
                                 0 
                               
                             
                             
                               
                                 0 
                               
                               
                                 1 
                               
                               
                                 0 
                               
                               
                                 0 
                               
                               
                                 0 
                               
                               
                                 0 
                               
                               
                                 1 
                               
                               
                                 1 
                               
                             
                             
                               
                                 0 
                               
                               
                                 0 
                               
                               
                                 1 
                               
                               
                                 1 
                               
                               
                                 0 
                               
                               
                                 0 
                               
                               
                                 1 
                               
                               
                                 0 
                               
                             
                             
                               
                                 1 
                               
                               
                                 1 
                               
                               
                                 1 
                               
                               
                                 1 
                               
                               
                                 1 
                               
                               
                                 0 
                               
                               
                                 1 
                               
                               
                                 1 
                               
                             
                             
                               
                                 0 
                               
                               
                                 0 
                               
                               
                                 1 
                               
                               
                                 1 
                               
                               
                                 1 
                               
                               
                                 1 
                               
                               
                                 1 
                               
                               
                                 0 
                               
                             
                           
                           ] 
                         
                       
                     
                   
                 
               
               
                   
               
             
          
         
       
     
         [0070]    c. Finding a Private Key: 
         [0071]    a. Select a private key e and a pairing private key d to obtain an inverse matrix by linear algebra, and the even number is changed to 0, and the odd number is changed to 1. 
         [0072]    b. If the inverse matrix of the private key is not an integer, then an adjoint matrix of the linear algebra can be used. The even number is changed to 0, and the odd number is changed to 1. 
         [0073]    c. Adopt a raise-to-power operation d=S T−2  by diffusion algebra, and e is equal to S. 
         [0074]    Find d=S −1  by linear algebra or d=S T−2  by diffusion algebra, where T=8 as shown in Table 3: 
         [0000]    
       
         
               
             
           
               
                 TABLE 3 
               
               
                   
               
             
             
               
                 
                   
                     
                       
                         d 
                         = 
                         
                           
                             S 
                             
                               - 
                               1 
                             
                           
                           = 
                           
                             
                               S 
                               
                                 T 
                                 - 
                                 2 
                               
                             
                             = 
                             
                               [ 
                               
                                 
                                   
                                     1 
                                   
                                   
                                     1 
                                   
                                   
                                     1 
                                   
                                   
                                     0 
                                   
                                   
                                     0 
                                   
                                   
                                     0 
                                   
                                   
                                     0 
                                   
                                   
                                     1 
                                   
                                 
                                 
                                   
                                     1 
                                   
                                   
                                     0 
                                   
                                   
                                     1 
                                   
                                   
                                     0 
                                   
                                   
                                     1 
                                   
                                   
                                     0 
                                   
                                   
                                     0 
                                   
                                   
                                     0 
                                   
                                 
                                 
                                   
                                     0 
                                   
                                   
                                     1 
                                   
                                   
                                     0 
                                   
                                   
                                     0 
                                   
                                   
                                     0 
                                   
                                   
                                     1 
                                   
                                   
                                     1 
                                   
                                   
                                     0 
                                   
                                 
                                 
                                   
                                     0 
                                   
                                   
                                     0 
                                   
                                   
                                     1 
                                   
                                   
                                     1 
                                   
                                   
                                     1 
                                   
                                   
                                     1 
                                   
                                   
                                     1 
                                   
                                   
                                     0 
                                   
                                 
                                 
                                   
                                     1 
                                   
                                   
                                     0 
                                   
                                   
                                     1 
                                   
                                   
                                     1 
                                   
                                   
                                     0 
                                   
                                   
                                     1 
                                   
                                   
                                     1 
                                   
                                   
                                     1 
                                   
                                 
                                 
                                   
                                     0 
                                   
                                   
                                     1 
                                   
                                   
                                     1 
                                   
                                   
                                     1 
                                   
                                   
                                     1 
                                   
                                   
                                     0 
                                   
                                   
                                     0 
                                   
                                   
                                     1 
                                   
                                 
                                 
                                   
                                     1 
                                   
                                   
                                     0 
                                   
                                   
                                     0 
                                   
                                   
                                     0 
                                   
                                   
                                     0 
                                   
                                   
                                     0 
                                   
                                   
                                     1 
                                   
                                   
                                     0 
                                   
                                 
                                 
                                   
                                     1 
                                   
                                   
                                     0 
                                   
                                   
                                     1 
                                   
                                   
                                     0 
                                   
                                   
                                     0 
                                   
                                   
                                     1 
                                   
                                   
                                     0 
                                   
                                   
                                     1 
                                   
                                 
                               
                               ] 
                             
                           
                         
                       
                     
                   
                 
               
               
                   
               
             
          
         
       
     
         [0075]    IV. Practical Application of Image 
         [0076]    Select an image: Mona Lisa, 512×512 bits; 
         [0077]    a pair of keys: e, d, T=16; 
         [0078]    a private key: e, 16×16 bits (as shown in Table 4); and 
         [0079]    a pairing private key: d, 16×16 bits. 
         [0000]    
       
         
               
               
               
             
           
               
                   
                 TABLE 4 
               
               
                   
                   
               
               
                   
                 e: e = S 
                 d: d = S 14   
               
               
                   
                   
               
             
             
               
                   
                 0001101110100111 
                 0001110011001110 
               
               
                   
                 1000101100100001 
                 0010111000000111 
               
               
                   
                 0111011110000111 
                 0001000100000001 
               
               
                   
                 0110111001100101 
                 1100000011111101 
               
               
                   
                 1100000100000001 
                 0010000010100101 
               
               
                   
                 1011011111010110 
                 0011001000000011 
               
               
                   
                 1100110000100011 
                 1100101100000010 
               
               
                   
                 0000010000111000 
                 0010111001010000 
               
               
                   
                 1000100000001000 
                 0100100011100110 
               
               
                   
                 1110010011100110 
                 1000000000011000 
               
               
                   
                 1110000101100000 
                 1000110110100000 
               
               
                   
                 0010100010010101 
                 1000001001001000 
               
               
                   
                 0011001101110010 
                 0011110011101011 
               
               
                   
                 0101110010110010 
                 1110111110000011 
               
               
                   
                 1001101110011100 
                 1011101101010110 
               
               
                   
                 0100101001011101 
                 0001010010011001 
               
               
                   
                   
               
             
          
         
       
     
         [0080]    Method: C=e×M (Encryption); M=d×C (Decryption). 
         [0081]    Process: 16×16 bits constitute a block, and a divided image constitutes 32×32 blocks. A block is selected sequentially from left to right and from up to bottom. The block is encrypted or decrypted at real time, and thus this method is called a block streaming. 
         [0082]    V. Basic Anti-Hacker Process: A Single Block is Used for Deriving the Password. 
         [0083]    If a plaintext block is obtained in an encryption process, and the block is a prime number, then the ciphertext block can be intercepted by others easily to derive the private key e and crack the whole stream data or disable the encryption function. In general, a vast majority of movies or photos are non prime numbers. In the example of a Mona Lisa photo as shown in  FIG. 3A , all blocks in the image plaintext are non prime numbers, and the encrypted image ciphertext is shown in  FIG. 3B . Since the values of two adjacent columns or rows of most photos or animation screens are equal, therefore most of the blocks are non prime numbers. Once if there is a prime number, two repeated rows or columns of the block of the image ciphertext are processed as non prime numbers. 
         [0084]    Alternatively, a row or column with a zero value is added to the block. For example, 15×15 bits constitute a block, and the divided image constitutes 34×34 blocks. If the block is encrypted, the block is mapped onto a 16×16 bit zero block to form a grid image plaintext as shown in  FIG. 4A  first, and then the grid image plaintext is encrypted to produce an image ciphertext as shown in  FIG. 4B , and such arrangement can reduce the risk of having a hacker to crack the private key e from the ciphertext block. 
         [0085]    VI. Advanced Anti-Hacker Process: Continuous Blocks are Used to Derive the Password. 
         [0086]    If a plurality of plaintext blocks are obtained in an encryption process, and the number of 1 in the rows or columns of each block is too small or the sum of the blocks is a prime number, then the ciphertext blocks can be used for deriving the password. In this method, at least one pair of keys such as p, q can be added, and the cycle T=30705 as shown in  FIG. 5  and Table 5: 
         [0000]    
       
         
           
             
               Method 
                
               
                 : 
               
                
               
                 
                   
                     
                       C 
                       = 
                       
                         
                           e 
                           t 
                         
                         × 
                         M 
                       
                     
                   
                 
                 
                   
                     
                       ( 
                       
                         
                           e 
                           t 
                         
                         = 
                         
                           e 
                           × 
                           
                             p 
                             t 
                           
                         
                       
                       ) 
                     
                   
                 
               
                
               
                 ( 
                 Encryption 
                 ) 
               
             
             ; 
             
               
                 
                   
                     
                       M 
                       = 
                       
                         
                           d 
                           t 
                         
                         × 
                         C 
                       
                     
                   
                 
                 
                   
                     
                       ( 
                       
                         
                           d 
                           t 
                         
                         = 
                         
                           
                             q 
                             t 
                           
                           × 
                           d 
                         
                       
                       ) 
                     
                   
                 
               
                
               
                 
                   ( 
                   Decryption 
                   ) 
                 
                 . 
               
             
           
         
       
     
         [0000]    
       
         
               
               
               
             
           
               
                   
                 TABLE 5 
               
               
                   
                   
               
               
                   
                 p: p = S 
                 q: q = S 30703   
               
               
                   
                   
               
             
             
               
                   
                 1011110111110111 
                 1000111000001001 
               
               
                   
                 1100011111001111 
                 1010111011111001 
               
               
                   
                 1011011000100011 
                 1101100101010001 
               
               
                   
                 0011111011001000 
                 0101010010110110 
               
               
                   
                 1011101111110101 
                 1011101000000101 
               
               
                   
                 0000111101011110 
                 0010010000100011 
               
               
                   
                 1111110010000110 
                 0101111010001010 
               
               
                   
                 1110010011110100 
                 1000111110010010 
               
               
                   
                 1100000111001010 
                 0100010111000000 
               
               
                   
                 1110110100101111 
                 0010111111000001 
               
               
                   
                 1011101001000111 
                 0001011110011111 
               
               
                   
                 1110000010000001 
                 0010011101000100 
               
               
                   
                 0100001110000101 
                 0011011101001010 
               
               
                   
                 0100110000110000 
                 1000011001011000 
               
               
                   
                 0011000101100101 
                 1111001010101001 
               
               
                   
                 0011011001011111 
                 1011110001110001 
               
               
                   
                   
               
             
          
         
       
     
         [0087]    If each of the two parties on a network holds two keys, respectively a fixed key and a long-cycle key for multiplying itself Each encryption/decryption is considered as a plaintext block multiplied by a fixed key and then multiplied by a variable key. With an unknown cycle of the variable key and a fixed key for preventing the occurrence of a unit matrix produced by a cyclic operation, it is difficult to decrypt the password even by a plurality of plaintext blocks regardless of the operation for addition or multiplication. After two keys (the fixed key and the variable key) are encrypted, the result is shown in  FIG. 6A . Further, a row or column with zero value can be added to the plaintext block to increase the level of difficulty of cracking. The encrypted result of the two keys is shown in  FIG. 6B . 
         [0088]    While preferred embodiments of the invention have been shown and described in detail, it will be readily understood and appreciated that numerous omissions, changes and additions may be made by persons ordinarily skilled in the art without departing from the spirit and scope of the invention.