Encryption and decryption method and device, electronic equipment and computer readable storage medium

By dynamically generating encrypted ciphertext by retrieving time numbers, sort numbers, and formula numbers from a keychain library, the problem of traditional encryption methods being easily cracked is solved, thus improving the security of data encryption.

CN119835015BActive Publication Date: 2025-12-12CHINA TELECOM CORP LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411836724.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-12
Publication Date
2025-12-12
Estimated Expiration
2044-12-12

AI Technical Summary

Technical Problem

Traditional data encryption methods are easily cracked, and custom encryption methods are insecure over a long period of time due to the fixed nature of the keys and algorithms.

Method used

The method retrieves the time number, sort number, formula number, and password book number from the keychain library, splits the data to be encrypted, and encrypts it using preset encoding rules and formulas to generate dynamic encrypted ciphertext.

Benefits of technology

By dynamically generating encrypted ciphertext, the possibility of cracking is reduced, and the security of encryption is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119835015B_ABST
    Figure CN119835015B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide an encryption and decryption method and device, electronic equipment and computer readable storage medium, comprising: obtaining a keychain used for encryption from a keychain library, and splitting the keychain to obtain a time number, a sorting number, a formula number and a password table number; splitting the data to be encrypted to obtain a plurality of single characters; converting each single character using a preset first encoding rule to obtain a first code corresponding to each single character; and encrypting the first code corresponding to each single character based on the time number, the sorting number, the formula number and the password table number to obtain encrypted ciphertext corresponding to each single character. Embodiments of the present application greatly reduce the possibility of cracking and ensure the security of encryption.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the network security technical field, in particular to an encryption and decryption method, an encryption and decryption device, an electronic device and a computer readable storage medium. BACKGROUND

[0002] In the existing project development, data encryption usually adopts a traditional data encryption mode or a custom encryption mode.

[0003] However, the traditional data encryption mode is easy to be cracked. And the custom encryption mode, such as a key combination algorithm, will affect the security of the mode due to the length, complexity, long use time, non-timely replacement and fixedness of the key and algorithm. These data encryption modes are safe in a short time, but the key and the combined algorithm of these data encryption modes are relatively fixed, and are not a safe mode in a long time. SUMMARY

[0004] In view of the above problems, the present application embodiments are proposed to provide an encryption and decryption method, an encryption and decryption device, an electronic device and a computer readable storage medium which overcome the above problems or at least partially solve the above problems.

[0005] In order to solve the above problems, the present application embodiments disclose an encryption method, which comprises:

[0006] Obtaining a keychain for encryption from a keychain library, and splitting the keychain to obtain a time number, a sorting number, a formula number and a password table number;

[0007] Splitting the data to be encrypted to obtain a plurality of single characters;

[0008] Converting each single character by using a preset first encoding rule to obtain a first code corresponding to each single character;

[0009] Encrypting the first code corresponding to each single character based on the time number, the sorting number, the formula number and the password table number to obtain encrypted ciphertext corresponding to each single character.

[0010] In one or more embodiments, the encryption of the first code corresponding to each single character based on the time number, the sorting number, the formula number and the password table number to obtain encrypted ciphertext corresponding to each single character comprises:

[0011] Determining the current time information by using the time number; the current time information comprises a plurality of information items;

[0012] Determine the order of each information item by using the order number, and obtain ordered information items;

[0013] Calculate the offset of the first encoding by using the first encoding, the ordered information item, and the formula number, and obtain the first offset;

[0014] Determine the encrypted ciphertext corresponding to each single character by using the first offset and the password table number.

[0015] In one or more embodiments, the calculating the offset of the first encoding by using the first encoding, the ordered information item, and the formula number, and obtaining the first offset, comprises:

[0016] S1, obtaining the first formula sub-number in the formula number as the first formula sub-number, and obtaining the first information item in the ordered information item as the first information item;

[0017] S2, obtaining the first function formula corresponding to the first formula sub-number, and the first parameter value of the first information item;

[0018] S3, detecting whether the first formula sub-number is the first in the formula number, if yes, executing S4, if not, executing S5;

[0019] S4, substituting the first encoding and the first parameter value into the first function formula to obtain the first candidate offset corresponding to the first information item, and executing S6;

[0020] S5, substituting the candidate offset corresponding to the previous information item and the first parameter value into the first function formula to obtain the first candidate offset corresponding to the first information item, and executing S6;

[0021] S6, detecting whether there is a next formula sub-number, if yes, executing S7, if not, obtaining the first offset;

[0022] S7, obtaining the next formula sub-number in the formula number as the first formula sub-number, and obtaining the next information item in the ordered information item as the first information item, and executing S2.

[0023] In one or more embodiments, the determining the encrypted ciphertext corresponding to each single character by using the first offset and the password table number comprises:

[0024] Converting the first offset by using a preset second encoding rule to obtain a corresponding second encoding;

[0025] Determining the corresponding password table according to the password table number;

[0026] The second encoding is an encoding field of the encrypted ciphertext, and a character field of the ciphertext is randomly selected from the password book.

[0027] Correspondingly, the application discloses a decryption method, comprising:

[0028] Obtaining a keychain for decryption from a keychain library, and splitting the keychain to obtain a time number, a sequence number, a formula number and a password book number;

[0029] Analyzing each encrypted ciphertext based on the password number to obtain a first offset corresponding to each ciphertext;

[0030] Analyzing the first offset based on the time number, the sequence number and the formula number to obtain a second offset corresponding to each ciphertext;

[0031] Converting each second offset by using a preset first encoding rule to obtain each single character after decryption.

[0032] In one or more embodiments, the analyzing each encrypted ciphertext based on the password number to obtain a first offset corresponding to each ciphertext comprises:

[0033] Determining a corresponding password book according to the password book number;

[0034] Querying each ciphertext by using the password book to obtain a second encoding corresponding to each ciphertext;

[0035] Converting each second encoding by using a preset third encoding rule to obtain each first offset.

[0036] In one or more embodiments, the analyzing the first offset based on the time number, the sequence number and the formula number to obtain a second offset corresponding to each ciphertext comprises:

[0037] Determining current time information by using the time number; the current time information comprises a plurality of information items;

[0038] Determining the sequence of each information item by using the sequence number to obtain the sorted information item;

[0039] Analyzing the first offset by using the first offset, the sorted information item and the formula number to obtain a second offset corresponding to each ciphertext.

