Josephh ring concept-based equal-length symmetric encryption and decryption method and device and medium

By encrypting and decrypting the plaintext using two random keys and the variable parameters of the Joseph ring, the problem of low security in existing encryption methods is solved, and the encryption and decryption effect of high security and equal length ciphertext is achieved.

CN119583105APending Publication Date: 2025-03-07SUZHOU REKTEC INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411538328.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-31
Publication Date
2025-03-07

AI Technical Summary

Technical Problem

The existing encryption method based on Joseph's ring uses fixed keys or simple permutation rules, which is easily found by attackers through brute force cracking or statistical analysis, resulting in low encryption security and inability to meet application scenarios with high security requirements.

Method used

Two random keys key1 and key2, as well as the variable parameter step of the Joseph ring, encrypt and decrypt the plaintext, and generate ciphertexts of equal length through Joseph ring conversion and complex operations of the key.

Benefits of technology

It improves the security of encrypted strings, increases the difficulty of cracking, ensures that the encrypted ciphertext length is the same as the plaintext length, avoids transmission problems caused by excessive ciphertext, and enhances data integrity and readability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119583105A_ABST
    Figure CN119583105A_ABST
Patent Text Reader

Abstract

The invention discloses an equal-length symmetric encryption and decryption method based on a Josephh ring concept, and the method comprises the steps: setting two random keys key1 and key2 which are respectively used for the conversion from a plaintext to a numerical value and the conversion from the numerical value to a ciphertext; setting a variable parameter step of the Josephh ring; encrypting the plaintext by using the Josephh ring parameter; and analyzing the ciphertext by using Josephh ring inverse conversion. The method has the beneficial effects that two complex and efficient modes of key conversion and Josephh ring conversion are combined, and the difficulty of ciphertext decoding is greatly improved. In this way, the security of the encrypted character string is ensured, and the information is effectively prevented from being illegally acquired and utilized. According to the method, encryption is carried out under the condition that the length of the original character string is not changed, it is ensured that the length of the encrypted ciphertext is completely the same as the length of the plaintext, the effectiveness and readability of information are ensured, and the transmission problem caused by the too long ciphertext is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of encryption methods, and in particular relates to a method, device and medium for equal-length symmetric encryption and decryption based on the concept of Joseph rings. Background Art

[0002] In the field of information security, encryption technology has always been an important means to protect data privacy and security. Although traditional encryption methods, such as symmetric encryption and asymmetric encryption, have high security, they often have problems such as complex methods, large amount of calculations, and difficult key management. Therefore, it is of great significance to study a simple, efficient, and easy-to-manage encryption method.

[0003] With the development of computer technology and cryptography, people began to explore encryption methods based on specific mathematical principles or physical phenomena. Among them, the Joseph ring, as a classic mathematical problem, is widely used in various encryption methods due to its unique cycle and permutation characteristics. The Joseph ring problem is essentially a mathematical problem about cycles and permutations, which describes the process of dequeuing elements in a circular queue according to specific rules. This characteristic makes the Joseph ring an ideal tool for designing encryption methods because it can achieve complex permutations of data, thereby increasing the difficulty of cracking.

[0004] However, most of the existing encryption methods based on Joseph rings use fixed keys or simple permutation rules, which can be easily cracked by attackers through brute force or statistical analysis, resulting in low encryption security and unable to meet application scenarios with higher security requirements. Summary of the invention

[0005] In order to solve the problems raised in the above background technology, the present invention provides a method of equal-length symmetric encryption and decryption based on the concept of Joseph ring.

[0006] To achieve the above object, the present invention provides the following technical solution: A method for equal-length symmetric encryption and decryption based on the concept of Joseph rings comprises:

[0007] Step S1, set two random keys key1 and key2 for encryption and decryption of plain text;

[0008] Step S2, setting the variable parameter step of the Joseph ring;

[0009] Step S3, encrypt the plaintext using two secret keys and variable parameter step;

[0010] Step S4: parse the ciphertext using two secret keys and the Joseph ring inverse transformation, and restore the plaintext through the equal-length ciphertext decomposition index table.

[0011] Further: key1 and key2 are composed of English letters and numbers.

[0012] The combination of letters and numbers increases the complexity and diversity of the key. At the same time, it increases the key space, improves the security of the method, and reduces the risk of brute force cracking.

[0013] Further: key1 is used to convert characters in the plain text into a first numerical list;

[0014] key2 is used to convert the second numerical list generated during the encryption process back into characters to generate ciphertext.

[0015] Further: Step S3 includes:

