CN117009987A - Method and device for processing digital character strings, storage medium and electronic equipment - Google Patents

Method and device for processing digital character strings, storage medium and electronic equipment Download PDF

Info

Publication number
CN117009987A
CN117009987A CN202310671534.6A CN202310671534A CN117009987A CN 117009987 A CN117009987 A CN 117009987A CN 202310671534 A CN202310671534 A CN 202310671534A CN 117009987 A CN117009987 A CN 117009987A
Authority
CN
China
Prior art keywords
character string
string
digital
encoding
check code
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310671534.6A
Other languages
Chinese (zh)
Inventor
黄进兵
吕勇
肇志伟
舒威
刘金良
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
BEIJING CERTIFICATE AUTHORITY
Original Assignee
BEIJING CERTIFICATE AUTHORITY
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by BEIJING CERTIFICATE AUTHORITY filed Critical BEIJING CERTIFICATE AUTHORITY
Priority to CN202310671534.6A priority Critical patent/CN117009987A/en
Publication of CN117009987A publication Critical patent/CN117009987A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules
    • G06F21/6218Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database
    • G06F21/6245Protecting personal data, e.g. for financial or medical purposes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/64Protecting data integrity, e.g. using checksums, certificates or signatures

Abstract

Some embodiments of the present application provide a method, an apparatus, a storage medium, and an electronic device for processing a digital character string, where the method includes: acquiring a check code of a first character string, and adding the check code to the first character string to acquire a second character string, wherein the first character string is in the form of digital bytes; performing format conversion on the second character string to obtain a third character string; and encrypting and encoding the third character string to obtain a character string processing result. The method and the device can realize the encryption encoding processing of the digital character string, ensure the safety of the digital character string and reduce the occupied space of the final ciphertext.

Description