[0040] In one or more embodiments, the adopting the first offset, the sorted information item, and the formula number to parse the first offset to obtain a second offset corresponding to each ciphertext comprises:

[0041] S1, obtaining a last formula sub-number in the formula number as a second formula sub-number, and obtaining a last information item in the sorted information item as a second information item;

[0042] S2, obtaining a second function formula corresponding to the second formula sub-number, and a second parameter value of the second information item;

[0043] S3, detecting whether the second formula sub-number is the last one in the formula number, if yes, performing S4, and if no, performing S5;

[0044] S4, substituting the first offset and the second parameter value into the second function formula to obtain a second candidate offset corresponding to the second information item, and performing S6;

[0045] S5, substituting a candidate offset corresponding to a next information item and the second parameter value into the second function formula to obtain a second candidate offset corresponding to the second information item, and performing S6;

[0046] S6, detecting whether there is a previous formula sub-number, if yes, performing S7, and if no, obtaining a second offset;

[0047] S7, obtaining a previous formula sub-number in the formula number as a second formula sub-number, and obtaining a previous information item in the sorted information item as a second information item, and performing S2.

[0048] Correspondingly, the application discloses an encryption device, which comprises:

[0049] A first obtaining module is configured to obtain a keychain for encryption from a keychain library, and split the keychain to obtain a time number, a sorting number, a formula number, and a password book number;

[0050] A splitting module is configured to split to-be-encrypted data to obtain a plurality of single characters;

[0051] A first conversion module is configured to convert each single character by using a preset first encoding rule to obtain a first code corresponding to each single character;

[0052] An encryption module is configured to encrypt the first code corresponding to each single character based on the time number, the sorting number, the formula number, and the password book number to obtain encrypted ciphertext corresponding to each single character.

[0053] In one or more embodiments, the encryption module comprises:

[0054] a first processing submodule configured to determine current time information according to the time number; the current time information comprises a plurality of information items;

[0055] a second processing submodule configured to determine the order of each of the information items according to the order number, to obtain ordered information items;

[0056] a third processing submodule configured to calculate the offset of the first encoding according to the first encoding, the ordered information items and the formula number, to obtain a first offset;

[0057] a fourth processing submodule configured to determine the encrypted ciphertext corresponding to each single character according to the first offset and the password number.

[0058] In one or more embodiments, the third processing submodule is specifically configured to:

[0059] S1, obtaining a first formula sub-number in the formula number as a first formula sub-number, and obtaining a first information item in the ordered information items as a first information item;

[0060] S2, obtaining a first function formula corresponding to the first formula sub-number, and a first parameter value of the first information item;

[0061] S3, detecting whether the first formula sub-number is the first in the formula number, if yes, performing S4, if not, performing S5;

[0062] S4, substituting the first encoding and the first parameter value into the first function formula to obtain a first candidate offset corresponding to the first information item, and performing S6;

[0063] S5, substituting the candidate offset corresponding to the previous information item and the first parameter value into the first function formula to obtain a first candidate offset corresponding to the first information item, and performing S6;

[0064] S6, detecting whether there is a next formula sub-number, if yes, performing S7, if not, obtaining a first offset;

[0065] S7, obtaining a next formula sub-number in the formula number as a first formula sub-number, and obtaining a next information item in the ordered information items as a first information item, and performing S2.

[0066] In one or more embodiments, the fourth processing submodule is specifically configured to:

[0067] The first offset is converted by using a preset second encoding rule to obtain a corresponding second encoding;

[0068] A corresponding password book is determined according to the password book number;

[0069] The second encoding is taken as an encoding field of the encrypted ciphertext, and a character is randomly selected from the password book as a character field of the ciphertext.

[0070] Correspondingly, the application discloses a decryption device, and the device comprises:

[0071] A second acquisition module is configured to acquire a keychain used for decryption from a keychain library, and split the keychain to obtain a time number, a sorting number, a formula number and a password book number;

[0072] A first decryption module is configured to parse each encrypted ciphertext based on the password number to obtain a first offset corresponding to each ciphertext;

[0073] A second decryption module is configured to parse the first offset based on the time number, the sorting number and the formula number to obtain a second offset corresponding to each ciphertext;

[0074] A second conversion module is configured to convert each second offset by using a preset first encoding rule to obtain each single character after decryption.

[0075] In one or more embodiments, the first decryption module is specifically configured to:

[0076] A corresponding password book is determined according to the password book number;

[0077] Each ciphertext is queried by using the password book to obtain a second encoding corresponding to each ciphertext;

[0078] Each second encoding is converted by using a preset third encoding rule to obtain each first offset.

[0079] In one or more embodiments, the second decryption module comprises:

[0080] A fifth processing sub-module is configured to determine current time information by using the time number; the current time information comprises a plurality of information items;

[0081] A sixth processing sub-module is configured to determine the sorting of each information item by using the sorting number to obtain sorted information items;

[0082] The seventh processing submodule is configured to parse the first offset, the sorted information item and the formula number to obtain a second offset corresponding to each ciphertext.

[0083] In one or more embodiments, the seventh processing submodule is specifically configured to:

[0084] S1, obtaining a last formula sub-number in the formula number as a second formula sub-number, and obtaining a last information item in the sorted information item as a second information item;

[0085] S2, obtaining a second function formula corresponding to the second formula sub-number, and a second parameter value of the second information item;

[0086] S3, detecting whether the second formula sub-number is the last one in the formula number, if yes, performing S4, and if no, performing S5;

[0087] S4, substituting the first offset and the second parameter value into the second function formula to obtain a second candidate offset corresponding to the second information item, and performing S6;

[0088] S5, substituting a candidate offset corresponding to a next information item and the second parameter value into the second function formula to obtain a second candidate offset corresponding to the second information item, and performing S6;

[0089] S6, detecting whether there is a last formula sub-number, if yes, performing S7, and if no, obtaining a second offset;

[0090] S7, obtaining a last formula sub-number in the formula number as a second formula sub-number, and obtaining a last information item in the sorted information item as a second information item, and performing S2.

[0091] Correspondingly, an electronic device is disclosed, which comprises a processor, a memory, and a computer program stored in the memory and capable of running on the processor, and the computer program, when executed by the processor, implements each step of the encryption method embodiment and the decryption method embodiment.

[0092] Correspondingly, a computer readable storage medium is disclosed, which stores a computer program, and the computer program, when executed by a processor, implements each step of the encryption method embodiment and the decryption method embodiment.

[0093] Embodiments of the present application have the following advantages:

