A string processing method, device, equipment and medium
By splitting, encoding and parsing the plain text string during data transmission, and generating cipher text strings and keys, the problem of insufficient security of data transmission information in the prior art is solved, and the security of data transmission is significantly improved.
Patent Information
- Application Number
- CN202211619204.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-14
- Publication Date
- 2025-06-10
- Estimated Expiration
- 2042-12-14
AI Technical Summary
The prior art cannot effectively protect the information security in data transmission during system interactive communication, resulting in a high possibility of information leakage.
By splitting, encoding, converting, and parsing the plain text string at the sending end, generating cipher text strings and keys, and performing corresponding decoding processing on the receiving end, to ensure the security of the data during transmission.
It improves the security of string processing and reduces the possibility of information leakage. Even if the data is hijacked, the difficulty and cost of encrypted data being cracked will be greatly increased.
Smart Images

Figure CN115906128B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and particularly to a string processing method, apparatus, device and medium. Background Art
[0002] Currently, during the system interaction and communication process, there are often some sensitive data transmissions. At this time, the sender needs to encode the information first and then send it. After the receiver receives the information, it decodes it to obtain the required information. There are many encoding and decoding methods that can be selected in the whole process, but the commonly used encoding and decoding methods are well-known, and the cracking methods are very mature. Therefore, it is impossible to effectively protect the security of the information in the data transmission.
[0003] As can be seen from the above, how to improve the security of string processing and reduce the occurrence of information leakage during the string processing is a problem to be solved in this field. Summary of the Invention
[0004] In view of this, the purpose of the present invention is to provide a string processing method, apparatus, device and medium, which can improve the security of string processing and reduce the occurrence of information leakage during the string processing. The specific solutions are as follows:
[0005] In a first aspect, the present application discloses a string processing method, which is applied to a sending end and includes:
[0006] Obtain a plaintext string, split and add indexes to the plaintext string to obtain each plaintext segment;
[0007] Perform encoding conversion on each plaintext segment to obtain each three-dimensional coordinate, determine each two-dimensional coordinate based on each three-dimensional coordinate, and then parse each two-dimensional coordinate to obtain a ciphertext character and a key segment;
[0008] Concatenate and compress the key segments to obtain a key, determine the number of characters of the plaintext string. If the number of characters is odd, splice the ciphertext characters according to a preset odd ciphertext splicing method to obtain a ciphertext string, and send the ciphertext string and the key to the receiving end.
[0009] Optionally, the performing encoding conversion on each plaintext segment to obtain each three-dimensional coordinate, and determining each two-dimensional coordinate based on each three-dimensional coordinate includes:
[0010] Perform ASCII encoding conversion on each plaintext segment to obtain each three-dimensional coordinate;
[0011] Draw a three-dimensional coordinate system based on each of the three-dimensional coordinates in a discretely distributed manner, and perform coordinate system projection processing on the three-dimensional coordinate system to obtain each two-dimensional coordinate.
[0012] Optionally, the performing coordinate system projection processing on the three-dimensional coordinate system to obtain each two-dimensional coordinate includes:
[0013] Perform modulo operation on each plaintext segment to obtain a sequence, and send the plaintext segment to the sequence to obtain adjacent coordinate points in the sequence;
[0014] Perform coordinate system projection processing on the three-dimensional coordinate system to obtain a two-dimensional coordinate system,
[0015] Use the GIS algorithm to process the two-dimensional coordinate system and the adjacent coordinate points in the sequence to obtain each two-dimensional coordinate.
[0016] Optionally, the if the number of characters is odd, then splice the ciphertext characters according to a preset odd ciphertext splicing method to obtain a ciphertext string, includes:
[0017] If the number of characters is odd, perform ASCII code conversion and base conversion operations on the plaintext string respectively to obtain a first base number and a second base number, add serial numbers to each of the ciphertext characters, and use the ciphertext characters with odd serial numbers as the first target ciphertext characters, and use the ciphertext characters with even serial numbers as the second target ciphertext characters;
[0018] Splice the ciphertext characters in the order of the first base number, the first target ciphertext characters, the second base number, and the second target ciphertext characters to obtain a ciphertext string.
[0019] Optionally, after determining the number of characters in the plaintext string, further includes:
[0020] If the number of characters is even, splice the ciphertext characters in the order of the first base number, the second target ciphertext characters, the second base number, and the first target ciphertext characters to obtain a ciphertext string.
[0021] Optionally, the splicing and compressing the key fragments to obtain a key, includes:
[0022] Determine the preset number of key fragment conversions, splice the key fragments, and then perform hexadecimal conversion and compression operations on the key fragments according to the number of key fragment conversions to obtain a key.
[0023] In a second aspect, the present application discloses another string processing method, which is applied to a receiving end and includes:
[0024] Obtain the ciphertext string and the key sent by the sending end, determine the number of ciphertext strings. If the number of ciphertext strings is odd, parse and split the ciphertext string according to the odd ciphertext splicing method to obtain each ciphertext character;
[0025] Parse and compress the key to obtain the key fragment, and perform coordinate point restoration operations on each ciphertext character and the key fragment to obtain each two-dimensional coordinate;
[0026] Determine each three-dimensional coordinate based on each two-dimensional coordinate, and parse each three-dimensional coordinate to obtain each plaintext segment, and then splice each plaintext segment to obtain the plaintext string.
[0027] In a third aspect, the present application discloses a string processing device, including:
[0028] A plaintext string acquisition module, configured to acquire a plaintext string, split the plaintext string and add indexes to obtain each plaintext segment;
[0029] A three-dimensional coordinate determination module, configured to perform encoding conversion on each plaintext segment to obtain each three-dimensional coordinate, determine each two-dimensional coordinate based on each three-dimensional coordinate, and then parse each two-dimensional coordinate to obtain a ciphertext character and a key fragment;
[0030] A ciphertext string determination module, configured to splice and compress the key fragment to obtain a key, determine the number of characters of the plaintext string. If the number of characters is odd, splice the ciphertext characters according to a preset odd ciphertext splicing method to obtain a ciphertext string, and send the ciphertext string and the key to the receiving end.
[0031] In a fourth aspect, the present application discloses an electronic device, including:
[0032] A memory, configured to store a computer program;
[0033] A processor, configured to execute the computer program to implement the foregoing string processing method.
[0034] In a fifth aspect, the present application discloses a computer storage medium, configured to store a computer program; wherein, when the computer program is executed by a processor, the steps of the foregoing disclosed string processing method are implemented.
[0035] It can be seen that the present application provides a string processing method, including obtaining a plaintext string, splitting the plaintext string and adding indexes to obtain each plaintext character segment; encoding and converting each plaintext character segment to obtain each three-dimensional coordinate, determining each two-dimensional coordinate based on each three-dimensional coordinate, and then parsing each two-dimensional coordinate to obtain ciphertext characters and key fragments; splicing and compressing the key fragments to obtain a key, determining the number of characters in the plaintext string, if the number of characters is an odd number, splicing the ciphertext characters according to a preset odd ciphertext splicing method to obtain a ciphertext string, and sending the ciphertext string and the key to a receiving end. The present application is based on the encoding process of Cartesian coordinate system and discrete geometry, GIS algorithm and ASCII code conversion and base conversion encoding process, GIS algorithm inverse operation and ASCII code conversion decoding process. In the http request process, the sender encodes the data to be transmitted using the method before the request, places the obtained ciphertext string and key in the request, and then initiates the request to the receiving end. After receiving the request, the receiving end needs to obtain the ciphertext key at the same time and decodes it through the method to obtain the data to be received. In this process, the data is no longer transmitted in plain text, and the possibility of leakage is significantly reduced. Even if the data is hijacked, the difficulty and cost of cracking the encrypted data will be greatly increased, thereby improving the security of string processing and reducing the occurrence of information leakage during string processing. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0037] Figure 1 A flow chart of a string processing method disclosed in this application;
[0038] Figure 2 A flow chart of the conversion of the American Information Interchange Standard code disclosed in this application;
[0039] Figure 3 This is an example diagram of a three-dimensional coordinate system disclosed in this application;
[0040] Figure 4 A flow chart for determining an independent sequence disclosed in this application;
[0041] Figure 5 This is an example diagram of a coordinate system projection disclosed in this application;
[0042] Figure 6A flowchart for determining two-dimensional coordinates disclosed in this application;
[0043] Figure 7 A diagram showing the relationship between sequences and coordinates disclosed in this application;
[0044] Figure 8 A flowchart for determining ciphertext characters disclosed in this application;
[0045] Figure 9 A flowchart for a string processing method disclosed in this application;
[0046] Figure 10 Another flowchart for a string processing method disclosed in this application;
[0047] Figure 11 A flowchart for string decoding and conversion disclosed in this application;
[0048] Figure 12 A specific flowchart for string encoding disclosed in this application;
[0049] Figure 13 A specific flowchart for string decoding disclosed in this application;
[0050] Figure 14 A schematic diagram of the structure of a string processing device disclosed in this application;
[0051] Figure 15 A structural diagram of an electronic device provided by this application. Detailed implementation manners
[0052] Next, in combination with the accompanying drawings in the embodiments of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
[0053] Currently, during the system interaction and communication process, there are often some sensitive data transmissions. At this time, the sender needs to encode the information before sending, and the receiver decodes the received information to obtain the required information. There are many encoding and decoding methods that can be selected in the whole process, but the commonly used encoding and decoding methods are well-known, and the cracking methods are very mature. Therefore, it is impossible to effectively protect the security of the information in data transmission. As can be seen from the above, how to improve the security of string processing and reduce the occurrence of information leakage during string processing is a problem to be solved in this field.
[0054] See Figure 1As shown in the figure, an embodiment of the present invention discloses a string processing method, which may specifically include:
[0055] Step S11: Obtain a plaintext string, split the plaintext string and add indexes to obtain each plaintext segment.
[0056] Step S12: Perform encoding conversion on each plaintext segment to obtain each three-dimensional coordinate, determine each two-dimensional coordinate based on each three-dimensional coordinate, and then parse each two-dimensional coordinate to obtain a ciphertext character and a key segment.
[0057] In this embodiment, perform ASCII encoding conversion on each plaintext segment to obtain each three-dimensional coordinate. Based on each three-dimensional coordinate, draw a three-dimensional coordinate system in a discrete distribution manner, perform coordinate system projection processing on the three-dimensional coordinate system to obtain each two-dimensional coordinate, and then parse each two-dimensional coordinate to obtain a ciphertext character and a key segment.
[0058] In this embodiment, the specific process is as Figure 2 shown. Obtain the plaintext string Plaintext, split the plaintext string and add indexes to obtain characters s0, s1, s2, s3, s4, s5... Perform ASCII code (American Standard Code for Information Interchange) conversion on the characters respectively to obtain an 8-bit binary number, then split the 8-bit binary number into two 4-bit binary numbers, and then perform number system conversion respectively to convert them into decimal numbers. Subsequently, combine the character index to obtain a three-dimensional coordinate P(x, y, z). Similarly, obtain three-dimensional coordinate points P0, P1, P2, P3, P4, P5... Then draw the coordinate points P0, P1, P2, P3, P4, P5... into the same coordinate system to obtain a three-dimensional coordinate system with discrete distribution of coordinate points, as Figure 3 shown.
[0059] The specific coordinate system projection processing process is as follows: Perform modulo operation on each plaintext segment to obtain a sequence, send the plaintext segment to the sequence to obtain adjacent coordinate points in the sequence; perform coordinate system projection processing on the three-dimensional coordinate system to obtain a two-dimensional coordinate system, and use the GIS algorithm to process the two-dimensional coordinate system and the adjacent coordinate points in the sequence to obtain each two-dimensional coordinate. For example, classify the character sequence s0, s1, s2, s3, s4, s5... according to the parity of the indexes to obtain two independent sequences, as Figure 4 shown, and then add the character s0 to the head of the sequence, and sequentially take two characters in the sequence to obtain the corresponding three-dimensional coordinate P, as Figure 5As shown in the figure, it is processed into a two-dimensional coordinate system (z-axis projection) through coordinate system projection. The GIS algorithm is used to obtain the relative coordinates (i.e., two-dimensional coordinates) Q(x, y) of the next coordinate with the previous coordinate as the origin. The specific process is as Figure 6 shown. By analogy, two-dimensional coordinates Q1, Q2, Q3, Q4, Q5... can be obtained. The two independent sequences are sequence 1 and sequence 2. The relationships among the sequences, character sequences, three-dimensional coordinates, and two-dimensional coordinates are as Figure 7 shown. Finally, through the operation and conversion of the two-dimensional coordinate points Q(x, y), ciphertext characters and key fragments can be obtained. The conversion steps are as Figure 8 shown.
[0060] Step S13: splice and compress the key fragments to obtain a key, determine the number of characters in the plaintext string. If the number of characters is odd, splice the ciphertext characters according to a preset odd ciphertext splicing method to obtain a ciphertext string, and send the ciphertext string and the key to the receiving end.
[0061] In this embodiment, determine the preset number of key fragment conversions, splice the key fragments, and then perform hexadecimal conversion and compression operations on the key fragments according to the number of key fragment conversions to obtain a key. Determine the number of characters in the plaintext string. If the number of characters is odd, splice the ciphertext characters according to a preset odd ciphertext splicing method to obtain a ciphertext string, and send the ciphertext string and the key to the receiving end.
[0062] In this embodiment, a plaintext string is obtained, and the plaintext string is split and indexed to obtain plaintext character segments; each plaintext character segment is encoded and converted to obtain three-dimensional coordinates, and each two-dimensional coordinate is determined based on the three-dimensional coordinates, and then each two-dimensional coordinate is parsed to obtain ciphertext characters and key fragments; the key fragments are spliced and compressed to obtain a key, and the number of characters in the plaintext string is determined. If the number of characters is an odd number, the ciphertext characters are spliced according to a preset odd-number ciphertext splicing method to obtain a ciphertext string, and the ciphertext string and the key are sent to a receiving end. The present application is based on the encoding process of Cartesian coordinate system and discrete geometry, the GIS algorithm and ASCII code conversion and the base conversion encoding process, the GIS algorithm inverse operation and the decoding process of ASCII code conversion. In the http request process, the sender encodes the data to be transmitted using the method before the request, places the obtained ciphertext string and key in the request, and then initiates the request to the receiving end. After receiving the request, the receiving end needs to obtain the ciphertext key at the same time and decodes it through the method to obtain the data to be received. In this process, the data is no longer transmitted in plain text, and the possibility of leakage is significantly reduced. Even if the data is hijacked, the difficulty and cost of cracking the encrypted data will be greatly increased, thereby improving the security of string processing and reducing the occurrence of information leakage during string processing.
[0063] See also Figure 9 As shown, the embodiment of the present invention discloses a string processing method, which may specifically include:
[0064] Step S21: Obtain a plaintext character string, split the plaintext character string and add indexes to obtain various plaintext character segments.
[0065] Step S22: performing encoding conversion on each of the plaintext character segments to obtain each three-dimensional coordinate, determining each two-dimensional coordinate based on each of the three-dimensional coordinates, and then parsing each of the two-dimensional coordinates to obtain the ciphertext characters and key fragments.
[0066] Step S23: concatenate and compress the key fragments to obtain a key, determine the number of characters in the plaintext string, and if the number of characters is an odd number, perform ASCII code conversion and base conversion operations on the plaintext string respectively to obtain a first base number and a binary number, add a serial number to each of the ciphertext characters, and use the ciphertext characters with odd serial numbers as the first target ciphertext characters, and use the ciphertext characters with even serial numbers as the second target ciphertext characters, and then concatenate the ciphertext characters in the order of the first base number, the first target ciphertext character, the binary number and the second target ciphertext character to obtain a ciphertext string, and send the ciphertext string and the key to the receiving end.
[0067] In this embodiment, after determining the number of characters in the plaintext string, the following steps are further included: If the number of characters is even, the ciphertext characters are concatenated in the order of the first base number, the second target ciphertext character, the second base number, and the first target ciphertext character to obtain a ciphertext string.
[0068] In this embodiment, after obtaining the ciphertext characters and the key fragments, through calculation, ciphertext characters t1, t2, t3, t4 and key fragments k1, k2, k3, k4 can be obtained. Then, the character s0 is subjected to ASCII code conversion to obtain an 8-bit binary number. Then, the 8-bit binary number is split into two 4-bit binary numbers, and then they are respectively subjected to base conversion to be converted into hexadecimal numbers h1 (i.e., the first base number) and h2 (i.e., the second base number). Then, it is judged according to the number of characters in the plaintext string Plaintext. If the number of characters is odd, the ciphertext concatenation method is: h1 + the ciphertext corresponding to sequence 1 (t1, t3, t5...)+ h2 + the ciphertext corresponding to sequence 2 (t2, t4, t6...); if the number of characters is even, the ciphertext concatenation method is: h1 + the ciphertext corresponding to sequence 2 (t2, t4, t6...)+ h2 + the ciphertext corresponding to sequence 1 (t1, t3, t5...). After concatenation according to the rules, the ciphertext Ciphertext can be obtained. Then, the key fragments k1, k2, k3, k4... are concatenated according to the index. Starting from the first digit, every four characters are regarded as a binary number and converted into a hexadecimal number to obtain the key Secretkey.
[0069] In this embodiment, a plaintext string is obtained, and the plaintext string is split and indexed to obtain each plaintext segment; each plaintext segment is encoded and converted to obtain each three-dimensional coordinate, each two-dimensional coordinate is determined based on each three-dimensional coordinate, and then each two-dimensional coordinate is parsed to obtain a ciphertext character and a key segment; the key segments are spliced and compressed to obtain a key, the number of characters in the plaintext string is determined, and if the number of characters is odd, the ciphertext characters are spliced according to a preset odd ciphertext splicing method to obtain a ciphertext string, and the ciphertext string and the key are sent to the receiving end. Based on the encoding process of the Cartesian coordinate system and discrete geometry, the GIS algorithm and ASCII code conversion, as well as the base conversion encoding process, and the decoding process of the inverse operation of the GIS algorithm and ASCII code conversion, during the http request process, the sending end encodes the data to be transmitted with this method before the request, places the obtained ciphertext string and key in the request, and then initiates the request to the receiving end. After receiving the request, the receiving end needs to obtain the ciphertext key simultaneously and decode it with this method to obtain the data it wants to receive. In this process, the data is no longer transmitted in plaintext, and the possibility of leakage is significantly reduced. Even if the data is hijacked, the difficulty and cost of cracking the encrypted data will also increase greatly, thereby improving the security of string processing and reducing the occurrence of information leakage during the string processing process.
[0070] See Figure 10 As shown, another string processing method is disclosed in an embodiment of the present invention, which may specifically include:
[0071] Step S31: Obtain the ciphertext string and the key sent by the sending end, determine the number of ciphertext strings, and if the number of ciphertext strings is odd, parse and split the ciphertext string according to the odd ciphertext splicing method to obtain each ciphertext character.
[0072] Step S32: Parse and compress the key to obtain the key segment, and perform a coordinate point restoration operation on each ciphertext character and the key segment to obtain each two-dimensional coordinate.
[0073] Step S33: Determine each three-dimensional coordinate based on each two-dimensional coordinate, and parse each three-dimensional coordinate to obtain each plaintext segment, and then splice each plaintext segment to obtain the plaintext string.
[0074] In this embodiment, the key Secretkey is converted from hexadecimal to binary, and then the judgment is started from the first digit, and each two digits correspond to a quadrant of the ciphertext two-dimensional coordinate. Then, after parsing with the ciphertext t1, t2, t3, t4, t5..., the two-dimensional coordinate Q (x, y) can be obtained. The parsing method is the reverse conversion of the encoding conversion. The encoding conversion method is as follows: Figure 11 As shown, h1 and h2 are converted from hexadecimal to decimal, with h1 converted to the x-axis, h2 converted to the y-axis, and the character sequence as the z-axis, to obtain a two-dimensional coordinate Q0 (x, y) and a three-dimensional coordinate P0 (x, y, z). The three-dimensional coordinate P1 (x, y, z) can be obtained by the three known conditions of the known coordinate Q0, the relative coordinate Q1, and the z-axis coordinate. Similarly, the coordinates P2, P3, P4, P5... can be obtained. The known three-dimensional coordinate points P0, P1, P2, P3, P4, P5... are drawn to the same coordinate system, and the coordinate points are parsed in order from small to large in the order of the Z axis. The parsing rule is: take out the x and y of the three-dimensional coordinate P (x, y, z), convert them into binary numbers respectively and splice them, and then compare them with the ASCII code to obtain the ASCII code character, that is, the plain text character. The plain text characters can be spliced in order to obtain the plain text, and the decoding is successful.
[0075] The sending end process of this application is as follows Figure 12 As shown, first, the sending end obtains the plaintext string, splits the plaintext string and adds indexes to obtain each plaintext character segment, then encodes and converts each plaintext character segment to obtain each three-dimensional coordinate, and then obtains a three-dimensional coordinate system, then performs modulo processing on each character to obtain two independent sequences, and determines each two-dimensional coordinate (x, y) through coordinate system projection processing and GIS algorithm, and then parses each of the two-dimensional coordinates to obtain ciphertext characters and key fragments, splices and compresses the key fragments to obtain the key, determines the number of characters in the plaintext string, if the number of characters is odd, splices the ciphertext characters according to the preset odd ciphertext splicing method to obtain the ciphertext string, if the number of characters is even, splices the ciphertext characters according to the preset even ciphertext splicing method to obtain the ciphertext string, and then sends the ciphertext string and the key to the receiving end. The receiving end process is as follows Figure 13As shown, the receiving end obtains the ciphertext string and the key sent by the sending end, and then determines the number of the ciphertext string. If the number of the ciphertext string is an odd number, the ciphertext string is parsed and split according to the odd ciphertext splicing method to obtain each ciphertext character; if the number of the ciphertext string is an even number, the ciphertext string is parsed and split according to the even ciphertext splicing method to obtain each ciphertext character, and then the key is parsed and compressed to obtain a key fragment, and a coordinate point restoration operation is performed on each ciphertext character and the key fragment to obtain each two-dimensional coordinate, and then each three-dimensional coordinate is determined based on each two-dimensional coordinate, and each three-dimensional coordinate is parsed to obtain each plaintext character segment, and then each plaintext character segment is spliced to obtain a plaintext string.
[0076] In this embodiment, a plaintext string is obtained, and the plaintext string is split and indexed to obtain plaintext character segments; each plaintext character segment is encoded and converted to obtain three-dimensional coordinates, and each two-dimensional coordinate is determined based on the three-dimensional coordinates, and then each two-dimensional coordinate is parsed to obtain ciphertext characters and key fragments; the key fragments are spliced and compressed to obtain a key, and the number of characters in the plaintext string is determined. If the number of characters is an odd number, the ciphertext characters are spliced according to a preset odd-number ciphertext splicing method to obtain a ciphertext string, and the ciphertext string and the key are sent to a receiving end. The present application is based on the encoding process of Cartesian coordinate system and discrete geometry, GIS algorithm and ASCII code conversion and base conversion encoding process, GIS algorithm inverse operation and ASCII code conversion decoding process. In the http request process, the sender encodes the data to be transmitted using the method before the request, places the obtained ciphertext string and key in the request, and then initiates the request to the receiving end. After receiving the request, the receiving end needs to obtain the ciphertext key at the same time and decodes it through the method to obtain the data to be received. In this process, the data is no longer transmitted in plain text, and the possibility of leakage is significantly reduced. Even if the data is hijacked, the difficulty and cost of cracking the encrypted data will be greatly increased, thereby improving the security of string processing and reducing the occurrence of information leakage during string processing.
[0077] See also Figure 14 As shown, the embodiment of the present invention discloses a string processing device, which may specifically include:
[0078] A plaintext character string acquisition module 11 is used to acquire a plaintext character string, split the plaintext character string and add an index to obtain each plaintext character segment;
[0079] A three-dimensional coordinate determination module 12, configured to perform encoding conversion on each of the plain text character segments to obtain each three-dimensional coordinate, determine each two-dimensional coordinate based on each of the three-dimensional coordinates, and then parse each of the two-dimensional coordinates to obtain a cipher text character and a key fragment;
[0080] The ciphertext string determination module 13 is used to concatenate and compress the key fragments to obtain the key, determine the number of characters in the plaintext string, and if the number of characters is an odd number, concatenate the ciphertext characters according to a preset odd-number ciphertext concatenation method to obtain a ciphertext string, and send the ciphertext string and the key to the receiving end.
[0081] In this embodiment, a plaintext string is obtained, and the plaintext string is split and indexed to obtain plaintext character segments; each plaintext character segment is encoded and converted to obtain three-dimensional coordinates, and each two-dimensional coordinate is determined based on the three-dimensional coordinates, and then each two-dimensional coordinate is parsed to obtain ciphertext characters and key fragments; the key fragments are spliced and compressed to obtain a key, and the number of characters in the plaintext string is determined. If the number of characters is an odd number, the ciphertext characters are spliced according to a preset odd-number ciphertext splicing method to obtain a ciphertext string, and the ciphertext string and the key are sent to a receiving end. The present application is based on the encoding process of Cartesian coordinate system and discrete geometry, GIS algorithm and ASCII code conversion and base conversion encoding process, GIS algorithm inverse operation and ASCII code conversion decoding process. In the http request process, the sender encodes the data to be transmitted using the method before the request, places the obtained ciphertext string and key in the request, and then initiates the request to the receiving end. After receiving the request, the receiving end needs to obtain the ciphertext key at the same time and decodes it through the method to obtain the data to be received. In this process, the data is no longer transmitted in plain text, and the possibility of leakage is significantly reduced. Even if the data is hijacked, the difficulty and cost of cracking the encrypted data will be greatly increased, thereby improving the security of string processing and reducing the occurrence of information leakage during string processing.
[0082] In some specific embodiments, the three-dimensional coordinate determination module 12 may specifically include:
[0083] A three-dimensional coordinate determination module, used for performing ASCII encoding conversion on each of the plain text character segments to obtain each three-dimensional coordinate;
[0084] The two-dimensional coordinate determination module is used to draw a three-dimensional coordinate system based on each of the three-dimensional coordinates in a discrete distribution manner, and perform coordinate system projection processing on the three-dimensional coordinate system to obtain each two-dimensional coordinate.
[0085] In some specific embodiments, the three-dimensional coordinate determination module 12 may specifically include:
[0086] A modulo processing module, used for performing modulo processing on each plaintext character segment to obtain a sequence, and sending the plaintext character segment to the sequence to obtain adjacent coordinate points in the sequence;
[0087] A two-dimensional coordinate system determination module, configured to perform coordinate system projection processing on the three-dimensional coordinate system to obtain a two-dimensional coordinate system.
[0088] A GIS algorithm processing module, configured to use a GIS algorithm to process the two-dimensional coordinate system and adjacent coordinate points in the sequence to obtain each two-dimensional coordinate.
[0089] In some specific embodiments, the ciphertext string determination module 13 may specifically include:
[0090] A base number determination module, configured to, if the number of characters is odd, perform ASCII code conversion and base conversion operations on the plaintext string respectively to obtain a first base number and a second base number, add serial numbers to each ciphertext character, and use the ciphertext characters with odd serial numbers as the first target ciphertext characters and the ciphertext characters with even serial numbers as the second target ciphertext characters.
[0091] A first ciphertext string determination module, configured to splice the ciphertext characters in the order of the first base number, the first target ciphertext characters, the second base number, and the second target ciphertext characters to obtain a ciphertext string.
[0092] In some specific embodiments, the ciphertext string determination module 13 may specifically include:
[0093] A second ciphertext string determination module, configured to, if the number of characters is even, splice the ciphertext characters in the order of the first base number, the second target ciphertext characters, the second base number, and the first target ciphertext characters to obtain a ciphertext string.
[0094] In some specific embodiments, the ciphertext string determination module 13 may specifically include:
[0095] A key determination module, configured to determine a preset number of key segment conversions, splice the key segments, and then perform hexadecimal conversion and compression operations on the key segments according to the number of key segment conversions to obtain a key.
[0096] Figure 15 It is a schematic structural diagram of an electronic device provided by an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. Among them, the memory 22 is used to store a computer program, and the computer program is loaded and executed by the processor 21 to implement the relevant steps in the string processing method executed by the electronic device disclosed in any of the foregoing embodiments.
[0097] In this embodiment, the power supply 23 is used to provide operating voltages for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this application, and specific limitations are not imposed here; the input / output interface 25 is used to obtain external input data or output data to the outside, and its specific interface type can be selected according to specific application requirements, and specific limitations are not imposed here.
[0098] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, a random access memory, a magnetic disk, an optical disk, etc. The resources stored thereon include an operating system 221, a computer program 222, data 223, etc., and the storage method can be transient storage or permanent storage.
[0099] Among them, the operating system 221 is used to manage and control each hardware device on the electronic device 20 and the computer program 222 to enable the processor 21 to perform operations and processing on the data 223 in the memory 22, and it can be Windows, Unix, Linux, etc. In addition to the computer program that can be used to complete the string processing method executed by the electronic device 20 disclosed in any of the foregoing embodiments, the computer program 222 can further include computer programs that can be used to complete other specific tasks. In addition to the data transmitted by external devices received by the string processing device, the data 223 can also include data collected by its own input / output interface 25, etc.
[0100] The steps of the method or algorithm described in combination with the embodiments disclosed in this article can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be placed in a random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, register, hard disk, removable disk, CD-ROM, or any other form of storage medium well-known in the technical field.
[0101] Furthermore, the embodiments of this application also disclose a computer-readable storage medium, in which a computer program is stored. When the computer program is loaded and executed by a processor, the steps of the string processing method disclosed in any of the foregoing embodiments are implemented.
[0102] Finally, it should also be noted that in this text, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements not only includes those elements, but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, article or device comprising the said element.
[0103] The above has introduced in detail a string processing method, apparatus, device and storage medium provided by the present invention. Specific examples are used in this text to elaborate on the principle and implementation manner of the present invention. The description of the above embodiments is only used to help understand the method and its core idea of the present invention; at the same time, for those of ordinary skill in the art, according to the idea of the present invention, there will be changes in the specific implementation manner and application scope. In summary, the content of this specification should not be construed as a limitation to the present invention.
Claims
1. A string processing method, characterized in that, applied to the sending end, it includes: Obtain the plaintext string, split and add indexes to the plaintext string to obtain each plaintext segment; Perform encoding conversion on each plaintext segment to obtain each three-dimensional coordinate, determine each two-dimensional coordinate based on each three-dimensional coordinate, and then parse each two-dimensional coordinate to obtain ciphertext characters and key fragments; Concatenate and compress the key fragments to obtain a key, determine the number of characters in the plaintext string. If the number of characters is odd, concatenate the ciphertext characters according to a preset odd ciphertext concatenation method to obtain a ciphertext string, and send the ciphertext string and the key to the receiving end; wherein, the step of if the number of characters is odd, concatenate the ciphertext characters according to a preset odd ciphertext concatenation method to obtain a ciphertext string includes: if the number of characters is odd, perform ASCII code conversion and base conversion operations on the plaintext string respectively to obtain a first base number and a second base number, add serial numbers to each ciphertext character, and use the ciphertext characters with odd serial numbers as the first target ciphertext characters and the ciphertext characters with even serial numbers as the second target ciphertext characters; concatenate the ciphertext characters in the order of the first base number, the first target ciphertext characters, the second base number, and the second target ciphertext characters to obtain a ciphertext string; After determining the number of characters in the plaintext string, it further includes: if the number of characters is even, concatenate the ciphertext characters in the order of the first base number, the second target ciphertext characters, the second base number, and the first target ciphertext characters to obtain a ciphertext string.
2. The string processing method according to claim 1, characterized in that, the step of performing encoding conversion on each plaintext segment to obtain each three-dimensional coordinate and determining each two-dimensional coordinate based on each three-dimensional coordinate includes: Perform ASCII encoding conversion on each plaintext segment to obtain each three-dimensional coordinate; Draw a three-dimensional coordinate system based on each three-dimensional coordinate in a discrete distribution manner, and perform coordinate system projection processing on the three-dimensional coordinate system to obtain each two-dimensional coordinate.
3. The string processing method according to claim 2, characterized in that, the step of performing coordinate system projection processing on the three-dimensional coordinate system to obtain each two-dimensional coordinate includes: Perform modulo operation on each plaintext segment to obtain a sequence, and send the plaintext segment to the sequence to obtain adjacent coordinate points in the sequence; Perform coordinate system projection processing on the three-dimensional coordinate system to obtain a two-dimensional coordinate system, Use the GIS algorithm to process the two-dimensional coordinate system and the adjacent coordinate points in the sequence to obtain each two-dimensional coordinate.
4. The string processing method according to any one of claims 1 to 3, characterized in that, the step of concatenating and compressing the key fragments to obtain a key includes: Determine the preset number of key fragment conversions, splice the key fragments, and then perform hexadecimal conversion and compression operations on the key fragments according to the number of key fragment conversions to obtain the key.
5. A string processing method characterized in that applied to the receiving end, including: Obtain the ciphertext string and the key sent by the sending end, determine the number of ciphertext strings. If the number of ciphertext strings is odd, parse and split the ciphertext string according to the odd ciphertext splicing method to obtain each ciphertext character; Parse and compress the key to obtain key fragments, and perform coordinate point restoration operations on each ciphertext character and the key fragments to obtain each two-dimensional coordinate; Determine each three-dimensional coordinate based on each two-dimensional coordinate, and parse each three-dimensional coordinate to obtain each plaintext segment, and then splice each plaintext segment to obtain the plaintext string; Among them, the obtaining of the ciphertext string and the key sent by the sending end includes: obtaining the ciphertext string obtained by the sending end by splicing ciphertext characters according to the preset odd ciphertext splicing method, and the key obtained by splicing and compressing key fragments; The process of the sending end splicing ciphertext characters according to the preset odd ciphertext splicing method to obtain the ciphertext string is: determine the number of characters in the plaintext string. If the number of characters is odd, perform ASCII code conversion and base conversion operations on the plaintext string to obtain the first base number and the second base number, add serial numbers to each ciphertext character, and use the ciphertext characters with odd serial numbers as the first target ciphertext characters, and the ciphertext characters with even serial numbers as the second target ciphertext characters; splice the ciphertext characters in the order of the first base number, the first target ciphertext character, the second base number, and the second target ciphertext character to obtain the ciphertext string; After determining the number of characters in the plaintext string, it further includes: if the number of characters is even, splice the ciphertext characters in the order of the first base number, the second target ciphertext character, the second base number, and the first target ciphertext character to obtain the ciphertext string.
6. A string processing device characterized in that including: A plaintext string acquisition module for acquiring a plaintext string, splitting and adding indexes to the plaintext string to obtain each plaintext segment; A three-dimensional coordinate determination module for performing encoding conversion on each plaintext segment to obtain each three-dimensional coordinate, determining each two-dimensional coordinate based on each three-dimensional coordinate, and then parsing each two-dimensional coordinate to obtain ciphertext characters and key fragments; A ciphertext string determination module for splicing and compressing the key fragments to obtain a key, determining the number of characters in the plaintext string. If the number of characters is odd, splice the ciphertext characters according to the preset odd ciphertext splicing method to obtain the ciphertext string, and send the ciphertext string and the key to the receiving end; Among them, if the number of characters is odd, the ciphertext characters are spliced according to a preset odd ciphertext splicing method to obtain a ciphertext string, including: if the number of characters is odd, the plaintext string is respectively subjected to ASCII code conversion and base conversion operations to obtain a first base number and a second base number, serial numbers are added to each of the ciphertext characters, the ciphertext characters with odd serial numbers are used as first target ciphertext characters, and the ciphertext characters with even serial numbers are used as second target ciphertext characters; the ciphertext characters are spliced in the order of the first base number, the first target ciphertext characters, the second base number, and the second target ciphertext characters to obtain a ciphertext string; After determining the number of characters in the plaintext string, it further includes: if the number of characters is even, the ciphertext characters are spliced in the order of the first base number, the second target ciphertext characters, the second base number, and the first target ciphertext characters to obtain a ciphertext string.
7. An electronic device, characterized in that, comprising: a memory for storing a computer program; a processor for executing the computer program to implement the string processing method according to any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, for storing a computer program; wherein, when the computer program is executed by a processor, the string processing method according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Chinese character password encoding method based on image pixel coordinates
CN104468090A
Encryption method and device, electronic equipment and readable storage medium
CN112347498A