[0016] Step S31, according to the characters in the plain text, replace the characters in the plain text one by one with the position values ​​corresponding to the same characters in key1, and generate a first value list;

[0017] Step S32: when the first value list is generated, the first value list is subjected to Joseph ring conversion; the Joseph ring conversion process is: the first value list is regarded as a ring, and the first corresponding value is taken out by counting the number of steps from the first position;

[0018] Step S33: when the first corresponding value is taken out, count the number of steps from the next digit of the first corresponding value, and then take out the corresponding value; repeat the operation until the last character is taken out, and generate a second value list in the order of taking out;

[0019] Step S33, according to the second value list, generate ciphertext according to the characters at corresponding positions of the second values ​​in key2 one by one;

[0020] The plaintext is effectively encrypted through the secret key, which increases the security of the data. At the same time, the introduction of the Joseph ring transformation increases the complexity of encryption and makes it more difficult to crack.

[0021] Further: step S4 comprises:

[0022] S41, according to the characters in the ciphertext, replace the characters in the ciphertext one by one with the position values ​​corresponding to the same characters in key2, and restore to the second value list;

[0023] S42, according to the second value list, obtain the characters at the corresponding positions in key1 one by one to generate a third value list;

[0024] S43, generating a ciphertext de-sequence index table with the same length as the ciphertext length, starting from 0 and increasing by 1 each time;

[0025] S44, using the step parameter, performing the same Joseph ring transformation as in the encryption process on the equal-length ciphertext de-sequence index table to generate a fourth value list;

[0026] S45. According to the fourth value list and the third value list, assign values ​​one by one to restore the plain text.

[0027] It ensures that the ciphertext can be accurately restored to plaintext, ensuring the reversibility and reliability of the method.

[0028] Further: the fourth value list is the position information of the characters in the plain text.

[0029] Further: the third value list is the value corresponding to each position information in the fourth value list.

[0030] The present invention solves the defects existing in the background technology and has the following beneficial effects:

[0031] 1. This equal-length symmetric encryption and decryption method based on the concept of Joseph ring combines two complex and efficient methods, namely, the conversion of the key and the Joseph ring, which greatly increases the difficulty of deciphering the ciphertext. Compared with the prior art, it improves the security of the encrypted string and effectively prevents the information from being illegally obtained and used.

[0032] 2. The equal-length symmetric encryption and decryption method based on the Joseph ring concept performs encryption without changing the length of the original string, ensuring that the length of the encrypted ciphertext is exactly the same as the length of the plaintext, which not only ensures the validity and readability of the information, but also avoids the transmission problem caused by the excessive length of the ciphertext. Compared with the prior art, the data integrity and validity are improved.

[0033] 3. The equal-length symmetric encryption and decryption method based on the Joseph ring concept solves the problem that the same characters in the plain text and the cipher text have the same position after encryption. Compared with the prior art, the adaptability is improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings:

[0035] Figure 1 It is a schematic diagram of the encryption and decryption process of the present invention;

[0036] Figure 2 It is a schematic diagram of the functional modules of the present invention; DETAILED DESCRIPTION

[0037] The present invention will now be further described in detail with reference to the accompanying drawings and embodiments. These drawings are simplified schematic diagrams that only illustrate the basic structure of the present invention in a schematic manner, and therefore only show the components related to the present invention.

[0038] Application Overview:

[0039] The present invention aims to solve the needs in specific encryption and decryption scenarios, that is, to realize the encryption and decryption processing of the message unique identifier, while ensuring that the length of the encrypted ciphertext is consistent with the length of the plaintext, and has high security to prevent it from being easily cracked. This demand stems from the optimization of customer experience and the improvement of system stability, and aims to avoid user data storage errors that may be caused by changes in the length of the encrypted string.

[0040] Existing encryption technologies are mainly divided into two categories: asymmetric encryption and symmetric encryption. Asymmetric encryption technology, such as the MD5 hash algorithm, is known for its one-way nature, which means it can only encrypt but not decrypt, thus ensuring the security of information. However, this feature limits its application in scenarios where decryption is required.

[0041] Symmetric encryption technology, such as ECB (Electronic Code Book) mode, allows the same key to be used for encryption and decryption operations. However, existing symmetric encryption technology often leads to a significant increase in the length of ciphertext during the encryption process, and cannot ensure that the length of ciphertext and plaintext must remain consistent.