[0094] Obtain a keychain for encryption from a keychain library, and split the keychain to obtain a time number, a sequence number, a formula number and a password table number; split the data to be encrypted to obtain a plurality of single characters; convert each single character using a preset first encoding rule to obtain a first code corresponding to each single character; encrypt the first code corresponding to each single character based on the time number, the sequence number, the formula number and the password table number to obtain encrypted ciphertext corresponding to each single character. Since the time information corresponding to the time number, the time information item corresponding to the sequence number, the function formula corresponding to the formula number and the password table corresponding to the password table number are all not fixed, therefore, for the same data, the ciphertext obtained by using different keychains for encryption can also be different, relative to the fixed key and password table, greatly reducing the possibility of cracking, and ensuring the security of encryption. BRIEF DESCRIPTION OF DRAWINGS

[0095] Figure 1 is a step flowchart of an encryption method embodiment one of the present application;

[0096] Figure 2 is a step flowchart of calculating the first offset of the present application;

[0097] Figure 3 is a step flowchart of a decryption method embodiment two of the present application;

[0098] Figure 4 is a step flowchart of calculating the second offset of the present application;

[0099] Figure 5 is a structure block diagram of an encryption device embodiment one of the present application;

[0100] Figure 6 is a structure block diagram of a decryption device embodiment two of the present application. DETAILED DESCRIPTION

[0101] In order to make the above objectives, features and advantages of the present application more apparent and understandable, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0102] One of the core ideas of the embodiments of the present application is that since the time information corresponding to the time number, the time information item corresponding to the sequence number, the function formula corresponding to the formula number and the password table corresponding to the password table number are all not fixed, therefore, for the same data, the ciphertext obtained by using different keychains for encryption can also be different, relative to the fixed key and password table, greatly reducing the possibility of cracking, and ensuring the security of encryption.

[0103] REFERENCE Figure 1, shows a step flow chart of an encryption method embodiment of the present application, and can specifically include the following steps:

[0104] Step 101, obtaining a key string for encryption from a key string library, and splitting the key string to obtain a time number, a sequence number, a formula number and a password table number.

[0105] Specifically, the key string library can store a key string, and the key string can include a time number, a sequence number, a formula number and a password table number.

[0106] The time number is used to represent the number corresponding to the current time information, and the current time information can be the information of the time when the key string is generated, which can include multiple information items: season, week, year, month, day, hour, minute and second. Among them, spring, summer, autumn and winter in the season can be represented by 1, 2, 3 and 4 respectively, for example, February is in winter, so the parameter value of the information item of the season corresponding to February is “4”; Monday to Sunday are represented by 1-7, for example, the parameter value of the information item of the week corresponding to Monday is “1”. The time number can be denoted as S001.

[0107] It should be noted that the current time information can include other information items in addition to the above information items, and the representation of each information item can be in addition to the above representation, and in actual application, the specific information items and the representation of the information items can be set according to actual needs, and the present application does not limit this.

[0108] The sequence number is used to represent the number corresponding to the arrangement order of the sequence number of each information item. For example, the default arrangement order of the information items is: season, week, year, month, day, hour, minute and second, and the corresponding sequence number is: 1, 2, 3, 4, 5, 6, 7, and the sequence after rearranging each sequence number is: 2, 1, 6, 7, 8, 3, 4, 5, that is, week, season, hour, minute, second, year, month and day. The sequence number can be denoted as X001.

[0109] It should be noted that the sequence of the rearranged information items can be other than the above sequence, and in actual application, the sequence of the information items corresponding to the sequence number can be set according to actual needs, and the present application does not limit this.

[0110] The formula number is used to represent the number of the formula used in encryption. The number of formulas is the same as the number of information items. That is, the formula number includes multiple formula sub-numbers, and each information item corresponds to a formula sub-number. Each formula sub-number corresponds to a function formula, and the unknown number in the function formula is not less than two. Therefore, the function formula can be a binary quadratic equation or a binary linear equation. The value after the line number of the function formula is a null value, which is generated by calculation.

[0111] Further, the function formulas corresponding to each formula sub-number are different from each other, and the value calculated by the function formula corresponding to the current information item is used as the input of the function formula corresponding to the next information item. For example, the value calculated by the function formula corresponding to the first information item is used as the input of the function formula corresponding to the second information item. The value calculated by the function formula corresponding to the last information item is used as the offset (to be described below). In the embodiment of the present application, the number of information items is 8, so 8 formula sub-numbers can be corresponded, which are denoted as G001-G008.

[0112] It should be noted that the specific form of the function formula can be in other forms in addition to the above-mentioned form. In actual application, the specific form of the function formula can be set according to actual needs, and the embodiment of the present application does not limit this.

[0113] The password book number is used to represent the number of the password book. The password book is used to encrypt and decrypt the text, that is, a one-time password book. The password book is random and has no specific rule. It can be a string of random numbers, a sentence, or an English classic. The password book is at least as long as the data to be encrypted. The text used for encryption (password book) can only be used once, and when it is no longer used, the text used for encryption should be destroyed to prevent repeated use. The password book number can be denoted as M001. That is, the complete keychain can be denoted as S001X001G001G002G003G004G005G006G007G008M001.

[0114] After obtaining the keychain, the keychain can be split to obtain the time number, the sorting number, the formula number, and the password book number.

[0115] In step 102, the data to be encrypted is split to obtain multiple single characters.

[0116] After obtaining the time number, the sorting number, the formula number, and the password book number, the data to be encrypted can be split to obtain multiple single characters. For example, the data to be encrypted is "oCJ[V4}&%", and after splitting, multiple single characters "o", "C", "J", "[", "V", "4", "}", "&", and "%" are obtained.

[0117] In step 103, each single character is converted by using a preset first encoding rule to obtain a first encoding corresponding to each single character.

[0118] After obtaining each single character, a preset encoding rule (denoted as "first encoding rule" for the sake of distinction) is used to convert each single character, so as to obtain an encoding (denoted as "first encoding") corresponding to each single character. The first encoding rule can be a utf-8 encoding rule. For example, "%" is converted by using the utf-8 encoding rule, and a decimal encoding "37" is obtained. Of course, the first encoding rule can be other encoding rules besides the above encoding rule. In actual application, the specific encoding rule can be set according to actual needs, and the embodiment of the present application does not limit this.

[0119] In step 104, the first encoding corresponding to each single character is encrypted based on the time number, the sorting number, the formula number and the password table number, so as to obtain encrypted ciphertext corresponding to each single character.

