Single-byte data encryption and decryption algorithm
By using single-byte encryption and decryption algorithms and leveraging round functions and box transformation techniques, the security and efficiency issues of non-integer multiple byte data transmission in satellite communication are solved, achieving data security without increasing the data volume.
Patent Information
- Application Number
- CN202310321307.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-29
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2043-03-29
AI Technical Summary
Existing data encryption and decryption algorithms require padding when processing non-integer multiple byte data, which increases unnecessary data transmission in systems with narrow communication bandwidth, such as satellite communication, and affects communication efficiency.
An encryption and decryption algorithm based on single bytes is used. By dividing single-byte data into high nibbles and low nibbles, encryption operations are performed using round functions and preset round keys. Ciphertext is generated through reverse transformation and merging. Combined with C-box and S-box transformations, secure encryption and decryption of single-byte data is achieved.
Without increasing the amount of data transmitted, data security is guaranteed, thus solving the data transmission security problem in narrow bandwidth communication systems.
Smart Images

Figure CN116132020B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of satellite communication, in particular to a single-byte data encryption and decryption algorithm, and more particularly to a single-byte data encryption algorithm, a round key rKi acquisition algorithm, a single-byte data decryption algorithm and an electronic device. BACKGROUND
[0002] In various data communication fields, there is a demand for data encryption, and the smaller the amount of data transmitted is, the better. For example, HTTPS (TLS) is commonly used to encrypt and decrypt access data when accessing a webpage, and data messages in the cellular communication field need to be encrypted and decrypted. In each scenario, the security mechanism is designed according to the security requirements, data carrying capacity and other conditions of the use scenario, and the corresponding encryption and decryption algorithm is selected.
[0003] Currently, the commonly used data encryption and decryption algorithm needs to process the data in blocks, and the minimum encryption and decryption data unit length is an integer multiple of 8 bytes, 16 bytes or 64 bytes. For data whose length does not reach an integer multiple of 8 bytes, 16 bytes or 64 bytes, padding data needs to be added, and the padded data after encryption needs to be transmitted to the receiving party so that the receiving party can decrypt the data. This brings the following technical problems:
[0004] Data padding for encryption increases the amount of data transmitted. For Internet transmission, data messages and other scenarios, the increased amount of data transmitted is acceptable for system communication bandwidth. However, for satellite communication and other communication systems with narrow communication bandwidth, the additional data is unacceptable. SUMMARY
[0005] To solve the above problems, the present application provides a single-byte data encryption algorithm, a round key rKi acquisition algorithm and a single-byte data decryption algorithm, and an electronic device.
[0006] In one aspect of the present application, a single-byte data encryption algorithm is provided, which is suitable for data encryption and decryption in the field of satellite communication, and includes the following steps:
[0007] Divide the single byte M into a high half byte Xi and a low half byte X(i+1);
[0008] Perform a round function F to perform a round encryption operation on the high half byte Xi and the low half byte X(i+1) using a preset round key rKi, to obtain two 4-bit numbers: X A and X B ;
[0009] Perform reverse order transformation on the X A and the X B , and combine them into one byte to obtain ciphertext N:
[0010] N = X A X B ;
[0011] Save and output the ciphertext N.
[0012] As an optional embodiment of the present application, optionally, the single-byte M is divided into a high nibble Xi and a low nibble X(i+1), including:
[0013] Configure a C-box, the C-box is 256 numbers, values from 0 to 255, and each number is not repeated;
[0014] Change the single-byte M through the C-box to convert it into another single-byte X;
[0015] Divide the single-byte X into a high nibble Xi and a low nibble X(i+1).
[0016] As an optional embodiment of the present application, optionally, perform a round function F, and perform a round encryption operation on the high nibble Xi and the low nibble X(i+1) using a preset round key rKi to obtain two 4-bit numbers: X A and X B , including:
[0017] Predefine the exclusive or operation rule of the round function F;
[0018] Xor the low nibble X(i+1) and the round key rKi according to the exclusive or operation rule to obtain a first exclusive or operation data of 4 bits:
[0019] Sin=X(i+1)⊕rKi, the symbol ⊕ represents exclusive or operation;
[0020] Take the first exclusive or operation data as the input of S-box transformation to perform S-box transformation and convert Sin into another 4-bit number Sout; the S-box is a 16-number, values from 0 to 15, and each number is not repeated;
[0021] Left shift the Sout by 1 bit to obtain a 4-bit result Y;
[0022] Calculate:
[0023] X(i+2)=Xi⊕Y⊕Sout
[0024] Complete the encryption operation of this round.
[0025] As an optional embodiment of the present application, optionally, perform a round function F, and perform a round encryption operation on the high nibble Xi and the low nibble X(i+1) using a preset round key rKi to obtain two 4-bit numbers: X A and XB Further comprising:
[0026] Configuring 4 different round keys rKi;
[0027] According to the encryption operation step, 1 round key rKi is used for encryption operation in each round;
[0028] The round is performed, and after completing the encryption operation in each of the 4 rounds, 2 4-bit numbers X A and X B are obtained.
[0029] In another aspect of the present application, an algorithm for obtaining round keys rKi is provided, comprising the following steps:
[0030] Divide an initial key MK of 1 byte into 2 4-bit numbers MKi and MK(i+1);
[0031] Xor the initial keys MKi and MK(i+1) with fixed parameters FK0 and FK1 of the system, respectively, to obtain Ki and K(i+1) for round function F' operation:
[0032] Ki = MKi ⊕ FK0;
[0033] K(i+1) = MK(i+1) ⊕ FK1, and the symbol ⊕ represents Xor operation;
[0034] Perform round function F' to perform round Xor operation on the Ki and the K(i+1) to obtain and output round keys rKi.
[0035] As an optional embodiment of the present application, optionally, performing round function F' to perform round Xor operation on the Ki and the K(i+1) to obtain and output round keys rKi, comprising:
[0036] Xor K(i+1) with fixed parameter CKi to obtain a second Xor operation data of 1 4-bit:
[0037] Sin = K(i+1) ⊕ CKi, and the symbol ⊕ represents Xor operation;
[0038] Take the second Xor operation data as input of S-box transformation to perform S-box transformation and convert Sin into another 4-bit number Sout; the S-box is a 16-digit number with values from 0 to 15, and each digit is not repeated;
[0039] Shift Sout left by 1 bit and 3 bits, respectively, to obtain 2 4-bit values Y1 and Y3;
[0040] Xor Ki with Y1 and Y3 to obtain the round key K(i+2):
[0041] K(i+2) = Ki 0 Y1 0 Y3.
[0042] As an optional embodiment of the present application, the round function F' is executed to perform round-wise XOR operation on the Ki and the K(i+1) to obtain and output a round key rKi, and further comprising:
[0043] According to the key operation step, 4 times of key operation are performed to obtain 4 round keys: rK(i+2), rK(i+3), rK(i+4) and rK(i+5);
[0044] The round key rKi is calculated as follows:
[0045] rKi = rK(i+2) rK(i+3) rK(i+4) rK(i+5).
[0046] Another aspect of the present application further provides a single-byte data decryption algorithm, comprising the following steps:
[0047] 1 byte N is divided into a high half byte X0 and a low half byte X1.
[0048] The round function F is executed for 4 times:
[0049] When i = 0, it is the first round change, and it is performed until i = 4 ends;
[0050] Xi is not processed temporarily, and X(i+1) is XORed with a round key rK'i to obtain a 4-bit data as the input of S-box transformation, i.e.
[0051] Sin = X(i+1) 0 rK'i, the symbol 0 represents XOR operation, and the S-box is a 16-digit number with values from 0 to 15, and each digit is not repeated.
[0052] Sin is converted into another 4-bit number Sout through box transformation;
[0053] Sout is left shifted by 1 bit to obtain a 4-bit result Y;
[0054] X(i+2) = Xi 0 Y 0 Sout is calculated, and thus one round of encryption operation is completed;
[0055] 4 rounds of operation are performed to obtain 2 4-bit numbers X4 and X5;
[0056] Among them, 4 round operations use 4 different round keys rK'i, which are obtained by reversing the round key rKi obtaining algorithm, i.e. rK'i is the reverse of rKi:
[0057] rK'i = rK(3-i);
[0058] X4 and X5 are changed in reverse order and combined into one byte output X5X4;
[0059] X5X4 is transformed through a C' box to obtain the plaintext M; wherein the C' box and the C box are reciprocal, that is, the number M is transformed through the C' box to obtain the result M', and M' is transformed through the C box to obtain M.
[0060] Another aspect of the present application also provides an electronic device, comprising:
[0061] a processor;
[0062] a memory for storing processor executable instructions;
[0063] wherein the processor is configured to implement the algorithm when executing the executable instructions.
[0064] Technical effects of the present application:
[0065] The present application can not increase the communication data overhead by using a single-byte unit operation encryption and decryption algorithm. Using this algorithm, the number of transmitted data bytes can not be increased, the security of the data can be ensured, and the problem of narrow bandwidth communication data security can be solved. For more than one byte of original data M, the length of which is n bytes, the CBC mode is used to encrypt the data M with a length of n to enhance security.
[0066] Other features and aspects of the present disclosure will become apparent from the following detailed description of exemplary embodiments with reference to the drawings. BRIEF DESCRIPTION OF DRAWINGS
[0067] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate exemplary embodiments, features, and aspects of the present disclosure and serve to explain the principles of the present disclosure.
[0068] Figure 1 A logical operation schematic diagram of the single-byte data encryption algorithm of the present application is shown;
[0069] Figure 2 A logical operation schematic diagram of the acquisition algorithm of the round key rKi of the present application is shown;
[0070] Figure 3 A logical operation schematic diagram of the single-byte data decryption algorithm of the present application is shown;
[0071] Figure 4 A logical operation schematic diagram of the encryption operation of the data M with a length of n in the CBC mode of the present application is shown;
[0072] Figure 5 An application system schematic diagram of the electronic device of the present application is shown. DETAILED DESCRIPTION
[0073] Various exemplary embodiments, features, and aspects of this disclosure will now be described in detail with reference to the accompanying drawings. The same reference numerals in the drawings denote elements that have the same or similar functions. Although various aspects of the embodiments are shown in the drawings, they are not necessarily drawn to scale unless specifically indicated otherwise.
[0074] The term “exemplary” as used herein means “serving as an example, embodiment, or illustration.” Any embodiment illustrated herein as “exemplary” is not necessarily to be construed as superior to or better than other embodiments.
[0075] Furthermore, to better illustrate this disclosure, numerous specific details are set forth in the following detailed description. Those skilled in the art will understand that this disclosure can be practiced without certain specific details. In some instances, methods, means, components, and circuits well known to those skilled in the art have not been described in detail in order to highlight the main points of this disclosure.
[0076] like Figure 1 As shown, this application proposes a single-byte data encryption algorithm applicable to data encryption and decryption in the field of satellite communication, comprising the following steps:
[0077] Divide the single byte M into a high nibble Xi and a low nibble X(i+1);
[0078] Execute the round function F, and use the preset round key rKi to perform round encryption operations on the high nibble Xi and the low nibble X(i+1), resulting in two 4-bit numbers: X A and X B ;
[0079] For the X A and the X B Perform a reverse transformation and merge the bytes into a single byte to obtain the ciphertext N:
[0080] N = X A X B ;
[0081] Save and output the ciphertext N.
[0082] like Figure 1 As shown, this algorithm uses 1 byte as 1 block and performs the following operations on 1 byte.
[0083] I) Introduction to the Encryption Process
[0084] The following diagram illustrates the encryption process:
[0085] Step 1: 1 byte M is changed by C-box to 1 byte X. C-box is 256 numbers, value from 0~255, each number is not repeated. 1 byte M is changed by C-box to another 1 byte X. X is divided into high nibble Xi and low nibble X(i+1).
[0086] Step 2: execute round function F, total 4 times
[0087] When i=0, it is the first round change, and it is carried out until i=4 ends.
[0088] Xi is not processed temporarily, X(i+1) and round key rKi are XORed to obtain a 4-bit data, which is used as the input of S-box transformation. That is, Sin=X(i+1)⊕rKi, and the symbol ⊕ represents XOR operation. S-box is a 16-number, value from 0~15, each number is not repeated. Through box transformation, Sin is converted into another 4-bit number Sout.
[0089] Sout is left shifted by 1 bit to obtain a 4-bit result Y.
[0090] X(i+2)=Xi⊕Y⊕Sout is calculated. Thus, one round of encryption operation is completed. 4 rounds of operation are required to obtain 2 4-bit numbers X4 and X5.
[0091] Among them, 4 rounds of operation use 4 different round keys rKi. Round key rKi is obtained by the key expansion method introduced below.
[0092] Step 3: X4 and X5 are changed in reverse order and merged into one byte output, that is, the encryption result is one byte of ciphertext N=X5X4.
[0093] As shown in the following formula (1), it is the operation logic of round key rKi. Figure 2
[0094] Another aspect of the present application, an algorithm for obtaining round key rKi is proposed, comprising the following steps:
[0095] An initial key MK of 1 byte is divided into 2 4-bit numbers: MKi and MK(i+1);
[0096] The initial key MKi and MK(i+1) are respectively XORed with the fixed parameters FK0 and FK1 of the system to obtain Ki and K(i+1) used for round function F' operation:
[0097] Ki=MKi⊕FK0;
[0098] K(i+1)=MK(i+1)⊕FK1, and the symbol ⊕ represents XOR operation.
[0099] Performing round function F', round-wise XOR operation on Ki and K(i+1) to obtain and output round key rKi.
[0100] The operation logic of round key rKi is as follows:
[0101] Step 1: The initial key MK is one byte, which is divided into two 4-bit numbers MKi and MK(i+1) (the initial key is i=0)
[0102] Step 2: XOR the initial keys MKi and MK(i+1) with fixed parameters FK0 and FK1 respectively to obtain Ki and K(i+1) used for round function F' operation. Ki=MKi⊕FK0, K(i+1)=MK(i+1)⊕FK1.
[0103] Step 3: Generate round key rK
[0104] Ki is temporarily not processed, XOR K(i+1) and fixed parameter CKi to obtain a 4-bit data as the input of S-box transformation. Sin=K(i+1)⊕CKi.
[0105] Do S-box transformation on Sin to obtain Sout.
[0106] Shift Sout left by 1 bit and 3 bits respectively to obtain two 4-bit values Y1 and Y3
[0107] XOR Ki with Y1 and Y3 to obtain K(i+2). A total of 4 times, round key rKi is obtained
[0108] That is, round key rKi=K(i+2)=Ki⊕Y1⊕Y3, that is, rK=rK0 rK1 rK2 rK3.
[0109] As shown in Figure 3 , a decryption algorithm of inverse order is provided.
[0110] Another aspect of the present application also proposes a single-byte data decryption algorithm, comprising the following steps:
[0111] Divide one byte N into high half byte X0 and low half byte X1.
[0112] Perform round function F for a total of 4 times:
[0113] When i=0, it is the first round change, and it is performed until i=4 ends;
[0114] Xi is temporarily not processed, XOR X(i+1) and round key rK'i to obtain a 4-bit data as the input of S-box transformation, that is:
[0115] Sin = X(i+1) ^ rK'i, the symbol ^ represents XOR operation, S-box is a 16-digit number, the value is from 0 to 15, and each digit is not repeated;
[0116] Sin is converted into another 4-bit number Sout through box transformation;
[0117] Sout is left shifted by 1 bit to obtain a 4-bit result Y;
[0118] X(i+2) = Xi ^ Y ^ Sout is calculated, and thus one round of encryption operation is completed;
[0119] Four rounds of operation are performed to obtain two 4-bit numbers X4 and X5;
[0120] Among them, four rounds of operation use four different round keys rK'i, which are obtained by reversing the round key rKi through the reverse order, that is, rK'i is the reverse order of rKi:
[0121] rK'i = rK(3-i);
[0122] X4 and X5 are reversed and combined into a byte output X5X4;
[0123] X5X4 is converted through C' box transformation to obtain the plaintext M; wherein C' box and C are reciprocal, that is, the number M is converted through C' box to obtain the result M', and M' is converted through C box to M.
[0124] The above is the single-byte running algorithm for encryption and decryption of the application, which is a single-byte encryption algorithm. Using this algorithm, the number of transmitted data bytes can be increased without increasing the number of transmitted data bytes, and the security of the data can be ensured, and the problem of narrow bandwidth communication data security can be solved.
[0125] For the convenience of description, the algorithm is marked as SingleAlgo.
[0126] Further, in order to enhance security, for more than one byte of original data M, the length of which is n bytes, the SingleAlgo is used to encrypt the data M of the length of n. Figure 4 The CBC mode shown in the figure is used to encrypt the data M of the length of n.
[0127] As shown in the figure, Figure 4 First, M is divided into M0, M1, to Mn-1 according to the byte. The initial value IV can be used or not used. IV is XORed with M0, and then sent into SingleAlgo to obtain N0. The result of XORing N0 with M1 is sent into SingleAlgo to obtain N1, and so on. After n times of operation, N0 to Nn-1 are obtained, which are n bytes of encrypted data N0N1…Nn-1.
[0128] A specific embodiment will be described below.
[0129] Embodiment 1
[0130] Below is an example of C-box and C' -box parameters. Different box data can be customized according to requirements.
[0131] Use example. When data M = 0x00, it becomes 0xD6 after C-box transformation; when data M = 0x03, it becomes 0xFE after C-box transformation.
[0132] C_BOX = [
[0133] 0xD6, 0x90, 0xE9, 0xFE, 0xCC, 0xE1, 0x3D, 0xB7, 0x16, 0xB6, 0x14, 0xC2, 0x28, 0xFB, 0x2C, 0x05, 0x2B, 0x67, 0x9A,
[0134] 0x76, 0x2A, 0xBE, 0x04, 0xC3, 0xAA, 0x44, 0x13, 0x26, 0x49, 0x86, 0x06, 0x99, 0x9C, 0x42, 0x50, 0xF4, 0x91, 0xEF,
[0135] 0x98, 0x7A, 0x33, 0x54, 0x0B, 0x43, 0xED, 0xCF, 0xAC, 0x62, 0xE4, 0xB3, 0x1C, 0xA9, 0xC9, 0x08, 0xE8, 0x95, 0x80,
[0136] 0xDF, 0x94, 0xFA, 0x75, 0x8F, 0x3F, 0xA6, 0x47, 0x07, 0xA7, 0xFC, 0xF3, 0x73, 0x17, 0xBA, 0x83, 0x59, 0x3C, 0x19,
[0137] 0xE6, 0x85, 0x4F, 0xA8, 0x68, 0x6B, 0x81, 0xB2, 0x71, 0x64, 0xDA, 0x8B, 0xF8, 0xEB, 0x0F, 0x4B, 0x70, 0x56, 0x9D,
[0138] 0x35, 0x1E, 0x24, 0x0E, 0x5E, 0x63, 0x58, 0xD1, 0xA2, 0x25, 0x22, 0x7C, 0x3B, 0x01, 0x21, 0x78, 0x87, 0xD4, 0x00,
[0139] 0x46, 0x57, 0x9F, 0xD3, 0x27, 0x52, 0x4C, 0x36, 0x02, 0xE7, 0xA0, 0xC4, 0xC8, 0x9E, 0xEA, 0xBF, 0x8A, 0xD2, 0x40,
[0140] 0xC7, 0x38, 0xB5, 0xA3, 0xF7, 0xF2, 0xCE, 0xF9, 0x61, 0x15, 0xA1, 0xE0, 0xAE, 0x5D, 0xA4, 0x9B, 0x34, 0x1A, 0x55,
[0141] 0xAD, 0x93, 0x32, 0x30, 0xF5, 0x8C, 0xB1, 0xE3, 0x1D, 0xF6, 0xE2, 0x2E, 0x82, 0x66, 0xCA, 0x60, 0xC0, 0x29, 0x23,
[0142] 0xAB, 0x0D, 0x53, 0x4E, 0x6F, 0xD5, 0xDB, 0x37, 0x45, 0xDE, 0xFD, 0x8E, 0x2F, 0x03, 0xFF, 0x6A, 0x72, 0x6D, 0x6C,
[0143] 0x5B, 0x51, 0x8D, 0x1B, 0xAF, 0x92, 0xBB, 0xDD, 0xBC, 0x7F, 0x11, 0xD9, 0x5C, 0x41, 0x1F, 0x10, 0x5A, 0xD8, 0x0A,
[0144] 0xC1, 0x31, 0x88, 0xA5, 0xCD, 0x7B, 0xBD, 0x2D, 0x74, 0xD0, 0x12, 0xB8, 0xE5, 0xB4, 0xB0, 0x89, 0x69, 0x97, 0x4A,
[0145] 0x0C, 0x96, 0x77, 0x7E, 0x65, 0xB9, 0xF1, 0x09, 0xC5, 0x6E, 0xC6, 0x84, 0x18, 0xF0, 0x7D, 0xEC, 0x3A, 0xDC, 0x4D,
[0146] 0x20, 0x79, 0xEE, 0x5F, 0x3E, 0xD7, 0xCB, 0x39, 0x48
[0147] ].
[0148] The following is a C' box corresponding to the above C box.
[0149] Using example: when data N=0xD6, it becomes 0x00 after C' box transformation; when data N=0xFE, it becomes 0x03 after C box transformation.
[0150] C_BOX_INVERT=[
[0151] 0x71, 0x6C, 0x7A, 0xB8, 0x16, 0x0F, 0x1E, 0x41, 0x35, 0xEB, 0xD0, 0x2A, 0xE4, 0xAC, 0x62, 0x5A, 0xCD, 0xC8, 0xDB,
[0152] 0x1A, 0x0A, 0x8E, 0x08, 0x46, 0xF0, 0x4B, 0x96, 0xC1, 0x32, 0xA0, 0x60, 0xCC, 0xF7, 0x6D, 0x69, 0xAA, 0x61, 0x68,
[0153] 0x1B, 0x76, 0x0C, 0xA9, 0x14, 0x10, 0x0E, 0xD8, 0xA3, 0xB7, 0x9B, 0xD2, 0x9A, 0x28, 0x95, 0x5F, 0x79, 0xB2, 0x86,
[0154] 0xFE, 0xF4, 0x6B, 0x4A, 0x06, 0xFB, 0x3E, 0x84, 0xCB, 0x21, 0x2B, 0x19, 0xB3, 0x72, 0x40, 0xFF, 0x1C, 0xE3, 0x5B,
[0155] 0x78, 0xF6, 0xAE, 0x4E, 0x22, 0xBF, 0x77, 0xAD, 0x29, 0x97, 0x5D, 0x73, 0x65, 0x49, 0xCE, 0xBE, 0xCA, 0x92, 0x63,
[0156] 0xFA, 0xA7, 0x8D, 0x2F, 0x64, 0x55, 0xE8, 0xA5, 0x11, 0x50, 0xE1, 0xBA, 0x51, 0xBD, 0xBC, 0xED, 0xAF, 0x5C, 0x54,
[0157] 0xBB, 0x45, 0xD9, 0x3C, 0x13, 0xE6, 0x6E, 0xF8, 0x27, 0xD6, 0x6A, 0xF2, 0xE7, 0xC7, 0x38, 0x52, 0xA4, 0x48, 0xEF,
[0158] 0x4D, 0x1D, 0x6F, 0xD3, 0xE0, 0x82, 0x57, 0x9D, 0xC0, 0xB6, 0x3D, 0x01, 0x24, 0xC3, 0x99, 0x3A, 0x37, 0xE5, 0xE2,
[0159] 0x26, 0x1F, 0x12, 0x94, 0x20, 0x5E, 0x7F, 0x74, 0x7C, 0x8F, 0x67, 0x88, 0x93, 0xD4, 0x3F, 0x42, 0x4F, 0x33, 0x18,
[0160] 0xAB, 0x2E, 0x98, 0x91, 0xC2, 0xDF, 0x9E, 0x53, 0x31, 0xDE, 0x87, 0x09, 0x07, 0xDC, 0xE9, 0x47, 0xC4, 0xC6, 0xD7,
[0161] 0x15, 0x81, 0xA8, 0xD1, 0x0B, 0x17, 0x7D, 0xEC, 0xEE, 0x85, 0x7E, 0x34, 0xA6, 0xFD, 0x04, 0xD5, 0x8B, 0x2D, 0xDA,
[0162] 0x66, 0x83, 0x75, 0x70, 0xB0, 0x00, 0xFC, 0xCF, 0xC9, 0x56, 0xB1, 0xF5, 0xC5, 0xB4, 0x39, 0x90, 0x05, 0xA2, 0x9F,
[0163] 0x30, 0xDD, 0x4C, 0x7B, 0x36, 0x02, 0x80, 0x59, 0xF3, 0x2C, 0xF9, 0x25, 0xF1, 0xEA, 0x8A, 0x44, 0x23, 0x9C, 0xA1,
[0164] 0x89, 0x58, 0x8C, 0x3B, 0x0D, 0x43, 0xB5, 0x03, 0xB9
[0165] ].
[0166] S-box example:
[0167] S_BOX = [0x03, 0x00, 0x02, 0x01, 0x06, 0x04, 0x05, 0x08, 0x07, 0x0A, 0x09, 0x0C, 0x0B, 0x0E, 0x0D, 0x0F].
[0168] In the method, the data arrangement of the C-box, the data arrangement of the S-box, the fixed parameter FK and the fixed parameter CK can have multiple selections as long as the length and data content requirements are met.
[0169] Obviously, those skilled in the art should understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program. The program can be stored in a computer-readable storage medium, and the program can include the processes of the above-mentioned embodiment of each control method when executed. Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program. The program can be stored in a computer-readable storage medium, and the program can include the processes of the above-mentioned embodiment of each control method when executed. The storage medium can be a magnetic disc, an optical disc, a read-only memory (ROM), a random access memory (RAM), a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD), etc. The storage medium can also include a combination of the above-mentioned types of memories.
[0170] Embodiment 2
[0171] Further, another aspect of the present application also provides an electronic device, comprising:
[0172] a processor;
[0173] a memory for storing processor-executable instructions;
[0174] wherein the processor is configured to implement the various algorithms described in embodiment 1 when executing the executable instructions.
[0175] The electronic device of the embodiments of the present disclosure includes a processor and a memory for storing processor-executable instructions. Wherein the processor is configured to implement the algorithms described in any of the preceding embodiments when executing the executable instructions.
[0176] Here, it should be pointed out that the number of processors can be one or more. Meanwhile, the electronic device of the embodiments of the present disclosure can also include an input device and an output device. Wherein the processor, the memory, the input device and the output device can be connected through a bus, or can be connected through other means, which is not specifically limited here.
[0177] The memory, as a computer readable storage medium, can be used to store software programs, computer executable programs and various modules, such as programs or modules corresponding to the algorithms of the embodiments of the present disclosure. The processor executes various functions and data processing of the electronic device by running the software programs or modules stored in the memory.
[0178] The input device can be used to receive input numbers or signals. Among them, the signal can be a key signal related to the user settings and function control of the device / terminal / server. The output device can include a display device such as a display screen.
[0179] The above has described the embodiments of the present disclosure, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes are obvious to those skilled in the art without departing from the scope and spirit of the described embodiments. The selection of the terms used herein is intended to best explain the principles, practical applications or technical improvements of the technology in the market of the embodiments, or to enable other ordinary skilled in the art to understand the embodiments disclosed herein.
Claims
1. A single byte data encryption algorithm, suitable for data encryption and decryption in the field of satellite communication, characterized in that, The encryption operation steps include the following steps. The single-byte M is divided into a high nibble Xi and a low nibble X(i+1); performing a round function F on the high nibble Xi and the low nibble X(i+1) using a preset round key rKi to perform a round encryption operation on the high nibble Xi and the low nibble X(i+1) to obtain two 4-bit numbers: X A and X B , comprising: The exclusive or operation rule of the preset round function F is configured; The X(i+1) and the round key rKi are subjected to exclusive or operation according to the exclusive or operation rule to obtain a first exclusive or operation data of 4 bits: Sin=X(i+1)⊕rKi, and the symbol ⊕ represents exclusive or operation; The first exclusive or operation data is taken as input of S-box conversion, S-box conversion is performed, and Sin is converted into another 4-bit number Sout; the S-box is 16 numbers, the values are from 0 to 15, and each number is not repeated; The Sout is left shifted by 1 bit to obtain a 4-bit result Y; X(i+2)=Xi⊕Y⊕Sout The encryption operation of the round is completed; The ciphertext N is saved and output. X A X B is reversed and merged into one byte, and the ciphertext N is obtained: N=X A X B ; The single-byte M is divided into a high nibble Xi and a low nibble X(i+1), including:
2. The single-byte data encryption algorithm of claim 1, wherein, The C-box is configured, the C-box is 256 numbers, the values are from 0 to 255, and each number is not repeated; The single-byte M is converted into another single-byte X through C-box conversion; The single-byte X is divided into a high nibble Xi and a low nibble X(i+1). Four different round keys rKi are configured; 3. The single-byte data encryption algorithm of claim 1, wherein, performing a round function F to perform a round encryption operation on the high nibble Xi and the low nibble X(i+1) using a preset round key rKi to obtain two 4-bit numbers: X A and X B , and further comprising: According to the encryption operation steps in claim 1, one round key rKi is used for encryption operation each round; The encryption operation steps include the following steps. The rounds are performed, and after each round of encryption operation of 4 rounds, 2 4-bit numbers X and X are obtained A and X B .
4. An acquisition algorithm of a round key rKi, characterized in that, The initial key MK of one byte is divided into two 4-bit numbers: MKi and MK(i+1); The initial key MKi and MK(i+1) are subjected to exclusive or operation with fixed parameters FK0 and FK1 of the system respectively to obtain Ki and K(i+1) used for round function F' operation: Ki=MKi⊕FK0; K(i+1)=MK(i+1)⊕FK1, and the symbol ⊕ represents exclusive or operation; The round function F' is executed to perform round exclusive or operation on the Ki and the K(i+1) to obtain and output the round key rKi, including: The K(i+1) and the fixed parameter CKi are subjected to exclusive or operation to obtain a second exclusive or operation data of 1 bit: Sin=K(i+1)⊕CKi, and the symbol ⊕ represents exclusive or operation; The second exclusive or operation data is taken as input of S-box conversion, S-box conversion is performed, and Sin is converted into another 4-bit number Sout; the S-box is 16 numbers, the values are from 0 to 15, and each number is not repeated; The Sout is left shifted by 1 bit and 3 bits respectively to obtain two 4-bit values Y1 and Y3; The Ki is subjected to exclusive or operation with Y1 and Y3 to obtain the key K(i+2) of the round: K(i+2)=Ki⊕Y1⊕Y3; According to the key operation steps in claim 3, four times of key operation are calculated to obtain four round keys: rK(i+2), rK(i+3), rK(i+4) and rK(i+5); The round key rKi is calculated: rKi=rK(i+2)rK(i+3)rK(i+4)rK(i+5). The encryption operation steps include the following steps.
5. A single byte data decryption algorithm, characterized by, One byte N is divided into a high nibble X0 and a low nibble X1; The round function F is executed for four times: When i=0, it is the first round of change, and it is carried out until i=4 ends; Xi is not processed temporarily, and X(i+1) and round key rK'i are XORed to obtain a 4-bit data, which is used as the input of S-box transformation, that is: Sin=X(i+1)⊕rK'i, The symbol ⊕ represents XOR operation, and S-box is a 16-digit number with values from 0 to 15, and each digit is not repeated; Sin is converted into another 4-bit number Sout through box transformation; Sout is left shifted by 1 bit to obtain a 4-bit result Y; X(i+2)=Xi⊕Y⊕Sout is calculated, and thus one round of encryption operation is completed; Four rounds of operation are performed to obtain two 4-bit numbers X4 and X5; Among them, four rounds of operation use four different round keys rK'i, which are obtained by reversing the round key rKi acquisition algorithm in claim 4, that is, rK'i is the reverse sequence of rKi: rK'i=rK(3-i); X4 and X5 are changed in reverse order and combined into a byte output X5X4; X5X4 is converted through C' box to obtain the plaintext M; wherein C' box and C are reciprocal, that is, the number M is converted through C' box to obtain the result M', and M' is converted through C box to M.
6. An electronic device, comprising: It includes: a processor; a memory for storing processor executable instructions; wherein the processor is configured to implement the algorithm of any one of claims 1-5 when executing the executable instructions.