[0042] The present invention converts characters in plain text into cipher text through multiple steps of complex operations by setting two random keys and Joseph ring variable parameters. In the encryption process, a numerical list is generated according to the correspondence between plain text characters and key1, and Joseph ring conversion is performed, and then the cipher text is generated in combination with key2. When decrypting, the reverse operation is performed, and the cipher text is finally obtained by correlating the cipher text with key2, key1 and the numerical list after Joseph ring conversion, and gradually restoring it.

[0043] This method first generates an equal-length ciphertext decomposition index table by increasing the length of the ciphertext by 1 from 0, ensuring that the index table is equal to the length of the ciphertext. This ensures that the ciphertext and plaintext are of the same length, avoiding user data storage errors that may be caused by changes in the length of the encrypted string. Secondly, a more complex processing method combining a specific key and Joseph ring conversion is used to effectively prevent information from being easily cracked, optimize customer experience and enhance system stability.

[0044] Exemplary methods:

[0045] like Figure 1 The figure shows a flow chart of a method for equal-length symmetric encryption and decryption based on the concept of Joseph ring.

[0046] The method specifically comprises the following steps:

[0047] Step S1, set two random keys key1 and key2 for encryption and decryption of plaintext;

[0048] The plain text string consists of a mixture of numbers and English letters, and its length is unlimited.

[0049] The secret keys key1 and key2 are randomly generated by mixing 36 characters (62 characters if case sensitivity is required) from 0 to 9 and az. These two keys are the basis for encryption and decryption.

[0050] For example, set the plain text to test112233;

[0051] The secret key established is:

[0052] key1:4buzs1iw3lqg9vj8fe7knthds2rao6p5cm0y;

[0053] key2:uevgw8iak5h9rbofdln13s2z7q04js6ctpmy;

[0054] Step S2, setting the variable parameter step of the Joseph ring; the variable parameter (number of steps) set for the Joseph ring can be called step.

[0055] The parameters of the Joseph ring are: Step = 5;

[0056] Step S31, according to the characters in the plain text, replace the characters in the plain text one by one with the position values ​​corresponding to the same characters in key1, and generate a first value list;

[0057] For example, the first list of values ​​is: 21, 17, 4, 21, 5, 5, 25, 25, 8, 8; the position subscripts corresponding to each value are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.

[0058] Step S32: when the first value list is generated, the first value list is subjected to Joseph ring conversion; the Joseph ring conversion process is: the first value list is regarded as a ring, and the first corresponding value is taken out by counting the number of steps from the first position;

[0059] Step S33: when the first corresponding value is taken out, count the number of steps from the next digit of the first corresponding value, and then take out the corresponding value; repeat the operation until the last character is taken out, and generate a second value list in the order of taking out;

[0060] For example, the second value list is: 5,8,5,17,8,25,21,21,25,4;

[0061] Step S33, according to the second value list, generate ciphertext according to the characters at corresponding positions of the second values ​​in key2 one by one;

[0062] For example, the ciphertext is: 8,k,8,l,k,q,s,s,q,w;

[0063] Further: step S4 comprises:

[0064] S41, according to the characters in the ciphertext, replace the characters in the ciphertext one by one with the position values ​​corresponding to the same characters in key2, and restore to the second value list;

[0065] For example, the second value list is: 5,8,5,17,8,25,21,21,25,4;

[0066] S42, according to the second value list, obtain the characters at the corresponding positions in key1 one by one to generate a third value list;

[0067] For example, the third value list is: 1,3,1,e,3,2,t,t,2,s;

[0068] S43, generating a ciphertext de-sequence index table with the same length as the ciphertext length, starting from 0 and increasing by 1 each time;

[0069] For example, the decomposition index table of equal-length ciphertext is: 0,1,2,3,4,5,6,7,8,9;

[0070] S44, using the step parameter, performing the same Joseph ring transformation as in the encryption process on the equal-length ciphertext de-sequence index table to generate a fourth value list;

[0071] For example, after the position subscripts corresponding to each value in the first value list are also transformed by the Joseph ring, the fourth value list is obtained as follows: 4, 9, 5, 1, 8, 7, 0, 3, 6, 2;

[0072] S45. According to the fourth value list and the third value list, assign values ​​one by one to restore the plain text.

[0073] Further: the fourth value list is the position information of the characters in the plain text.

[0074] Further: the third value list is the value corresponding to each position information in the fourth value list.

[0075] For example, let 4,9,5,1,8,7,0,3,6,2 be used as string position information; let 1,3,1,e,3,2,t,t,2,s be used as the value of each position; according to the number list after position subscript conversion, the original list order is obtained; that is, starting from 0, the 4th character is "1", the 9th character is "3", the 5th character is "1", and so on. The final decrypted string is test112233, which is consistent with the original plaintext.

[0076] like Figure 2 The illustrated equal-length symmetric encryption and decryption device based on the Joseph ring concept comprises:

[0077] Encryption module, used to convert plain text into cipher text to ensure the secure transmission or storage of information;

[0078] The decryption module is used to restore the ciphertext to plaintext so that the information can be read or processed normally.

[0079] A computer-readable storage medium stores program instructions therein, and the program instructions are used to implement an equal-length symmetric encryption and decryption method based on the concept of Joseph rings when executed by a processor.

[0080] In addition to the above-mentioned methods and devices, an embodiment of the present application may also be a computer program product, which includes computer program instructions. When the computer program instructions are executed by a processor, the processor executes the steps in the method of equal-length symmetric encryption and decryption based on the concept of Joseph ring according to various embodiments of the present application described in the above method part of this specification.

[0081] The computer program product may be written in any combination of one or more programming languages ​​to write program codes for performing the operations of the embodiments of the present application, including object-oriented programming languages ​​such as Java, C++, etc., and conventional procedural programming languages ​​such as "C" language or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server.

[0082] In addition, an embodiment of the present application may also be a computer-readable storage medium on which computer program instructions are stored. When the computer program instructions are executed by a processor, the processor executes the steps of the method of equal-length symmetric encryption and decryption based on the concept of Joseph rings according to various embodiments of the present application described in the above method section of this specification.

[0083] Computer readable storage media can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can include, for example, but is not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0084] In the description of the present invention, it should be understood that the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.

[0085] In the description of this specification, the description of the terms "one embodiment", "some embodiments", "embodiment", "example", "specific example" or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic expressions of the above terms do not necessarily refer to the same embodiment or example.

[0086] Although the embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present invention. A person skilled in the art may alter, modify, replace and modify the above embodiments within the scope of the present invention.

Claims

1. A method of equal-length symmetric encryption and decryption based on the concept of Joseph rings, characterized in that: The following steps are involved: Step S1, set two random keys key1 and key2 for encryption and decryption of plaintext; Step S2, setting the variable parameter step of the Joseph ring; Step S3, encrypt the plaintext using two secret keys and variable parameter step; Step S4, using two secret keys and Joseph ring inverse transformation to parse the ciphertext, and restore the plaintext through the equal-length ciphertext decomposition index table; key1 and key2 consist of English letters and numbers. key1 is used to convert the characters in the plain text into the first numerical list; key2 is used to convert the second numerical list generated during the encryption process back into characters to generate ciphertext; Step S31, according to the characters in the plain text, replace the characters in the plain text one by one with the position values ​​corresponding to the same characters in key1, and generate a first value list; Step S32: when the first value list is generated, the first value list is subjected to Joseph ring transformation; The Joseph ring conversion process is as follows: treat the first value list as a ring, count the number of steps from the first position and take out the first corresponding value; Step S33, when taking out the first corresponding value, count the number of steps from the next digit of the first corresponding value, and then take out the corresponding value; Repeat the operation until the last character is taken out, and generate the second value list in the order of taking out; Step S33, according to the second value list, generate ciphertext according to the characters at corresponding positions of the second values ​​in key2 one by one; S41, according to the characters in the ciphertext, replace the characters in the ciphertext one by one with the position values ​​corresponding to the same characters in key2, and restore to the second value list; S42, according to the second value list, obtain the characters at the corresponding positions in key1 one by one to generate a third value list; S43, generating a ciphertext de-sequence index table with the same length as the ciphertext length, starting from 0 and increasing by 1 each time; S44, using the step parameter, performing the same Joseph ring transformation as in the encryption process on the equal-length ciphertext de-sequence index table to generate a fourth value list; S45. According to the fourth value list and the third value list, assign values ​​one by one to restore the plain text.

2. The method of equal-length symmetric encryption and decryption based on the concept of Joseph ring according to claim 1, characterized in that: The fourth value list is the position information of the characters in the plain text.

3. The method of equal-length symmetric encryption and decryption based on the concept of Joseph ring according to claim 1, characterized in that: The third value list is the value corresponding to each position information in the fourth value list.

4. An equal-length symmetric encryption and decryption device based on the concept of Joseph rings, characterized in that: The device includes: Encryption module, used to convert plain text into cipher text to ensure the secure transmission or storage of information; The decryption module is used to restore the ciphertext to plaintext so that the information can be read or processed normally.

5. A computer-readable storage medium having program instructions stored therein, characterized in that: When the program instructions are executed by a processor, the method as claimed in any one of claims 1 to 7 is implemented.