[0120] After obtaining the first encoding, the first encoding corresponding to each single character is encrypted by using the time number, the sorting number, the formula number and the password table number, so as to obtain encrypted ciphertext corresponding to each single character. For example, for the single character "%", after obtaining the corresponding first encoding "37", "37" is encrypted by using the time number, the sorting number, the formula number and the password table number in turn, so as to obtain the final encrypted ciphertext.

[0121] In the embodiment of the present application, the first encoding corresponding to each single character is encrypted based on the time number, the sorting number, the formula number and the password table number, so as to obtain encrypted ciphertext corresponding to each single character, including:

[0122] The current time information is determined by using the time number. The current time information includes a plurality of information items;

[0123] The sorting of each information item is determined by using the sorting number, so as to obtain sorted information items;

[0124] The first encoding is calculated by using the first encoding, the sorted information items and the formula number, so as to obtain a first offset;

[0125] The encrypted ciphertext corresponding to each single character is determined by using the first offset and the password table number.

[0126] Specifically, in the encryption, the current time information can be determined by using the time number, and the current time information can include multiple information items, such as "season, week, year, month, day, hour, minute, and second", as described above.

[0127] Then, the reordered sequence numbers of the information items are obtained by using the sorting number, and the reordered information items are determined according to the reordered sequence numbers. For example, the reordered sequence numbers are 2, 1, 6, 7, 8, 3, 4, and 5, and the corresponding reordered information items are week, season, hour, minute, second, year, month, and day.

[0128] The offset of the single character (denoted as "first offset") is calculated based on the first encoding, the reordered information items, and the formula number. For example, the first encoding is calculated based on the week, the season, the hour, the minute, the second, the year, the month, the day, and the formula sub-number, and the final first offset is obtained.

[0129] The encrypted ciphertext corresponding to each single character can be determined based on the first offset and the password number. For example, the encrypted ciphertext is obtained by converting the first offset based on the password number.

[0130] In the embodiment of the present application, the calculation of the offset of the first encoding based on the first encoding, the reordered information items, and the formula number to obtain the first offset comprises:

[0131] S1, the first formula sub-number in the formula number is obtained as a first formula sub-number, and the first information item in the reordered information items is obtained as a first information item;

[0132] S2, the first function formula corresponding to the first formula sub-number is obtained, and the first parameter value of the first information item is obtained;

[0133] S3, it is detected whether the first formula sub-number is the first one in the formula number, if yes, S4 is executed, and if no, S5 is executed;

[0134] S4, the first encoding and the first parameter value are substituted into the first function formula to obtain the first candidate offset of the first information item, and S6 is executed;

[0135] S5, the candidate offset of the previous information item and the first parameter value are substituted into the first function formula to obtain the first candidate offset of the first information item, and S6 is executed;

[0136] S6, it is detected whether there is a next formula sub-number, if yes, S7 is executed, and if no, the first offset is obtained;

[0137] S7, obtaining the next formula sub-number in the formula number as a first formula sub-number, and obtaining the next information item in the sorted information items as a first information item, performing S2.

[0138] In particular, referring to Figure 2 , a step flow chart of calculating the first offset is shown. For the formula number, a first formula sub-number (denoted as "first formula sub-number") can be obtained, and a first information item in the sorted information items (denoted as "first information item") can be obtained.

[0139] Then a function formula corresponding to the first formula sub-number (denoted as "first function formula") can be obtained, and a parameter value of the first information item (denoted as "first parameter value") can be obtained.

[0140] It is detected whether the first formula sub-number is the first one in the formula number. If yes, the first parameter value and the first encoding are substituted into the first function formula, and thus a candidate offset corresponding to the first information item (denoted as "first candidate offset") can be calculated.

[0141] If the first formula sub-number is not the first one in the formula number, the first parameter value and a candidate offset corresponding to the previous information item are substituted into the first function formula, and thus the first candidate offset corresponding to the first information item is obtained.

[0142] It is detected whether there is a next formula sub-number. If yes, the next formula sub-number is obtained as a new first formula sub-number, and the next information item is obtained as a new first information item.

[0143] The first function formula corresponding to the first formula sub-number (i.e. the function formula corresponding to the next formula sub-number) and the first parameter value of the first information item (i.e. the parameter value corresponding to the next information item) are obtained, and the first candidate offset and the first parameter value are substituted into the first function formula, and thus a new first candidate offset is obtained (i.e. the case that the first formula sub-number is not the first one in the formula number).

[0144] Then the above steps are repeated for the next formula sub-number, until it is detected that there is no next formula sub-number, and thus a final offset (denoted as "first offset") can be obtained.

[0145] For example, continuing the above example, after obtaining the first code "37", the first formula sub-number in the formula number and the corresponding function formula are obtained, that is, the function formula corresponding to G001, which is assumed to be "3x+4y="; and the parameter value corresponding to the first information item in the sorted information item is obtained, that is, the parameter value corresponding to "week", which is assumed to be "7" (i.e. Sunday); then "37" and "7" are substituted into the function formula, that is, "3*37+4*7=139", and "139" is the offset corresponding to the first information item.

[0146] The second formula sub-number in the formula number and the corresponding function formula are obtained, that is, the function formula corresponding to G002, which is assumed to be "2x-100y="; and the parameter value corresponding to the second information item in the sorted information item is obtained, that is, the parameter value corresponding to "season", which is assumed to be "4" (i.e. winter); since G002 is not the first or the last in the formula number, "139" and "4" are substituted into the function formula, that is, "2*139-100*4=-122", and "-122" is the offset corresponding to the second information item.

[0147] By analogy, until the offset corresponding to G008 is calculated, which is assumed to be "800", then "800" is the final offset (i.e. the first offset).

[0148] It should be noted that, in addition to the offset calculated from the current information item as the parameter value of x in the function formula corresponding to the next information item, and the parameter value corresponding to the next information item as the parameter value of y in the function formula, the offset can also be used as the parameter value of y, and the parameter value corresponding to the information item as the parameter value of x. In actual application, the specific setting mode of the parameter value of the unknown can be set according to actual requirements, and the embodiment of the present application does not limit this.

[0149] In the embodiment of the present application, the first offset and the password table number are used to determine the encrypted ciphertext corresponding to each single character, which includes:

[0150] The first offset is converted by using a preset second encoding rule to obtain a corresponding second encoding;

[0151] The corresponding password table is determined according to the password table number;