Method and device for processing digital character strings, storage medium and electronic equipment
Technical Field
The present application relates to the field of character string security technologies, and in particular, to a method, an apparatus, a storage medium, and an electronic device for processing a digital character string.
Background
With the rapid development of internet technology, security of data information is particularly important.
Data such as account information, certificate information, order information and mobile phone number information related to a user are particularly important in daily life, so that in order to ensure privacy of the user, the data is generally stored or transmitted in an encrypted mode. At present, when encrypting related digital data of a user, a digital character string is generally used as a common character string to be encrypted to obtain ciphertext. However, the related problem caused by the above method is that the length of the ciphertext is long, and the occupied space is large.
Therefore, how to provide a method for processing digital character strings with safety and less space occupation is a technical problem to be solved.
Disclosure of Invention
The application aims to provide a method, a device, a storage medium and electronic equipment for processing digital character strings.
In a first aspect, some embodiments of the present application provide a method of processing a digital string, comprising: acquiring a check code of a first character string, and adding the check code to the first character string to acquire a second character string, wherein the first character string is in the form of digital bytes; performing format conversion on the second character string to obtain a third character string; and encrypting and encoding the third character string to obtain a character string processing result.
Some embodiments of the present application combine the first string and the check code to obtain a second string, then convert the second string to obtain a third string, and finally encrypt and encode the third string to obtain a string processing result. According to some embodiments of the application, the character string safety is ensured, the length of the character string processing result is reduced, the occupied space is reduced, and the resource is saved.
In some embodiments, before the obtaining the check code of the first string, the method further includes: when the original character string is confirmed to be a digital character string, converting the original character string into digital bytes to obtain the first character string; and when the original character string is confirmed to be a non-numeric character string, converting the non-numeric character in the original character string into a number according to a non-numeric coding mapping table to obtain the first character string.
According to the method and the device, the original character string is confirmed whether to be a digital character string or not, and the first character string is obtained through confirmation, so that the original character string can be effectively processed.
In some embodiments, the obtaining the check code of the first string and adding the check code to the first string, obtaining the second string, includes: and calculating the Luhn check code of the first character string by utilizing a Luhn algorithm, and adding the Luhn check code to the tail part of the first character string to obtain the second character string.
According to some embodiments of the application, the Luhn check code can be obtained through a Luhn algorithm, so that the second character string is obtained, and quick and safe check of the character string can be realized.
In some embodiments, the performing format conversion on the second string to obtain a third string includes: and converting the second character string from a digital type to an integer type to obtain the third character string.
Some embodiments of the application obtain the third character string by performing type conversion on the second character string, thereby shortening the length of the third character string and reducing the occupied space.
In some embodiments, encrypting and encoding the third string to obtain a string processing result includes: encrypting the third character string by using a target encryption algorithm to obtain initial encrypted data; generating a random vector, and adding the random vector to the head of the initial encrypted data to obtain an encryption result to be encoded; and encoding the encryption result to be encoded to obtain the character string processing result.
According to some embodiments of the application, the character string processing result is obtained by combining the random vector and the initial encrypted data and then encoding, so that the data security is improved.
In some embodiments, encrypting and encoding the third string to obtain a string processing result includes: encrypting the third character string by using a target encryption algorithm to obtain initial encrypted data; and encoding the initial encrypted data by using a target encoding mode to obtain the character string processing result.
Some embodiments of the present application implement secure processing of data by encrypting and encoding the third string using a related algorithm.
In a second aspect, some embodiments of the present application provide an apparatus for processing a digital string, including: the verification module is configured to acquire a verification code of a first character string, and add the verification code to the first character string to acquire a second character string, wherein the first character string is in the form of digital bytes; the conversion module is configured to perform format conversion on the second character string to obtain a third character string; and the encryption and coding module is configured to encrypt and code the third character string to obtain a character string processing result.
In a third aspect, some embodiments of the application provide a computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs a method according to any of the embodiments of the first aspect.
In a fourth aspect, some embodiments of the application provide an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor is operable to implement a method according to any of the embodiments of the first aspect when executing the program.
In a fifth aspect, some embodiments of the application provide a computer program product comprising a computer program, wherein the computer program, when executed by a processor, is adapted to carry out the method according to any of the embodiments of the first aspect.
Drawings
In order to more clearly illustrate the technical solutions of some embodiments of the present application, the drawings that are required to be used in some embodiments of the present application will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and should not be construed as limiting the scope, and other related drawings may be obtained according to these drawings without inventive effort to those of ordinary skill in the art.
FIG. 1 is a system diagram of processing a digital string according to some embodiments of the present application;
FIG. 2 is a flowchart of a method for processing a digital string according to some embodiments of the present application;
FIG. 3 is a second flowchart of a method for processing a digital string according to some embodiments of the present application;
FIG. 4 is a block diagram of an apparatus for processing digital strings according to some embodiments of the present application;
fig. 5 is a schematic diagram of an electronic device according to some embodiments of the present application.
Detailed Description
The technical solutions of some embodiments of the present application will be described below with reference to the drawings in some embodiments of the present application.
It should be noted that: like reference numerals and letters denote like items in the following figures, and thus once an item is defined in one figure, no further definition or explanation thereof is necessary in the following figures. Meanwhile, in the description of the present application, the terms "first", "second", and the like are used only to distinguish the description, and are not to be construed as indicating or implying relative importance.
In order to facilitate understanding of the embodiments of the present application, terms appearing below are explained:
GCM, galois/Counter Mode, is an operation Mode of symmetric key encryption block ciphers, which is widely used for its performance.
SM4 is a commercial cryptographic standard, the precursor of which is the SMs4 algorithm. The SM4 algorithm is a packet encryption algorithm, with both packet length and key length being 128 bits.
CBC: cipher block chaining, cipher-block chaining.
Base64: base64 is one of the most common encoding schemes used to transmit 8Bit bytecodes on a network, and is a method for representing binary data based on 64 printable characters.
PKCS7PADDING: one pattern used to populate data when encrypting data.
In the related art, the pure digital character string currently stored in the relational database or the non-relational database usually belongs to a sensitive field (such as order number, identification card number, mobile phone number, bank card number, rechargeable card number, etc.). In information protection, it is common practice to directly encrypt and encode a pure digital character string as a normal character string. For example, after an 18-byte-length identification card number 341068193906144607 (the identification card number is a virtual identification card number) is encrypted and encoded by using common SM4 and CBC, defaultPadding, BASE, the formed ciphertext without random number is EaiXG1nungwJYs7g+1cs9U 4/gldiliseolcttuqopjq=, and the byte length thereof is directly changed to 32 bytes. If SM4, GCM, PKCS7PADDING, BASE64 are used for encryption and encoding, 48 bytes of ciphertext in the form of xUGQqCfaGej10DZ8 PfwxmwqVsqDR+6Ouoxdqsap75 jVdrXKyqX32U/D0G1/v3cQ will be generated.
As known from the related art, after the pure digital character string is used as a common character string to perform encryption encoding, two problems are caused, namely, the ciphertext is obviously lengthened to multiply the occupied space, and the length of an encryption field is also required to be amplified when the security upgrade is performed, so that the upgrade complexity is increased.
In view of this, some embodiments of the present application provide a method of processing a numeric string by identifying an original string as a first string that is possible after the numeric string is identified. By adding the check code to the first character string to obtain the second character string, quick check of the character string can be realized. By converting the second string into the third string, the byte length of the string can be reduced. And finally, carrying out encryption encoding on the third character string to obtain a character string processing result, so that the safety processing of the character string can be realized. According to some embodiments of the application, the length of the final character string processing result is shortened while the character string security processing is ensured, the occupied space is reduced, and the complexity of subsequent upgrading is reduced.
The overall composition of a system for processing digital strings according to some embodiments of the present application is described below by way of example with reference to fig. 1.
As shown in fig. 1, some embodiments of the present application provide a system for processing a digital character string, the system for processing a digital character string including: a terminal 100 and a server 200. The terminal 100 may send the original string to the server 200. The server 200 may determine whether the original string is a pure digital string, and then obtain the first string. The server 200 may add a check code to the first string to obtain a second string, then perform format conversion on the second string to obtain a third string, and finally perform encryption encoding on the third string to obtain a ciphertext (as a specific example of a string processing result).
In some embodiments of the present application, the terminal 100 may be a mobile terminal or a non-portable computer terminal, and embodiments of the present application are not limited herein. In other embodiments of the present application, if the terminal 100 has all the functions of the server 200, the server 200 may not be set.
The implementation of processing digital strings performed by the server 200 according to some embodiments of the present application is described below by way of example with reference to fig. 2.
Referring to fig. 2, fig. 2 is a flowchart of a method for processing a digital character string according to some embodiments of the present application, where the method for processing a digital character string includes:
in some embodiments of the present application, before performing S210, a method of processing a digital string may include: when the original character string is confirmed to be a digital character string, converting the original character string into digital bytes to obtain the first character string; and when the original character string is confirmed to be a non-numeric character string, converting the non-numeric character in the original character string into a number according to a non-numeric coding mapping table to obtain the first character string.
For example, in some embodiments of the present application, the original string may be an order number, an identification card number, a cell phone number, a bank card number, a rechargeable card number, or the like. Wherein the end of the identification card number may be a number or a letter. Taking the identification card number as an original character string as an example, if there is no letter (such as the virtual identification card number 341068193906144607) in the identification card number, the identification card number is a pure digital character string, and a variable type conversion method is used to convert the pure digital character string into digital bytes at this time, for example, the identification card number 341068193906144607 is a character string of 18 bytes (as a specific example of the first character string). If there are letters (such as the virtual identification number 32888519710627989X) in the identification number, it is a non-digital character string, and the letters need to be converted at this time to obtain a pure digital character string. For example, if the number corresponding to X in the non-numeric code mapping table is 10, then X in 32888519710627989X is mapped to 10, resulting in 3288851971062798910, which is a string of 19 bytes (as a specific example of the first string).
It should be noted that, in practical application, a reasonable non-digital coding mapping table can be constructed for different scenes. The embodiments of the present application are not particularly limited herein.
S210, acquiring a check code of a first character string, and adding the check code to the first character string to acquire a second character string, wherein the first character string is in the form of digital bytes.
For example, in some embodiments of the present application, the first string is calculated to obtain the check value. And combining the check code with the first character string to obtain a second character string.
In some embodiments of the present application, S210 may include: and calculating the Luhn check code of the first character string by utilizing a Luhn algorithm, and adding the Luhn check code to the tail part of the first character string to obtain the second character string.
For example, in some embodiments of the present application, the Luhn check code (Luhn check code ranging from 0 to 9) of a digital string (e.g., 3288851971062798910) is calculated to result in 4, which is added to the end of 3288851971062798910 to result in 32888519710627989104, which is 20 byte characters in length.
S220, performing format conversion on the second character string to obtain a third character string.
In some embodiments of the present application, the second string is converted from a digital type to an integer type to obtain the third string.
For example, in some embodiments of the present application, the above-described numeric string 32888519710627989104 is converted into an integer-type number, and the converted byte length is 9 (the maximum number that 9 bytes can represent is 2ζ2= 4,722,366,482,869,645,312,000). It should be noted that, in the computer, one byte may represent one character, that is, characters 0 to 9 if it is digital, but one byte may represent an integer, and the range may be 0 to 256. After the character string '32888519710627989104' represented by 19 bytes is converted from the character string type to the integer type, the character string can be represented by only taking up to 9 bytes.
S230, encrypting and encoding the third character string to obtain a character string processing result.
The implementation procedure of S230 is exemplarily set forth below.
In some embodiments of the present application, S230 may include: encrypting the third character string by using a target encryption algorithm to obtain initial encrypted data; generating a random vector, and adding the random vector to the head of the initial encrypted data to obtain an encryption result to be encoded; and encoding the encryption result to be encoded to obtain the character string processing result.
For example, in some embodiments of the present application, the random vector may be a random IV, which refers to the initial vector in a block encryption algorithm, and according to the best encryption practice, one random IV is generated each time data is encrypted, so that even if the same original data is used, the resulting encrypted data are different from each other because different random IVs are used, and encryption confidentiality is greatly improved.
Specifically, a random IV may be generated, encrypted using the SM4/CTR mode, the byte length of the encrypted content is still 9, and a random IV of a specified size is added to the encryption result (as a specific example of the initial encryption result) from the header, to obtain the encryption result to be encoded. Finally, the encryption result to be coded is coded by using BASE64 coding, and the length of the coded character string is 12, such as Pnfxg8i9y7wD. If BASE91 encoding is used, then j% (} "yF & S > B, string length is 11.
It should be appreciated that although SM4 is a block encryption algorithm, it is characterized in that only blocks of a fixed size (e.g., 128 bits) can be encrypted at a time, the CTR (counter) mode of the algorithm actually converts the "block cipher algorithm" into the "stream cipher algorithm", and as a result, the encryption result length can be kept consistent with the plaintext length without requiring the length of the plaintext for Ji Yuanshi. In addition, in addition to encryption using SM4/CTR mode, AES/CTR mode may be employed, or CTR mode of other block encryption algorithms (e.g., RC5, threeformat, 3DES, etc.), or stream encryption algorithms, etc. The embodiments of the present application are not limited thereto.
In other embodiments of the present application, S230 may include: encrypting the third character string by using a target encryption algorithm to obtain initial encrypted data; and encoding the initial encrypted data by using a target encoding mode to obtain the character string processing result.
For example, in other embodiments of the present application, in certain specific scenarios (e.g., identification numbers), it may not be appropriate to use the random IV described above, and at this time, it may be possible to use a certain IV fixedly (by programming a specific value or by configuration to specify a specific value), or it may take the form of a "non-random IV".
Specifically, a non-random IV of a configuration-specified size is generated, encrypted using SM4/CTR mode (as one specific example of a target encryption algorithm), and the byte length of the encrypted content remains 9. It should be noted that the non-random IV may be set according to the practical application, such as a specific value. Or IV (greater than or equal to 0 and less than or equal to the packet length) of a specified random length. The embodiments of the present application are not particularly limited herein. Finally, the encryption result is encoded by using BASE64 encoding or BASE91 encoding (as a specific example of a target encoding mode), so as to obtain the ciphertext.
It should be noted that whether to use the random IV or the non-random IV may be selected according to the actual application scenario. Where the non-random IV is of a specific context (e.g., adapted for equal retrieval), such as when the database column is encrypted, the random IV cannot be used to support equal/unequal retrieval, at which time a fixed IV value is set by the program or configuration parameters. For example, currently one ten thousand identification card numbers are encrypted, and currently one specific identification card number needs to be searched for whether the specific identification card number is within one ten thousand identification card numbers, and at this time, a non-random IV needs to be used. This is because the same plaintext, if a random IV is used, results in a different final cryptographically encoded ciphertext.
As can be seen from the above embodiment, the original 18-bit id 32888519710627989X is compressed and encrypted into 12 bits, for example: dgY6A3i6wBM =; or 11 bits, e.g., j% (} "yF & S > B), while also providing the functionality of a quick check of the Luhn check code.
Based on the manner of encrypting and encoding the pure digital character string provided above, the steps of decrypting the same are exemplarily described with DgY A3i6wBM =or j% (} "yF & S > B:
first, decoding the decrypted content (i.e., dgY A3i6wBM =or j% (} "yF & S > B) using BASE64 or BASE91 to obtain a decoded string;
second, the decoded string is decrypted using SM4/CTR mode (note that the same key and IV value is used for interception and calculation), resulting in a decrypted result.
Thirdly, analyzing the decryption result of the second step in an integer number form (namely an integer type), and converting the integer number into a common character string form;
and fourthly, intercepting the last Luhn check number (namely the Luhn check code) in the form of the common character string, simultaneously regenerating the Luhn check number for the rest intercepted character strings, checking whether the check numbers are the same, if so, indicating that the decryption is successful, otherwise, failing.
Fifth, post-processing, such as if the identity card is decrypted and the plaintext is 19 bits 3288851971062798910, then the last two bits 10 are replaced by X according to the non-digital code mapping table.
The following is an exemplary description of a specific process for processing a digital string provided by some embodiments of the present application in conjunction with fig. 3.
Referring to fig. 3, fig. 3 is a flowchart illustrating a digital string processing method according to some embodiments of the present application.
The above process is exemplified below by a non-purely numeric string, a non-random IV.
S310, converting the non-numeric characters in the original character string into numbers according to the non-numeric coding mapping table to obtain the first character string.
S320, calculating the Luhn check code of the first character string, and adding the Luhn check code to the tail part of the first character string to obtain a second character string.
S330, converting the second character string into an integer digital form to obtain a third character string.
S340, generating a non-random IV with a configuration specified size, and encrypting by using an SM4/CTR mode to obtain an encryption result.
S350, encoding the encryption result to obtain the ciphertext.
As a specific example of the application, for example, the identification card number 341068199906144607 is a character string of 18 bytes, a Luhn check number is added at the end to become a character string of 19 bytes, the character string is converted into an integer digital type of 8 bytes by using variable type conversion, then encryption is performed by using a CTR mode of SM4, the length after encryption is still 8 bytes, then base64/base91 coding is used, and the length of the coded character string is 12/10 bytes. The ciphertext length is effectively reduced, and the occupied space is reduced.
It should be noted that, the specific implementation procedures of S310 to S350 may refer to the method embodiments provided above, and detailed descriptions are omitted here as appropriate to avoid repetition.
According to the scheme provided by the embodiments of the application, after the encryption coding is performed on the pure digital character string (the character string only comprises characters 0-9 or a small number of non-digital character strings such as letters in the last bit of an identity card) by the method provided by the embodiments, the basic function of encryption storage can be finished, the storage space can be effectively compressed, and the basic digital verification function (preventing ciphertext from being damaged) is provided.
Referring to fig. 4, fig. 4 is a block diagram illustrating an apparatus for processing a digital character string according to some embodiments of the application. It should be understood that the apparatus for processing a digital character string corresponds to the above method embodiment, and is capable of performing the steps involved in the above method embodiment, and specific functions of the apparatus for processing a digital character string may be referred to the above description, and detailed descriptions thereof are omitted herein as appropriate to avoid redundancy.
The apparatus for processing digital character strings of fig. 4 includes at least one software functional module which can be stored in a memory in the form of software or firmware or solidified in the apparatus for processing digital character strings, the apparatus for processing digital character strings comprising: a verification module 410 configured to obtain a verification code of a first character string, and add the verification code to the first character string to obtain a second character string, wherein the first character string is in the form of a digital byte; the conversion module 420 is configured to perform format conversion on the second character string to obtain a third character string; and the encryption and coding module 430 is configured to encrypt and code the third string to obtain a string processing result.
In some embodiments of the present application, the verification module 410 is configured to, when it is confirmed that the original string is a digital string, convert the original string into digital bytes to obtain the first string; and when the original character string is confirmed to be a non-numeric character string, converting the non-numeric character in the original character string into a number according to a non-numeric coding mapping table to obtain the first character string.
In some embodiments of the present application, the verification module 410 is configured to calculate a Luhn verification code of the first string using a Luhn algorithm, and add the Luhn verification code to the tail of the first string to obtain the second string.
In some embodiments of the present application, the conversion module 420 is configured to convert the second string from a digital type to an integer type, resulting in the third string.
In some embodiments of the present application, the encryption encoding module 430 is configured to encrypt the third string using a target encryption algorithm to obtain initial encrypted data; generating a random vector, and adding the random vector to the head of the initial encrypted data to obtain an encryption result to be encoded; and encoding the encryption result to be encoded to obtain the character string processing result.
In some embodiments of the present application, the encryption encoding module 430 is configured to encrypt the third string using a target encryption algorithm to obtain initial encrypted data; and encoding the initial encrypted data by using a target encoding mode to obtain the character string processing result.
It will be clear to those skilled in the art that, for convenience and brevity of description, reference may be made to the corresponding procedure in the foregoing method for the specific working procedure of the apparatus described above, and this will not be repeated here.
Some embodiments of the present application also provide a computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the operations of the method according to any of the above-described methods provided by the above-described embodiments.
Some embodiments of the present application also provide a computer program product, where the computer program product includes a computer program, where the computer program when executed by a processor may implement operations of a method corresponding to any of the above embodiments of the above method provided by the above embodiments.
As shown in fig. 5, some embodiments of the present application provide an electronic device 500, the electronic device 500 comprising: memory 510, processor 520, and a computer program stored on memory 510 and executable on processor 520, wherein processor 520 may implement a method as in any of the embodiments described above when reading the program from memory 510 and executing the program via bus 530.
Processor 520 may process the digital signals and may include various computing structures. Such as a complex instruction set computer architecture, a reduced instruction set computer architecture, or an architecture that implements a combination of instruction sets. In some examples, processor 520 may be a microprocessor.
Memory 510 may be used for storing instructions to be executed by processor 520 or data related to execution of the instructions. Such instructions and/or data may include code to implement some or all of the functions of one or more of the modules described in embodiments of the present application. The processor 520 of the disclosed embodiments may be configured to execute instructions in the memory 510 to implement the methods shown above. Memory 510 includes dynamic random access memory, static random access memory, flash memory, optical memory, or other memory known to those skilled in the art.
The above description is only an example of the present application and is not intended to limit the scope of the present application, and various modifications and variations will be apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the protection scope of the present application. It should be noted that: like reference numerals and letters denote like items in the following figures, and thus once an item is defined in one figure, no further definition or explanation thereof is necessary in the following figures.
The foregoing is merely illustrative of the present application, and the present application is not limited thereto, and any person skilled in the art will readily recognize that variations or substitutions are within the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
It is noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.

Claims (10)

1. A method of processing a digital string, comprising:
acquiring a check code of a first character string, and adding the check code to the first character string to acquire a second character string, wherein the first character string is in the form of digital bytes;
performing format conversion on the second character string to obtain a third character string;
and encrypting and encoding the third character string to obtain a character string processing result.
2. The method of claim 1, wherein prior to obtaining the check code for the first string, the method further comprises:
when the original character string is confirmed to be a digital character string, converting the original character string into digital bytes to obtain the first character string;
and when the original character string is confirmed to be a non-numeric character string, converting the non-numeric character in the original character string into a number according to a non-numeric coding mapping table to obtain the first character string.
3. The method of claim 1 or 2, wherein the obtaining a check code of a first string and adding the check code to the first string, obtaining a second string, comprises:
and calculating the Luhn check code of the first character string by utilizing a Luhn algorithm, and adding the Luhn check code to the tail part of the first character string to obtain the second character string.
4. The method according to claim 1 or 2, wherein the performing format conversion on the second string to obtain a third string includes:
and converting the second character string from a digital type to an integer type to obtain the third character string.
5. The method according to claim 1 or 2, wherein encrypting and encoding the third string to obtain a string processing result includes:
encrypting the third character string by using a target encryption algorithm to obtain initial encrypted data;
generating a random vector, and adding the random vector to the head of the initial encrypted data to obtain an encryption result to be encoded;
and encoding the encryption result to be encoded to obtain the character string processing result.
6. The method according to claim 1 or 2, wherein encrypting and encoding the third string to obtain a string processing result includes:
encrypting the third character string by using a target encryption algorithm to obtain initial encrypted data;
and encoding the initial encrypted data by using a target encoding mode to obtain the character string processing result.
7. An apparatus for processing a digital string, comprising:
the verification module is configured to acquire a verification code of a first character string, and add the verification code to the first character string to acquire a second character string, wherein the first character string is in the form of digital bytes;
the conversion module is configured to perform format conversion on the second character string to obtain a third character string;
and the encryption and coding module is configured to encrypt and code the third character string to obtain a character string processing result.
8. A computer readable storage medium, characterized in that the computer readable storage medium has stored thereon a computer program, wherein the computer program when run by a processor performs the method according to any of claims 1-6.
9. A computer program product, characterized in that the computer program product comprises a computer program, wherein the computer program, when run by a processor, performs the method according to any of claims 1-6.
10. An electronic device comprising a memory, a processor, and a computer program stored on the memory and running on the processor, wherein the computer program when run by the processor performs the method of any one of claims 1-6.
CN202310671534.6A 2023-06-07 2023-06-07 Method and device for processing digital character strings, storage medium and electronic equipment Pending CN117009987A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310671534.6A CN117009987A (en) 2023-06-07 2023-06-07 Method and device for processing digital character strings, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310671534.6A CN117009987A (en) 2023-06-07 2023-06-07 Method and device for processing digital character strings, storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN117009987A true CN117009987A (en) 2023-11-07

Family

ID=88560877

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310671534.6A Pending CN117009987A (en) 2023-06-07 2023-06-07 Method and device for processing digital character strings, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN117009987A (en)

Similar Documents

Publication Publication Date Title
US9736142B2 (en) Tokenization using multiple reversible transformations
CN109150499B (en) Method and device for dynamically encrypting data, computer equipment and storage medium
WO2019153867A1 (en) Two-dimensional code generation and identification
TW201812638A (en) Storage design method of blockchain encrypted radio frequency chip
CN112202754B (en) Data encryption method and device, electronic equipment and storage medium
CN106610995B (en) Method, device and system for creating ciphertext index
CN113343305A (en) Intersection calculation method, device and equipment of private data and storage medium
WO2019114122A1 (en) Encryption method for login information, device, electronic device, and medium
US9762384B2 (en) Generation and verification of alternate data having specific format
CN112511514A (en) HTTP encrypted transmission method and device, computer equipment and storage medium
CN111010266B (en) Message encryption and decryption, reading and writing method and device, computer equipment and storage medium
CN110704854B (en) Stream type encryption method aiming at text data reserved format
CN112469036A (en) Message encryption and decryption method and device, mobile terminal and storage medium
CN113098675B (en) Binary data encryption system and method based on polynomial complete homomorphism
CN112231718A (en) Data encryption processing method and device, computer equipment and storage medium
CN115766244A (en) Internet of vehicles information encryption method and device, computer equipment and storage medium
CN117009987A (en) Method and device for processing digital character strings, storage medium and electronic equipment
CN115603907A (en) Method, device, equipment and storage medium for encrypting storage data
CN112910630B (en) Method and device for replacing expanded key
CN111475690B (en) Character string matching method and device, data detection method and server
CN114139177A (en) Token generation method, system and device
CN115935299A (en) Authorization control method, device, computer equipment and storage medium
JP6631989B2 (en) Encryption device, control method, and program
CN113872753B (en) Encryption transmission method and device based on SHA256 sequence form data
CN116484407B (en) Data security protection method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination