Encryption and decryption method for realizing dynamic filling and self-analysis through Emoji
By using dynamic filling and self-parsing encryption/decryption methods for Emoji symbols, the problems of poor user experience and low security in existing technologies are solved, realizing the flexibility and fun of ciphertext in chat scenarios, and enhancing both user experience and security.
Patent Information
- Application Number
- CN202511313969.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-15
- Publication Date
- 2025-12-12
AI Technical Summary
Existing encryption algorithms suffer from poor user experience, high maintenance costs, difficulty in decryption due to key loss, and easy inference of ciphertext in chat scenarios, making it difficult to enhance emotional and entertaining content while ensuring information security.
It uses Emoji symbols as keys and generates ciphertext of random length and content through dynamic padding and self-parsing encryption and decryption methods. It leverages the flexibility and fun of Emoji symbols and combines random header and footer data for encryption and decryption, and supports private configuration and custom logic.
It enables flexibility and fun in ciphertext in chat scenarios, enhances user experience, reduces dependence on keys, and improves algorithm security and decryption reliability.
Smart Images

Figure CN121125245A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of communication security encryption technology, in particular to a dynamic filling and self-analysis encryption and decryption method realized by Emoji. BACKGROUND
[0002] With the popularity of social networks and instant communication, more and more attention is paid to data security, sensitive information protection, and risk prevention and control of data leakage. In the context of network chat or communication, the encryption transmission of plaintext of sensitive data is a better solution.
[0003] There are many commonly used encryption algorithms, such as RSA, AES, DES, and SM2 series. However, data encryption and decryption requires user management of keys or certificates, increasing maintenance costs. Hex / Base64 ciphertexts result in "random codes" that are difficult for users to understand, causing cognitive burden and emotional disconnection in chat, leading to poor user experience. Some encryption algorithms have consistent ciphertexts or obvious patterns after encrypting the same plaintext, making them easy to reason and unsuitable for the frequency and lightweight characteristics of the communication field. At the same time, the commonly used algorithms must use keys for decryption, and for chat scenarios, finding historical record information for decryption may result in key loss and decryption failure.
[0004] Therefore, a technical solution is needed to ensure information security and encryption reliability while increasing emotion and interest in chat scenarios, making each message both a secret and an expression. SUMMARY
[0005] To achieve the above-mentioned purpose, the present application provides a dynamic filling and self-analysis encryption and decryption method realized by Emoji, including an encryption method and a decryption method. The encryption method includes the following steps: Defining an Emoji key and obtaining plaintext data; wherein the Emoji key is composed of a symbol string of Emoji symbols; Performing encryption initialization according to the Emoji key to generate key and corekey; wherein the length of corekey is N; Converting the plaintext data into filling unicode code point data corresponding to the plaintext characters; performing N-ary serialization on the filling unicode code point data to generate filling data; Generating Emoji ciphertext from the filling data through relationship mapping; Generating random header and random tail data according to key and corekey; Concatenating the random header, random tail data, and the Emoji ciphertext to generate ciphertext data.
[0006] Wherein, the key is composed by the symbol de-duplication of the emoji key, and is used to form the emoji symbol set of the ciphertext; The corekey is composed by the continuous extraction of N symbols from the key, and is used to form the minimum symbol set for plaintext substitution; Further, the encryption initialization further includes defining padding data; Before converting the plaintext data into the padding unicode code point data corresponding to the plaintext character, the plaintext data is randomly padded to generate a padding string; wherein, the padding data is used to randomly pad the plaintext data to generate the padding string.
[0007] Further, converting the padding string into the padding unicode code point data corresponding to the plaintext character includes: Extracting the characters of the plaintext data one by one, padding each character to generate a padding string, and when padding, adding a character randomly extracted from the padding data at the tail of each character, so that the length of the padding string is twice the length of the plaintext; Converting each symbol in the padding string into a decimal unicode encoding, and splicing the decimal unicode encodings of all symbols in the padding string to form the padding unicode code point; Using the N-ary serialization method, the padding symbol string is restructured to generate padding data, wherein N is the length of the corekey.
[0008] Wherein, N-ary serialization refers to converting the decimal unicode encoding of the padding string into N-ary to form the padding data; when converting each decimal unicode encoding, first generate the N-ary data corresponding to the decimal data, obtain the bit value of the N-ary data, and insert the bit value in front of the N-ary data; that is, the padding data corresponding to each plaintext character is composed of the bit number+N-ary data.
[0009] Further, the relationship mapping includes the following steps: Determine the character bit number; the character bit number is the bit length of the N-ary data corresponding to each plaintext character in N-ary serialization; According to the key, replace the character bit number with the emoji symbol; Determine the N-ary data corresponding to the plaintext character, and replace the N-ary data corresponding to the plaintext character with the emoji symbol according to the corekey; After extracting the bit length and N-ary data corresponding to all plaintext characters in the same way, the emoji replacement is realized to generate the emoji ciphertext.
[0010] Wherein, when generating the random header: defining the length of the random header, extracting random symbols from the key to generate the random header according to the length of the random header; When generating the random tail data: setting a hiding rule, defining the length of the random tail, extracting random symbols from the key to generate the random tail according to the length of the random tail and the hiding rule; wherein, the hiding rule is used to define the order, validity period, last bit of the random header, and expression of the first bit of the random tail of each Emoji in the key.
[0011] On the other hand, the decryption method includes the following steps: Obtaining ciphertext; Generating a key and a corekey according to the ciphertext and the hiding rule; wherein, the length of the corekey is N; Filtering the header data and the tail data from the ciphertext to generate pure ciphertext data; Decrypting the pure ciphertext data to restore the filled plaintext; Generating the original plaintext from the filled plaintext.
[0012] Further, decrypting the pure ciphertext data includes the following steps: Starting from the 0th position, traversing the pure ciphertext data to determine the Emoji symbol combination corresponding to the plaintext; Extracting N-ary data corresponding to each group of Emoji symbol combinations from the corekey; Restoring the N-ary data to decimal data; Setting the decimal data as a unicode code point, and extracting the character corresponding to the unicode code point.
[0013] Wherein, determining the Emoji symbol combination corresponding to the plaintext refers to: Extracting the 0th position Emoji symbol of the pure ciphertext data, and determining the position of the Emoji symbol from the key; the value M of the position indicates that the Mth position length of the symbol after the 0th position Emoji symbol is the Emoji symbol combination corresponding to the 0th position plaintext character; the position M' of the M+1th position Emoji symbol of the pure ciphertext data in the key is the length of the Emoji symbol corresponding to the next plaintext character, and the M+2th position to the M+2+M'th position symbol is the Emoji symbol combination corresponding to the next plaintext character; Repeating the above operation until the traversal of the pure ciphertext data is completed, and obtaining all the Emoji symbol combinations corresponding to the plaintext characters.
[0014] The cipher carrier can be flexible and interesting according to the application, the random effect of each encrypted cipher can increase the surprise of the user, and each cipher is different to endow the character with emotion and interest. Meanwhile, the algorithm of the application supports private configuration, the user can specify random filling data and key content, customize the generation logic of the header and tail, and no longer depends on the content of the key itself, and the security of the algorithm is enhanced through the key hiding position. BRIEF DESCRIPTION OF DRAWINGS
[0015] Figure 1 is a step diagram of an encryption method for realizing dynamic filling and self-analysis through Emoji according to an embodiment of the application; Figure 2 is a step diagram of a decryption method for realizing dynamic filling and self-analysis through Emoji according to an embodiment of the application; Figure 3 is an encryption initialization information schematic diagram in the encryption method process according to an embodiment of the application; Figure 4 is a process schematic diagram of plaintext conversion into Emoji cipher in the encryption method process according to an embodiment of the application. DETAILED DESCRIPTION
[0016] With the popularity of Emoji expression symbols, everyone likes to add the element to the chat content to express more emotion. Especially, Emoji is more vivid and lifelike than text when expressing real entities. Therefore, the application integrates the Emoji expression symbol into the encrypted cipher in the chat scene: a private algorithm with variable key length is adopted to dynamically generate the cipher length and cipher content through random filling, so as to guarantee the reliability of the algorithm.
[0017] The specific implementation mode of the application will be described in detail in combination with the drawings of the specification.
[0018] The encryption and decryption method for realizing dynamic filling and self-analysis through Emoji provided by the application includes an encryption method and a decryption method, supports python language programming, and the process and logic are realized through pure code without importing any package and library.
[0019] The encryption process is as shown in Figure 1 , including the following steps: Step S100: defining an Emoji key and obtaining plaintext data; wherein the Emoji key is composed of a symbol string of Emoji symbols, and the length of the symbol string is the length of the Emoji key; The Emoji symbol can be defined according to the application scene, for example: the symbol similar to can be used for the page related to food delivery, and the symbol similar to symbol.
[0020] In this step, define the combination of Emoji symbols to form the Emoji key, and the symbols in the Emoji key can be repeated.
[0021] For example, pre-define the Emoji key: , and encrypt the plaintext string "hello".
[0022] Step S110: Perform encryption initialization to generate key and corekey; where the length of corekey is N; The specific processing is as follows: Generate key: key is a set of Emoji symbols used to form the ciphertext, which is a set formed by de-duplicating the symbols of the Emoji key; the length of key needs to meet the bit requirements for subsequent mapping; Generate corekey with a specified length of N: corekey is the smallest set of symbols for plaintext replacement, which is formed by continuously extracting N symbols from key.
[0023] The embodiments provided by the present invention encrypt the plaintext "hello". At this time, the corresponding relationships between the bits of key, corekey, and the plaintext, as well as the bits of each character of key, corekey, and the plaintext are as Figure 3 shown.
[0024] At the same time, randomly define a paragraph of text as padding data for randomly padding the subsequent plaintext data to generate a padding string; For example: Define the padding data: fill_row_data = '豫章故郡洪都新府'.
[0025] Step S120: Randomly pad the plaintext data to generate a padding string, convert the padding string into padding unicode code point data corresponding to the plaintext characters; perform N-ary serialization on the padding unicode code point data to generate padding data; 1) First, extract the characters of the plaintext data one by one, and generate a padding string for each character. When padding, add a character randomly extracted from the padding data to the end of each character, so that the length of the padding string is twice the length of the plaintext; at this time, after padding 'hello', the generated padding string is 'h章e豫l郡l新o新'.
[0026] 2) Extract each symbol in the padding string and convert it into a decimal unicode encoding. The decimal unicode encodings of all symbols in the padding string are concatenated to form the padding unicode code point; For example: The padding unicode code points corresponding to each character in the padding string 'h章e豫l郡l新o新' are: '104', '31456', '101', '35947', '108', '37089', '108', '26032', '111', '26032'.
[0027] 3) Using the method of N - ary serialization, the padding string is structurally reconstructed to generate padding data, where N is the length of corekey. To make the number of digits of the data after N - ary serialization less than 10, the value of N needs to be greater than 4; in the present invention, the length of corekey is defined as 5, and 5 - ary serialization is performed in this step.
[0028] N - ary serialization means converting the decimal unicode encoding of the padding string to N - ary to form padding data; when converting each decimal code point, first generate the N - ary data corresponding to the decimal data, obtain the digit value of the N - ary data, and insert the digit value before the N - ary data, that is: the padding data corresponding to each plaintext character consists of the number of digits + N - ary data.
[0029] In the case provided by the present invention, N = 5, so 5 - ary serialization is performed in this step; Performing 5 - ary serialization on the padding unicode code points corresponding to each character in the padding string 'h章e豫l郡l新o新', after 5 - ary serialization of '104', '31456', '101', '35947', '108', '37089', '108', '26032', '111', '26032' is: '404', '2001311', '401', '2123242', '413', '2141324', '413', '1314112', '421', '1314112'; Extracting the number of digits of each character to generate mixed padding data representing the number of digits in decimal and the code points in 5 - ary, expressed as: code='340472001311340172123242341372141324341371314112342171314112', and the 0th bit of code is the number of digits corresponding to the first plaintext character.
[0030] Step S130: Generate Emoji ciphertext from the padding data through relationship mapping; Specifically, the relationship mapping includes the following steps: 1) Determine the character digit; the character digit is the length of the number of digits of the N - ary data corresponding to each plaintext character during N - ary serialization; For example, when determining the character bit number of code, the character bit number corresponding to the first plaintext character in code is extracted first, i.e. the 0th bit of coder, whose value is 3, indicating that the 1st to 3rd bits of code are 5-digit data corresponding to the N-digit data of the first plaintext character; the next bit is the character bit number corresponding to the next plaintext character, i.e. the 4th bit of code is 7, indicating that the 5th to 5+7=12th bits are N-digit data corresponding to the next plaintext character; the above operation is repeated to determine the character bit number and N-digit data from code.
[0031] 2) Replace the character bit number with an Emoji symbol according to the key; For example, the 0th bit and the 4th bit of code are replaced with the 3rd bit and the 7th bit of the key, respectively 、 .
[0032] 3) Determine the N-digit data corresponding to the plaintext character, and replace the N-digit data corresponding to the plaintext character with an Emoji symbol according to the core key; For example, the 4th bit of core key is , and the 0th bit is , then the Emoji corresponding to 404 is ; the 0th to 3rd bits of code 404 and the 5th to 12th bits of code 20013113 are replaced with and , respectively. According to the same method, after extracting the bit length and N-digit data corresponding to all plaintext characters, the Emoji replacement is realized to generate the Emoji ciphertext.
[0033] Figure 4 The process of directly converting the plaintext "hello" into an Emoji ciphertext without random padding is provided, as shown in Figure 4 : first, the decimal code point corresponding to each character of the plaintext is obtained; the decimal code is converted into 5-digit code to obtain the bit number corresponding to each plaintext character in 5-digit code; the value of the bit number is used to extract the Emoji corresponding to the bit number in the key as in Figure 3 ; the value of the 5-digit code is used to extract the Emoji corresponding to the bit number in the core key as in Figure 3 , and finally the ciphertext corresponding to code is generated.
[0034] Step S140: generating random head and random tail data according to the key and corekey; Defining the length of the random head: the length of the corekey N is continuously summed up and added to N to form the length of the random head. If N=5, the length of the random head symbol is (5+4+3+2+1)+5=20. The length of the random head can be used to reverse the length of the corekey during decryption. According to the length of the random head, the random head is generated by extracting random symbols from the key; Defining the length of the random tail: the length of the key plus the length of the random head; in the present application, the length of the random tail is 31 (the length of the key is 11 and the length of the random head is 20); Setting the hiding rule consistent with the decryption end, defining the expression of the order, validity period, last bit of the random head and first bit of the random tail of each Emoji in the key, which is used to extract the random head and the random tail during decryption, and analyze the key and the corekey; According to the length of the random tail and the hiding rule, the random tail is generated, which includes the order, validity period, last bit of the random head and first bit of the random tail of each Emoji in the key.
[0035] Step S150: concatenating the random head and random tail data and the Emoji ciphertext to generate ciphertext data.
[0036] At this time, the ciphertext composed of Emoji symbols is generated, which includes: 20-bit random head and 31-bit random tail, and the middle part is the Emoji ciphertext as pure ciphertext data.
[0037] For the ciphertext generated by the encryption method provided by the present application, the present application provides a decryption process as shown in Figure 2 The decryption process includes the following steps: Step S200: obtaining the ciphertext; The ciphertext obtained in this step is the ciphertext generated by the method of steps S100 to S150; that is, the content including the random head, the random tail and the pure ciphertext data.
[0038] Step S210: generating the key and the corekey according to the ciphertext; In this step, the random head and the random tail are parsed by the agreed hiding rule in step S140, and the key, the corekey and the validity period are extracted according to the agreement, wherein the length of the corekey is N.
[0039] If the current time has exceeded the validity period, it means that the ciphertext has expired, and the decryption is stopped.
[0040] Step S220: filtering random head data and random tail data from the ciphertext to generate pure ciphertext data; Corresponding to step S140, in this step, the data of 20-bit random head and 31-bit random tail are removed, and the pure ciphertext data is reserved.
[0041] Step S230: decrypting the pure ciphertext data to restore the padding plaintext; the decryption process includes the following steps: 1) traversing the pure ciphertext data from the 0th position to determine the plaintext corresponding emoji symbol combination: Extracting the 0th position emoji symbol of the pure ciphertext data, determining the position of the emoji symbol in the symbol string of the key; the value M of this position represents the M-bit length symbol after the 0th position emoji symbol as the emoji symbol combination corresponding to the 0th position plaintext character (the emoji symbol length corresponding to the plaintext character is M); through this method, the emoji symbol combination corresponding to the 0th position plaintext character is obtained; the emoji symbol of the M+1th position of the pure ciphertext data is in the position M' of the key, that is, the emoji symbol length corresponding to the next plaintext character, and the symbols from M+2 to M+2+M' are the emoji symbol combination corresponding to the first plaintext character.
[0042] Repeating the above operation, when the pure ciphertext data traversal is completed, the emoji symbol combinations corresponding to all plaintext characters can be obtained.
[0043] For example, the pure ciphertext data is The 0th position is the 3rd position in the key, so the 1st to 3rd positions of the ciphertext data are the emoji symbol combination corresponding to the 0th position plaintext character; the 4th position of the ciphertext data is the 7th position in the key, and the 7-bit symbol after it is the emoji symbol combination corresponding to the 1st position plaintext character; at this time, the emoji symbol combination of the ciphertext data is obtained: , .
[0044] 2) Extract the corresponding N-ary data of each group of emoji symbol combination from corekey: The number of bits of each symbol in the emoji symbol combination in corekey is the N-ary data corresponding to the symbol. In the case of the present application, respectively at the position 404 of corekey, respectively at the position 2001311 of corekey; 3) Restore the N-ary data to decimal data; For example, restore 404, 2000311 to decimal 104, 31456; 4) Set the decimal data as the unicode code point, and extract the corresponding characters, which are 'h' and 'chapter' respectively; that is, the padding plaintext is "h chapter".
[0045] Step S240: Remove the interval padding processing from the padding plaintext to generate the original plaintext; According to the padding method provided in step S120, remove the padding data from the padding plaintext "h chapter" to generate the original plaintext "h".
[0046] The encryption and decryption method provided by the present application can be implemented through python language, and the invention supports using any character set as ciphertext carrier and supports any form of plaintext data based on the unicode encoding characteristics of python language. When sending some sensitive pictures such as identity cards and bank cards in chat, the pictures can be converted into base64 strings, encrypted and sent, and the receiver can decrypt the original base64 string and restore it to a picture after receiving it.
[0047] Due to the flexible and interesting features of the ciphertext carrier of the application, the surprise of the user can be increased for each encrypted ciphertext random effect, and each ciphertext is different to give characters emotion and interest. At the same time, the algorithm of the application supports private configuration, the user can specify random filling data and key content, customize the head and tail generation logic, and enhance the security of the algorithm by hiding the key position.
[0048] The above disclosed is only several specific embodiments of the application, but the application is not limited thereto, and any changes that can be thought of by those skilled in the art shall fall within the protection scope of the application.
Claims
1. A method for encryption and decryption using Emojis to achieve dynamic filling and self-parsing, characterized in that, It includes an encryption method and a decryption method, wherein the encryption method includes the following steps: Define an Emoji key to obtain plaintext data; wherein, the Emoji key consists of a string of Emoji symbols; Encryption initialization is performed based on the Emoji key, generating key and corekey; wherein, the length of corekey is N; The plaintext data is converted into padding Unicode code point data corresponding to the plaintext characters; the padding Unicode code point data is serialized into N-ary format to generate padding data. The padding data is then used to generate Emoji ciphertext through relation mapping. Generate random header and random tail data based on the key and corekey; The random header data, random tail data, and the Emoji ciphertext are concatenated to generate ciphertext data.
2. The encryption / decryption method according to claim 1, characterized in that, The key is the set of Emoji symbols used to construct the ciphertext, which is formed by deduplicating the symbols of the Emoji key. corekey is a minimal set of symbols extracted consecutively from key, used for plaintext replacement.
3. The encryption / decryption method according to claim 1, characterized in that, The encryption initialization also includes defining padding data; the padding data is used to randomly fill plaintext data to generate a padding string; Before converting the plaintext data into padding Unicode code point data corresponding to the plaintext characters, the plaintext data is randomly padded to generate a padding string.
4. The encryption / decryption method according to claim 1, characterized in that, The step of converting the padding string into padding Unicode code point data corresponding to the plaintext characters includes: Extract characters from the plaintext data one by one, and fill each character to generate a fill string. When filling, add a character randomly extracted from the fill data to the end of each character so that the length of the fill string is twice the length of the plaintext. Extract each symbol in the fill string and convert it to decimal Unicode encoding. Concatenate the decimal Unicode encodings of all symbols in the fill string to form the fill Unicode code point. The padding data is generated by reconstructing the padding symbol string using an N-ary serialization method, where N is the length of the corekey.
5. The encryption / decryption method according to claim 3, characterized in that, The N-ary serialization refers to converting the decimal Unicode encoding of the padding string into N-ary data to form the padding data. When converting each decimal Unicode encoding, the corresponding N-ary data is first generated, the bit value of the N-ary data is obtained, and the bit value is inserted before the N-ary data. That is, the padding data corresponding to each plaintext character consists of the number of bits + N-ary data.
6. The encryption / decryption method according to claim 4, characterized in that, The relation mapping includes the following steps: Determine the number of character bits; the number of character bits is the length of the N-ary data corresponding to each plaintext character during N-ary serialization; Replace the number of characters with Emoji symbols based on the key; Determine the N-ary data corresponding to the plaintext character, and replace the N-ary data corresponding to the plaintext character with an Emoji symbol based on the corekey; After extracting the length of all plaintext characters and their N-ary data using the same method, Emoji replacement is performed to generate ciphertext Emojis.
7. The encryption / decryption method according to claim 1, characterized in that, When generating a random header: Define the length of the random header, and extract random symbols from the key to generate the random header based on the length of the random header; When generating random tail data: set hiding rules, define the length of the random tail, and extract symbols from the key to generate the random tail according to the length of the random tail and the hiding rules; wherein, the hiding rules are used to define the expression of the order, validity period, last character of the random header, and first character of the random tail of each Emoji in the key.
8. The encryption / decryption method according to claim 7, characterized in that, The decryption method includes the following steps: Obtain the ciphertext; Generate a key and a corekey based on the ciphertext and the hiding rules; wherein the length of the corekey is N; The header and footer data are filtered from the ciphertext to generate plain ciphertext data; The ciphertext data is decrypted to restore the plaintext data. The filled plaintext is used to generate the original plaintext.
9. The encryption / decryption method according to claim 8, characterized in that, Decrypting the plain ciphertext data includes the following steps: Starting from the 0th position, traverse the pure ciphertext data and determine the corresponding Emoji symbol combination for the plaintext. Extract the N-ary data corresponding to each Emoji symbol combination from the corekey; Convert the N-ary data back to decimal data; Assuming the decimal data is a Unicode code point, extract the character corresponding to the Unicode code point.
10. The encryption / decryption method according to claim 9, characterized in that, The determination of plaintext corresponding to Emoji symbol combinations refers to: Extract the 0th Emoji symbol from the plaintext data, and determine the position of the Emoji symbol from the key; the value M of the position indicates that the M-length symbol following the 0th Emoji symbol is the Emoji symbol combination corresponding to the 0th plaintext character; the position M' of the (M+1)th Emoji symbol in the key is the length of the Emoji symbol corresponding to the next plaintext character, and the symbols from the (M+2)th to (M+2+M')th positions are the Emoji symbol combinations corresponding to the next plaintext character; Repeat the above steps until all plaintext data has been traversed, and obtain the Emoji symbol combinations corresponding to all plaintext characters.