[0152] The second encoding is matched with the encoding field in the password table, and the character field corresponding to the matched encoding field is used as the ciphertext corresponding to the single character.

[0153] Specifically, after the first offset is calculated, the first offset can be converted by using a preset second encoding rule to obtain a second encoding, wherein the second encoding rule can be a hexadecimal encoding.

[0154] The password book can include an encoding field and a character field, after the second encoding is obtained, the second encoding can be matched with the encoding field in the password book, and the character field corresponding to the matched encoding field is taken as the final ciphertext.

[0155] For example, continuing the above example, the first offset "800" is converted by hexadecimal to obtain the second encoding "320", and then the password book M001 is determined by using the password book number, and "320" is matched with the encoding field in the password book. Assuming that the "encoding field-character field" in the password book is "320-&", when the matching is successful, "&" can be taken as the final ciphertext.

[0156] It should be noted that the second encoding rule can be hexadecimal, and other encoding rules can also be used, which can be set according to actual needs in actual application, and the embodiments of the present application do not limit this.

[0157] Further, the password book can be updated every preset time interval, so that the difficulty of cracking can be improved. That is, the same key string can be used for encryption and decryption within a preset time interval. For example, key string 1 is used for encryption and decryption from January 1 to January 7, the password book is updated on January 8 to obtain new key string 2, and key string 2 is used for encryption and decryption from January 8 to January 15.

[0158] In the embodiments of the present application, the key string used for encryption is obtained from the key string library, and the key string is split to obtain a time number, a sorting number, a formula number and a password book number; the data to be encrypted is split to obtain a plurality of single characters; each single character is converted by using a preset first encoding rule to obtain a first encoding corresponding to each single character; and each single character corresponding to the first encoding is encrypted based on the time number, the sorting number, the formula number and the password book number to obtain encrypted ciphertext corresponding to each single character. Since the time information corresponding to the time number, the time information item corresponding to the sorting number, the function formula corresponding to the formula number and the password book corresponding to the password book number are all not fixed, therefore, for the same data, the ciphertext obtained by using different key strings for encryption can also be different, relative to the fixed key and password book, the possibility of cracking is greatly reduced, and the security of encryption is ensured.

[0159] Referring to Figure 3 , a step flowchart of a second decryption method embodiment of the present application is shown, which can specifically include the following steps:

[0160] Step 301, obtain a key string for decryption from a key string library, and split the key string to obtain a time number, a sequence number, a formula number and a password table number.

[0161] Specifically, the key string library can store a key string, and the key string can include a time number, a sequence number, a formula number and a password table number. After obtaining the key string, the key string is split to obtain the time number, the sequence number, the formula number and the password table number.

[0162] Step 302, based on the password number, each ciphertext after encryption is parsed to obtain the first offset corresponding to each ciphertext.

[0163] Since the decryption process is opposite to the encryption process, after obtaining the password table number, each ciphertext after encryption can be parsed based on the password table number to obtain the first offset corresponding to each ciphertext. For example, during encryption, the first offset "800" corresponds to the ciphertext "&". Therefore, during decryption, "&" can be parsed as "800".

[0164] In the embodiment of the application, based on the password number, each ciphertext after encryption is parsed to obtain the first offset corresponding to each ciphertext, comprising:

[0165] determining the corresponding password table according to the password table number;

[0166] querying each ciphertext using the password table to obtain the second encoding corresponding to each ciphertext;

[0167] using a preset third encoding rule to convert each second encoding to obtain each first offset.

[0168] Specifically, during decryption, the corresponding password table can be determined according to the password table number, and then each ciphertext is matched with the password table to obtain the second encoding corresponding to each ciphertext. Then, each second encoding is converted using a preset first encoding rule to obtain the first offset corresponding to each ciphertext. The third encoding rule can be a decimal encoding.

[0169] For example, for the ciphertext "&", the password table is determined according to the password table number M001, and "&" is matched with the character field in the password table to obtain the corresponding second encoding "320". The second encoding "320" is converted to a decimal encoding, i.e. "800", to obtain the first offset "800" corresponding to the ciphertext "&".

[0170] It should be noted that the third encoding rule can be other than decimal, and in actual application, the third encoding rule can be set according to actual requirements, and the embodiment of the application does not limit this.

[0171] In step 303, the first offset is parsed based on the time number, the sorting number and the formula number to obtain the second offset corresponding to each ciphertext.

[0172] After obtaining the first offset, the first offset can be parsed by using the time number, the sorting number and the formula number to obtain the second offset corresponding to each ciphertext. The second offset is also the first encoding in the encryption process. For example, for the ciphertext "&", after obtaining the first offset "800", the "800" is parsed by using the time number, the sorting number and the formula number in turn to obtain the second offset "37", which is the first encoding in the encryption process.

[0173] In the embodiment of the application, the parsing of the first offset based on the time number, the sorting number and the formula number to obtain the second offset corresponding to each ciphertext comprises:

[0174] The current time information is determined by using the time number; the current time information comprises a plurality of information items;

[0175] The sorting of each information item is determined by using the sorting number to obtain the sorted information items;

[0176] The first offset is parsed by using the first offset, the sorted information items and the formula number to obtain the second offset corresponding to each ciphertext.

[0177] Specifically, in the encryption, the current time information can be determined by using the time number, and as described above, the current time information can comprise a plurality of information items, such as "season, week, year, month, day, hour, minute and second".

[0178] Then, the re-ordered sequence numbers of the information items are obtained by using the sorting number, and the re-ordered information items are determined according to the re-ordered sequence numbers. For example, the re-ordered sequence numbers are 2, 1, 6, 7, 8, 3, 4 and 5, and the corresponding re-ordered information items are week, season, hour, minute, second, year, month and day.

[0179] The second offset of the ciphertext is calculated based on the first offset, the sorted information items and the formula number. For example, the first offset is calculated based on week, season, hour, minute, second, year, month and day and each formula sub-number in turn to obtain the final second offset.

[0180] In the embodiments of the present application, the first offset, the sorted information items, and the formula number are used to analyze the first offset, and a second offset corresponding to each ciphertext is obtained, comprising:

[0181] S1, obtaining the last formula sub-number in the formula number as a second formula sub-number, and obtaining the last information item in the sorted information items as a second information item;

[0182] S2, obtaining a second function formula corresponding to the second formula sub-number, and a second parameter value of the second information item;

[0183] S3, detecting whether the second formula sub-number is the last one in the formula number, if yes, performing S4, and if not, performing S5;

[0184] S4, substituting the first offset and the second parameter value into the second function formula to obtain a second candidate offset corresponding to the second information item, and performing S6;

[0185] S5, substituting a candidate offset corresponding to the next information item and the second parameter value into the second function formula to obtain a second candidate offset corresponding to the second information item, and performing S6;

[0186] S6, detecting whether there is a previous formula sub-number, if yes, performing S7, and if not, obtaining a second offset;

[0187] S7, obtaining a previous formula sub-number in the formula number as a second formula sub-number, and obtaining a previous information item in the sorted information items as a second information item, and performing S2.

[0188] Specifically, referring to Figure 4 , a step flow chart for calculating a second offset is shown. For the formula number, the last formula sub-number (denoted as "second formula sub-number") can be obtained, and the last information item in the sorted information items (denoted as "second information item") can be obtained.

[0189] Then, a function formula corresponding to the second formula sub-number (denoted as "second function formula") can be obtained, and a parameter value of the second information item (denoted as "second parameter value") can be obtained.

[0190] If the second formula sub-number is the last one in the formula number, the second parameter value and the first offset can be substituted into the first function formula, and the offset corresponding to the second information item (denoted as "second candidate offset") can be calculated.

[0191] If the second formula sub-number is not the last one in the formula number, then the second parameter value and the candidate offset corresponding to the next information item are substituted into the second function formula, so as to obtain the second candidate offset corresponding to the second information item.

[0192] If the last one exists, then the last one is obtained as the new second formula sub-number, and the last information item is obtained as the new second information item.

[0193] The second function formula corresponding to the second formula sub-number (i.e., the function formula corresponding to the last one) and the second parameter value of the second information item (i.e., the parameter value corresponding to the last information item) are obtained, and the second candidate offset and the second parameter value are substituted into the second function formula, so as to obtain a new second candidate offset (i.e., the case that the second formula sub-number is not the last one in the formula number).

[0194] Then the above steps are repeated for the last one until it is detected that the last one does not exist, so as to obtain the final second offset.

[0195] For example, after obtaining the first offset "800", the last one in the formula number and the corresponding function formula (i.e., the function formula corresponding to G008) are obtained, which is assumed to be "x+5y="; and the parameter value corresponding to the last information item in the sorted information items (i.e., the parameter value corresponding to "day") is obtained, which is assumed to be "5" (i.e., 5th); then "800" and "5" are substituted into the function formula, i.e., "800-5*26=670", and "670" is the offset corresponding to the last information item.

[0196] The second last one in the formula number and the corresponding function formula (i.e., the function formula corresponding to G007) are obtained, which is assumed to be "x-4y="; and the parameter value corresponding to the second last information item in the sorted information items (i.e., the parameter value corresponding to "month") is obtained, which is assumed to be "4" (i.e., April); since G007 is not the first one nor the last one in the formula number, "670" and "4" are substituted into the function formula, i.e., "670+4*2=678", and "678" is the offset corresponding to the second last information item.

[0197] Similarly, until the offset corresponding to G001 is calculated, which is assumed to be "37", then "37" is the final second offset (i.e., the first encoding).

[0198] In step 304, each second offset is converted by using a preset first encoding rule, so as to obtain each single character after decryption.

[0199] After obtaining the second offset, each second offset is converted by using a preset first encoding rule, so that a single character corresponding to each ciphertext is obtained after decryption. For example, after obtaining the second offset "37", "37" is converted by using the utf-8 encoding rule, so that the single character "%" is obtained.

[0200] In the embodiment of the present application, the key string used for encryption is used to decrypt the ciphertext, which greatly reduces the possibility of cracking and ensures the security of encryption.

[0201] It should be noted that, for the method embodiment, in order to simply describe, it is expressed as a series of action combinations, but those skilled in the art should know that the embodiment of the present application is not limited by the order of the described actions, because according to the embodiment of the present application, some steps can be performed in other order or simultaneously. Secondly, those skilled in the art should know that the embodiments described in the specification all belong to preferred embodiments, and the actions involved are not necessarily required by the embodiment of the present application.

[0202] Referring to Figure 5 , a structural block diagram of an encryption device embodiment one of the present application is shown, which can specifically include the following modules:

[0203] The first acquisition module 501 is configured to acquire a key string used for encryption from a key string library, and split the key string to obtain a time number, a sorting number, a formula number and a password table number;

[0204] The splitting module 502 is configured to split the data to be encrypted to obtain a plurality of single characters;

[0205] The first conversion module 503 is configured to convert each single character by using a preset first encoding rule to obtain a first encoding corresponding to each single character;

[0206] The encryption module 504 is configured to encrypt the first encoding corresponding to each single character based on the time number, the sorting number, the formula number and the password table number to obtain encrypted ciphertext corresponding to each single character.

[0207] In the embodiment of the present application, the encryption module includes:

[0208] The first processing submodule is configured to determine the current time information by using the time number; the current time information includes a plurality of information items;

[0209] The second processing submodule is configured to determine the sorting of each information item by using the sorting number to obtain sorted information items;

[0210] a third processing submodule, configured to calculate an offset of the first encoding by using the first encoding, the sorted information item and the formula number, to obtain a first offset;

[0211] a fourth processing submodule, configured to determine the encrypted ciphertext corresponding to each single character by using the first offset and the password table number.

[0212] In the embodiment of the present application, the third processing submodule is specifically configured to:

[0213] S1, obtaining a first formula sub-number in the formula number as a first formula sub-number, and obtaining a first information item in the sorted information item as a first information item;

[0214] S2, obtaining a first function formula corresponding to the first formula sub-number, and a first parameter value of the first information item;

[0215] S3, detecting whether the first formula sub-number is the first one in the formula number, if yes, performing S4, and if no, performing S5;

[0216] S4, substituting the first encoding and the first parameter value into the first function formula to obtain a first candidate offset corresponding to the first information item, and performing S6;

[0217] S5, substituting a candidate offset corresponding to a previous information item and the first parameter value into the first function formula to obtain a first candidate offset corresponding to the first information item, and performing S6;

[0218] S6, detecting whether there is a next formula sub-number, if yes, performing S7, and if no, obtaining a first offset;

[0219] S7, obtaining a next formula sub-number in the formula number as a first formula sub-number, and obtaining a next information item in the sorted information item as a first information item, and performing S2.

[0220] In the embodiment of the present application, the fourth processing submodule is specifically configured to:

[0221] convert the first offset by using a preset second encoding rule to obtain a corresponding second encoding;

[0222] determine a corresponding password table according to the password table number;

[0223] take the second encoding as an encoding field of the encrypted ciphertext, and randomly select a character from the password table as a character field of the ciphertext.

[0224] Reference Figure 6, shows a structural block diagram of an embodiment of a decryption device of the present application, and can specifically include the following modules:

[0225] The second obtaining module 601 is configured to obtain a keychain for decryption from a keychain library, and split the keychain to obtain a time number, a sequence number, a formula number and a password table number;

[0226] The first decryption module 602 is configured to parse each ciphertext after encryption based on the password number to obtain a first offset corresponding to each ciphertext;

[0227] The second decryption module 603 is configured to parse the first offset based on the time number, the sequence number and the formula number to obtain a second offset corresponding to each ciphertext;

[0228] The second conversion module 604 is configured to convert each second offset by using a preset first encoding rule to obtain each single character after decryption.

[0229] In the embodiment of the present application, the first decryption module is specifically configured to:

[0230] determine a corresponding password table according to the password table number;

[0231] query each ciphertext by using the password table to obtain a second encoding corresponding to each ciphertext;

[0232] convert each second encoding by using a preset third encoding rule to obtain each first offset.

[0233] In the embodiment of the present application, the second decryption module includes:

[0234] The fifth processing sub-module is configured to determine current time information by using the time number; the current time information includes a plurality of information items;

[0235] The sixth processing sub-module is configured to determine the sequence of each information item by using the sequence number to obtain the sorted information items;

[0236] The seventh processing sub-module is configured to parse the first offset by using the first offset, the sorted information items and the formula number to obtain a second offset corresponding to each ciphertext.

[0237] In the embodiment of the present application, the seventh processing sub-module is specifically configured to:

[0238] S1, obtain the last formula sub-number in the formula number as a second formula sub-number, and obtain the last information item in the sorted information items as a second information item;

[0239] S2, obtaining a second function formula corresponding to the second formula sub-number, and a second parameter value of the second information item;

[0240] S3, detecting whether the second formula sub-number is the last one in the formula number, if yes, performing S4, if not, performing S5;

[0241] S4, substituting the first offset and the second parameter value into the second function formula to obtain a second candidate offset corresponding to the second information item, and performing S6;

[0242] S5, substituting a candidate offset corresponding to a next information item and the second parameter value into the second function formula to obtain a second candidate offset corresponding to the second information item, and performing S6;

[0243] S6, detecting whether there is a previous formula sub-number, if yes, performing S7, if not, obtaining a second offset;

[0244] S7, obtaining a previous formula sub-number in the formula number as a second formula sub-number, and obtaining a previous information item in the sorted information items as a second information item, and performing S2.

[0245] For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the related parts refer to the part of the method embodiment.

[0246] The embodiment of the application further provides an electronic device, comprising:

[0247] The computer program is executed by the processor to realize the processes of the encryption and decryption method embodiments, and the same technical effects can be achieved, and thus the description is not repeated here.

[0248] The embodiment of the application further provides a computer readable storage medium, and the computer readable storage medium stores a computer program, the computer program is executed by the processor to realize the processes of the encryption and decryption method embodiments, and the same technical effects can be achieved, and thus the description is not repeated here.

[0249] Each embodiment in the specification is described in a progressive manner, and each embodiment focuses on the difference from other embodiments, and the same and similar parts of each embodiment can be referred to.

[0250] Those skilled in the art will appreciate that embodiments of the present application can be readily used as a method, apparatus, or computer program product. Accordingly, embodiments of the present application can take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present application can take the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROMs, optical storage devices, and the like) embodying computer program instructions.

[0251] Embodiments of the present application are described herein with reference to the Figure 1 one or more functions specified in a flow or multiple flows and / or blocks. Figure 1 an apparatus that performs the functions specified in a flow or multiple flows and / or blocks.

[0252] These computer program instructions can also be stored in a computer- readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instructions which implement the Figure 1 one or more functions specified in a flow or multiple flows and / or blocks. Figure 1 an apparatus that performs the functions specified in a flow or multiple flows and / or blocks.

[0253] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in a flow or multiple flows and / or blocks. Figure 1 one or more functions specified in a flow or multiple flows and / or blocks. Figure 1 an apparatus that performs the functions specified in a flow or multiple flows and / or blocks.

[0254] While preferred embodiments of the present application have been described, additional variations and modifications can be made to these embodiments by those skilled in the art once they have the benefit of the foregoing description. Therefore, the appended claims are intended to encompass within their scope all such variations and modifications as are included within the scope of the present application.

[0255] Finally, it is to be understood that the phraseology or terminology such as "first" and "second" etc. used herein is merely intended to differentiate one entity or operation from another entity or operation, without necessarily requiring or implying any actual such relationship or order between such entities or operations. Moreover, the terms "comprising", "including", or any other closure, are intended to cover the non-exclusive inclusion such that a process, method, article, or apparatus that comprises a list of elements does not include those elements alone but can include other elements not expressly listed or even include elements inherent in such process, method, article, or apparatus. Without more limitations, the element defined by the statement "comprising a" does not exclude the presence of additional identical elements in the process, method, article, or apparatus including the element.

[0256] The above describes in detail the encryption and decryption method and the encryption and decryption device provided by the present application. The principles and implementation manners of the present application are described by using specific examples. The above description of the embodiments is only used to help understand the method of the present application and its core idea. Meanwhile, for those skilled in the art, the specific implementation manners and application ranges will be changed according to the idea of the present application. In summary, the content of the specification should not be understood as a limitation of the present application.

Claims

1. An encryption method characterized by, The method comprises: Obtaining a keychain for encryption from a keychain library, and splitting the keychain to obtain a time number, a sequence number, a formula number and a password table number; the time number represents a number corresponding to current time information, the sequence number represents a number corresponding to a sequence order of a sequence number of an information item, the formula number represents a number corresponding to a formula used in encryption, and the password table number represents a number corresponding to a password table; Splitting the data to be encrypted to obtain a plurality of single characters; Converting each single character using a preset first encoding rule to obtain a first code corresponding to each single character; Determining a first offset of each first code based on the time number, the sequence number and the formula number, and encrypting the first code corresponding to each single character based on the first offset and the password table number to obtain encrypted ciphertext corresponding to each single character; the first offset is determined by recursive calculation using the sorted information item and the formula number.

2. The encryption method of claim 1, wherein, The method for determining the first offset of each first code based on the time number, the sequence number and the formula number, and encrypting the first code corresponding to each single character based on the first offset and the password table number to obtain encrypted ciphertext corresponding to each single character comprises: Determining current time information using the time number; the current time information comprises a plurality of information items; Determining the sequence of each information item using the sequence number to obtain sorted information items; Calculating the offset of the first code using the first code, the sorted information item and the formula number to obtain a first offset; Determining the encrypted ciphertext corresponding to each single character using the first offset and the password table number.

3. The encryption method of claim 2, wherein, The method for calculating the offset of the first code using the first code, the sorted information item and the formula number to obtain a first offset comprises: S1, obtaining a first formula sub-number in the formula number as a first formula sub-number, and obtaining a first information item in the sorted information item as a first information item; S2, obtaining a first function formula corresponding to the first formula sub-number, and a first parameter value of the first information item; S3, detecting whether the first formula sub-number is the first one in the formula number, if yes, performing S4, and if no, performing S5; S4, substituting the first code and the first parameter value into the first function formula to obtain a first candidate offset corresponding to the first information item, and performing S6; S5, substituting the candidate offset corresponding to the previous information item and the first parameter value into the first function formula to obtain a first candidate offset corresponding to the first information item, and performing S6; S6, detecting whether there is a next formula sub-number, if yes, performing S7, and if no, obtaining a first offset; S7, obtaining a next formula sub-number in the formula number as a first formula sub-number, and obtaining a next information item in the sorted information item as a first information item, and performing S2.

4. The encryption method of claim 2, wherein, The first offset and the password number are used to determine the encrypted ciphertext corresponding to each single character, including: The first offset is converted using a preset second encoding rule to obtain a corresponding second encoding; A corresponding password book is determined according to the password number; The second encoding is used as the encoding field of the encrypted ciphertext, and a character is randomly selected from the password book as the character field of the ciphertext.

5. A decryption method characterized by, It includes: Obtain the keychain used for decryption from the keychain library, and split the keychain to obtain the time number, the sorting number, the formula number and the password number; Based on the password number, each encrypted ciphertext is parsed to obtain the first offset corresponding to each ciphertext; Based on the time number, the sorting number and the formula number, the first offset is parsed to obtain the second offset corresponding to each ciphertext; the second offset is determined by recursive calculation using the sorted information item and the formula number; Each second offset is converted using a preset first encoding rule to obtain each single character after decryption.

6. The decryption method of claim 5, wherein, The first offset corresponding to each ciphertext is parsed based on the password number after each ciphertext is encrypted, including: A corresponding password book is determined according to the password number; Each ciphertext is queried using the password book to obtain the second encoding corresponding to each ciphertext; Each second offset is converted using a preset third encoding rule to obtain each first offset.

7. The decryption method of claim 5, wherein, Based on the time number, the sorting number and the formula number, the first offset is parsed to obtain the second offset corresponding to each ciphertext, including: The current time information is determined using the time number; the current time information includes multiple information items; The sorting of each information item is determined using the sorting number to obtain the sorted information item; The first offset is parsed using the first offset, the sorted information item and the formula number to obtain the second offset corresponding to each ciphertext.

8. The decryption method of claim 7, wherein, The first offset is parsed using the first offset, the sorted information item and the formula number to obtain the second offset corresponding to each ciphertext, including: S1, the last formula sub-number in the formula number is obtained as the second formula sub-number, and the last information item in the sorted information item is obtained as the second information item; S2, the second function formula corresponding to the second formula sub-number is obtained, and the second parameter value of the second information item is obtained; S3, it is detected whether the second formula sub-number is the last one in the formula number, if yes, S4 is executed, if not, S5 is executed; S4, the first offset and the second parameter value are substituted into the second function formula to obtain the second candidate offset corresponding to the second information item, and S6 is executed; S5, the candidate offset corresponding to the next information item and the second parameter value are substituted into the second function formula to obtain the second candidate offset corresponding to the second information item, and S6 is executed; S6, detecting whether there is a previous formula sub-number, if yes, executing S7, if no, obtaining a second offset; S7, obtaining the previous formula sub-number in the formula number as a second formula sub-number, and obtaining the previous information item in the sorted information items as a second information item, executing S2.

9. An encryption device, characterized by The device comprises: The first obtaining module is configured to obtain a keychain for encryption from a keychain library, and split the keychain to obtain a time number, a sorting number, a formula number, and a password table number; the time number represents a number corresponding to current time information, the sorting number represents a number corresponding to a sequence arrangement order of information item serial numbers, the formula number represents a number corresponding to a formula used in encryption, and the password table number represents a number corresponding to a password table; The splitting module is configured to split the data to be encrypted to obtain a plurality of single characters; The first conversion module is configured to convert each single character using a preset first encoding rule to obtain a first code corresponding to each single character. The encryption module is configured to determine a first offset of each first code based on the time number, the sorting number, and the formula number, and encrypt the first code corresponding to each single character based on the first offset and the password table number to obtain encrypted ciphertext corresponding to each single character; the first offset is determined by recursive calculation using the sorted information items and the formula number.

10. A decryption device, characterized by The device comprises: The second obtaining module is configured to obtain a keychain for decryption from a keychain library, and split the keychain to obtain a time number, a sorting number, a formula number, and a password table number; The first decryption module is configured to parse each encrypted ciphertext based on the password number to obtain a first offset corresponding to each ciphertext; The second decryption module is configured to parse the first offset based on the time number, the sorting number, and the formula number to obtain a second offset corresponding to each ciphertext; the second offset is determined by recursive calculation using the sorted information items and the formula number. The second conversion module is configured to convert each second offset using a preset first encoding rule to obtain decrypted single characters.

11. An electronic device, comprising: The device comprises: A processor, a memory, and a computer program stored on the memory and capable of running on the processor, when the computer program is executed by the processor, the steps of the encryption method according to any one of claims 1-4, or the decryption method according to any one of claims 5-8 are implemented.

12. A computer-readable storage medium, characterized in that, A computer program is stored on the computer readable storage medium, when the computer program is executed by the processor, the steps of the encryption method according to any one of claims 1-4, or the decryption method according to any one of claims 5-8 are implemented.

Citation Information

Patent Citations

  • Chinese encryption and decryption method, medium and device

    CN117595981A

  • Key generation method and device, data encryption method and device, storage medium and computer equipment

    CN118316727A