CN115442073A - Encryption method and decryption method of numeric string, electronic device and storage medium - Google Patents

Encryption method and decryption method of numeric string, electronic device and storage medium Download PDF

Info

Publication number
CN115442073A
CN115442073A CN202210914942.5A CN202210914942A CN115442073A CN 115442073 A CN115442073 A CN 115442073A CN 202210914942 A CN202210914942 A CN 202210914942A CN 115442073 A CN115442073 A CN 115442073A
Authority
CN
China
Prior art keywords
target
result
interference
coding result
ciphertext data
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
CN202210914942.5A
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.)
Yuanguang Software Co Ltd
Original Assignee
Yuanguang Software Co Ltd
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 Yuanguang Software Co Ltd filed Critical Yuanguang Software Co Ltd
Priority to CN202210914942.5A priority Critical patent/CN115442073A/en
Publication of CN115442073A publication Critical patent/CN115442073A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/04Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
    • H04L63/0428Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Hardware Design (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Storage Device Security (AREA)

Abstract

The application discloses an encryption method, a decryption method, electronic equipment and a storage medium of a digital string, wherein the method comprises the following steps: acquiring a character string corresponding to a numeric string to be encrypted; coding a character string corresponding to a digital string to be encrypted to obtain an initial coding result; changing the target character in the initial coding result according to a preset rule to obtain a target coding result; and obtaining a target encryption result based on the target coding result. By means of the method, the security of the target encryption result can be improved.

Description

Encryption method and decryption method of digital string, electronic device and storage medium
Technical Field
The present application relates to the field of information security technologies, and in particular, to an encryption method, a decryption method, an electronic device, and a storage medium for a digital string.
Background
In the current digital society, various electronic assets need to be coded in a digital string form, and are convenient to retrieve, archive and the like. Meanwhile, the electronic assets are difficult to avoid the problem of information security, and the protection of the digital string can be safely transmitted to become a key link in information transmission.
In the prior art, a plurality of algorithms for encrypting and decrypting the numeric string are provided, such as modes of circular calculation, numeric remainder, array conversion, binary conversion, numeric splicing and the like, but the algorithms are all used for directly and simply encrypting the numeric string, have poor encryption effect and are easy to crack.
Disclosure of Invention
The technical problem mainly solved by the present application is to provide an encryption method, a decryption method, an electronic device and a storage medium for a digital string, which can improve the security of a target encryption result.
In order to solve the above technical problem, a first aspect of the present application provides a method for encrypting a string of numbers, the method including: acquiring a character string corresponding to a numeric string to be encrypted; coding a character string corresponding to a digital string to be encrypted to obtain an initial coding result; changing the target character in the initial coding result according to a preset rule to obtain a target coding result; and obtaining a target encryption result based on the target coding result.
Wherein, based on the target coding result, obtaining a target encryption result comprises: obtaining interference ciphertext data by using a target coding result; combining the interference ciphertext data with the target coding result to obtain a target encryption result; or, the target encoding result is used as the target encryption result.
Wherein the target encoding result comprises a first number of target elements; obtaining interference ciphertext data by using a target coding result, wherein the method comprises the following steps: and carrying out binary conversion on the first number of target elements to obtain interference ciphertext data.
Wherein the target encryption result further comprises a target number; combining the interference ciphertext data with the target coding result to obtain a target encryption result, wherein the method comprises the following steps: and connecting the target coding result and the interference ciphertext data by using the target number to obtain a target encryption result.
The target encryption result comprises a target number of elements, and the interference ciphertext data comprises a second number of interference elements; and stopping the step of carrying out the binary conversion on the first number of target elements when the sum of the first number and the second number is equal to the difference value obtained by subtracting the preset value from the target number.
Wherein, obtain the character string that waits to encrypt the number string correspondence, include: dividing the digital string to be encrypted by a preset constant to obtain at least one target remainder; obtaining at least one target character corresponding to a target remainder; and connecting target characters corresponding to at least one target remainder to obtain a character string.
In order to solve the above technical problem, a second aspect of the present application provides a decryption method, including: obtaining a target encryption result; obtaining a target coding result based on the target encryption result; restoring the target coding result according to a preset rule to obtain an initial coding result; decoding the initial coding result to obtain a character string corresponding to the numeric string to be encrypted; and obtaining the numeric string to be encrypted based on the character string corresponding to the numeric string to be encrypted. The target encryption result is obtained by encrypting the digital string by using the encryption method of the digital string provided by the first aspect.
The target encryption result comprises a target coding result and interference ciphertext data; before restoring the target coding result according to the preset rule, the method further comprises the following steps: carrying out scale conversion on the target coding result to obtain a scale conversion result; judging whether the binary conversion result is the same as the interference ciphertext data; if the target coding result is the same as the preset coding result, the step of restoring the target coding result according to a preset rule is executed; and if not, the step of restoring the target coding result according to a preset rule is not executed.
To solve the above technical problem, a third aspect of the present application provides an electronic device, which includes a memory and a processor coupled to each other, where the memory stores program instructions; the processor is adapted to execute program instructions stored in the memory to implement the methods of the first and second aspects described above.
To solve the above technical problem, a fourth aspect of the present application provides a computer-readable storage medium for storing program instructions, which can be executed to implement the method of the first and second aspects.
The beneficial effect of this application is: different from the situation of the prior art, the method and the device for encrypting the digital string acquire the character string corresponding to the digital string to be encrypted; coding a character string corresponding to a digital string to be encrypted to obtain an initial coding result; the method is different from the prior art that the digital string to be encrypted is directly encoded, and can improve the complexity of an initial encoding result and further improve the complexity of a target encryption result. Further, changing the target characters in the initial coding result according to a preset rule to obtain a target coding result; and obtaining a target encryption result based on the target coding result. Target characters in the initial coding result are changed, so that other users cannot guess the target coding result according to the inherent logic, the safety of the target encryption result can be improved, and the cracking difficulty of the target encryption result is increased.
Drawings
FIG. 1 is a schematic flow chart diagram illustrating an embodiment of a method for encrypting a digital string provided herein;
FIG. 2 is a schematic flow chart diagram illustrating another embodiment of a digital string encryption method provided herein;
FIG. 3 is a schematic flowchart of an embodiment of a decryption method provided in the present application;
FIG. 4 is a schematic diagram of a frame structure of an embodiment of an electronic device provided in the present application;
FIG. 5 is a block diagram of one embodiment of a computer-readable storage medium provided herein.
Detailed Description
The technical solutions in the embodiments of the present application are clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments in the present application without making any creative effort belong to the protection scope of the present application.
It should be noted that, in the embodiments of the present application, there are descriptions related to "first", "second", etc., and the descriptions of "first", "second", etc. are only used for descriptive purposes and are not to be construed as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the invention. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly and implicitly understood by one skilled in the art that the embodiments described herein can be combined with other embodiments.
Referring to fig. 1, fig. 1 is a schematic flow chart of an embodiment of a digital string encryption method provided in the present application, the method including:
s110: and acquiring a character string corresponding to the numeric string to be encrypted.
In an embodiment, the to-be-encrypted digit string may be divided by a preset constant to obtain at least one target remainder, specifically, the to-be-encrypted digit string is divided by the preset constant to obtain a remainder obtained after each integer division as the target remainder, and the operation is ended until the integer division result is 0. And then acquiring at least one target character corresponding to the target remainder, and connecting the target characters corresponding to the at least one target remainder to obtain a character string. Wherein the preset constant can be set according to the requirement. In one embodiment, the target characters are characters in american standard code for information interchange (i.e., ASCII code table), which may also be referred to as ASCII characters, and since the ASCII code table contains 256 ASCII characters, the preset constant is set to 256, so that the target remainder can be any ASCII character in the ASCII code table. It is understood that the predetermined constant may be other values.
To facilitate understanding of the method for acquiring the character string, the following example is given: for example, the number string to be encrypted is 518520, 518520 is divided by 256, the first quotient is 2025, and the remainder is 120; divide by 256 the second time with 2025, with a quotient of 7 and a remainder of 233; the third time divides 256 by 7, with a quotient of 0 and a remainder of 7. And taking the remainders 120, 233 and 7 as target remainders, respectively obtaining ASCII characters corresponding to the target remainders 120, 233 and 7, and connecting to obtain a character string.
S120: and coding the character string corresponding to the digital string to be encrypted to obtain an initial coding result.
In one embodiment, a string corresponding to a numeric string to be encrypted may be encoded using base32 encoding (an encoding method), where the base32 encoding includes 32 ASCII characters. In other embodiments, other encoding methods may be used to encode the character string corresponding to the to-be-encrypted numeric string, such as base64. It is understood that the initial encoding result may include numbers, letters, special characters, etc.
S130: and changing the target characters in the initial coding result according to a preset rule to obtain a target coding result.
The target characters can be numbers, letters, special characters, and the like. The preset rule is preset by a user according to needs, and the preset rule can be that a specific letter in an initial coding result is changed into a specific number, for example, letters j, g and y are respectively changed into numbers 1, 8 and 9; it is also possible to change a specific number in the initial encoding result to a specific letter, such as changing numbers 2, 3 to letters n, m; it is also possible to change the special symbols to letters or numbers. The preset rule is set by a user according to requirements, and the specific setting rule is not limited.
In one embodiment, when the target character in the initial encoding result is the letter j, it is changed to the number 1; when the target character is a letter g, changing the letter g into a number 8; when the target character is the letter y, it is changed to the number 9. And other target characters in the initial coding result are not changed. And taking the result obtained after the target character in the initial coding result is changed as a target coding result.
S140: and obtaining a target encryption result based on the target coding result.
In one embodiment, the target encoding result may be used as the target encryption result.
In another embodiment, the interference ciphertext data may be obtained using the target encoding result; and combining the interference ciphertext data and the target coding result to obtain a target encryption result. The interference ciphertext data and the target coding result are combined, the interference ciphertext data and the target coding result can be spliced directly, target numbers can be connected with the target coding result and the interference ciphertext data, and the target numbers can be one or more. It is to be understood that, in other embodiments, target characters, target letters, and the like may also be used to connect the target encoding result and the interference ciphertext data to obtain the target encryption result.
In the embodiment, a character string corresponding to a numeric string to be encrypted is obtained; coding a character string corresponding to a digital string to be encrypted to obtain an initial coding result; the method is different from the prior art that the digital string to be encrypted is directly encoded, and can improve the complexity of an initial encoding result and further improve the complexity of a target encryption result. Further, changing the target characters in the initial coding result according to a preset rule to obtain a target coding result; and obtaining a target encryption result based on the target coding result. And target characters in the initial coding result are changed, so that the safety of the target encryption result can be improved, and the cracking difficulty of the target encryption result is increased.
Referring to fig. 2, fig. 2 is a schematic flowchart illustrating a digital string encryption method according to another embodiment of the present disclosure; the method comprises the following steps:
s210: and acquiring a character string corresponding to the numeric string to be encrypted.
S220: and coding the character string corresponding to the numeric string to be encrypted to obtain an initial coding result. S230: and changing the target characters in the initial coding result according to a preset rule to obtain a target coding result.
Steps S210 to S230 refer to steps S110 to S130 in an embodiment of the digital string encryption method, which are not described herein again.
S240: and obtaining interference ciphertext data by using the target coding result.
In an embodiment, the target coding result may be subjected to a binary conversion to obtain interference ciphertext data. For example, the target encoding result includes a first number of target elements, each target element is subjected to binary conversion, and the converted results are spliced to obtain interference ciphertext data. Wherein the interference ciphertext data comprises a second number of interference elements. It can be understood that, after performing the binary conversion on each target element, one interference element may be obtained, or multiple interference elements may also be obtained, so that, if all target elements included in the target encoding result are subjected to the binary conversion, the second number is greater than or equal to the first number, that is, the second number of interference elements included in the interference ciphertext data is greater than or equal to the first number of target elements included in the target encoding result.
In one embodiment, the following binary conversion for each target element comprises: and acquiring an ASCII value corresponding to each target element contained in the target coding result, amplifying the ASCII value, taking the amplified value as an octal value, converting the octal value into a decimal value, converting the decimal value into a hexadecimal value after multiplying the decimal value by the ASCII value corresponding to the target element, and taking the hexadecimal value as an interference element contained in the interference ciphertext data.
Specifically, after obtaining the ASCII value corresponding to the target element, a first numerical value may be added to the ASCII value, and the first numerical value may be 1, 2, 3, etc. Since the target element may have an ASCII value of 0, the first value is added so that the second value is not 0. The second value is amplified, for example, the second value is multiplied by a third value and then squared to obtain a fourth value, where the third value may be 10, 20, and so on. It is to be understood that the second value may be multiplied by the third value to obtain a third power, a fourth power, etc. to obtain a fourth value. And regarding the fourth numerical value as an octal numerical value, and converting the fourth numerical value into a decimal to obtain a fifth numerical value. And multiplying the fifth numerical value by the ASCII value corresponding to the target element to obtain a sixth numerical value, and converting the sixth numerical value into hexadecimal to obtain the interference element contained in the interference ciphertext data.
In this embodiment, 2 may be added to the ASCII value corresponding to the target element and then multiplied by 10, and then squared to obtain an octal value, the octal value is converted into a decimal value, and the decimal value is multiplied by the ASCII value corresponding to the target element and then converted into hexadecimal to obtain the interference element.
It can be understood that, above, the target elements included in the target encoding result are all subjected to the binary conversion, and a part of the target elements may also be subjected to the binary conversion.
S250: and combining the interference ciphertext data and the target coding result to obtain a target encryption result.
In an embodiment, the target encoding result and the interference ciphertext data may be directly spliced to obtain the target encryption result. If the user does not set the number of elements included in the target encryption result, the number of elements included in the target encryption result is the number of target elements included in the target encoding result and the number of interference elements included in the interference ciphertext data. If the user sets the number of elements included in the target encryption result, for example, the user sets the target encryption result to include the number of elements in the target number, the target number of elements may be taken out after splicing the target encoding result and the interference element data. Wherein, the target encryption result must include all target elements in the target encoding result and at least one interference element in the interference ciphertext data. For example, the target encoding result includes 6 target elements, binary conversion is performed on all the target elements to obtain 7 interference elements, and the target ciphertext data includes 10 elements, so that 4 interference elements can be selected from the 7 interference elements, and the 6 target elements and the 4 interference elements are spliced to obtain the target ciphertext data. In selecting 4 interference elements, the interference element generated first may be selected as an element in the target encryption result in the order of generation of the interference elements.
In a specific embodiment, if the target encryption result set by the user includes a target number of elements and the target encoding result is known to include a first number of target elements, the target number and the first number may be subtracted to obtain a second number, where the second number is the number of interference elements included in the interference ciphertext data. For example, when carrying out the binary conversion on the target element included in the target encoding result, the target element may be partitioned into an array, and the target element in the array may be traversed to obtain the interference ciphertext data. And stopping the step of carrying out the binary conversion on the target element when the interference ciphertext in the interference ciphertext data reaches a second number.
In another embodiment, the target encryption result further includes a target number, and the target number is used to connect the target encoding result and the interference ciphertext data to obtain the target ciphertext data. The target number can be any number, a preset value is determined according to the number of digits occupied by the target number, and if the target number is a single digit, the preset value is 1; if the target array is ten digits, the preset value is 2. In one embodiment, if the target number is 0, the target number is used to connect the target encoding result and the interference ciphertext data. For example, if the target encoding result is a7uxq and the interference ciphertext data is 18c01524, the obtained target encryption result is a7uxq018c01524.
In a specific embodiment, if the user does not set the number of elements included in the target encryption result, the target elements included in the target encoding result may be subjected to binary conversion to obtain interference ciphertext data, and the target encoding result and the interference ciphertext data are connected by using a target number.
In another specific embodiment, if the user sets that the target encryption result includes a target number of elements, the target elements included in the target encoding result may all be subjected to binary conversion, a second number of interference elements are obtained from the obtained interference ciphertext data, and the target encoding result and the second number of interference elements are connected by using the target number, where the second number is the target number-the first number-a preset number, the first number is the number of the target elements included in the target encoding result, and the preset number is the number of bits of the target number. For example, if the target number is 0, the target encoding result is a7uxq, the interference ciphertext data is 18c01524, the first number is 5, and the target number is 10, then the second number is 4, that is, 4 interference elements are selected from the interference ciphertext data, where the 4 interference elements may be 1, 8, c, and 0, and the obtained target encryption result is a7uxq018c0.
In other specific embodiments, if the user sets that the target encryption result includes a target number of elements, the user may perform binary conversion on a part of the target elements included in the target encoding result, so that the number of interference elements in the obtained interference ciphertext data is equal to or slightly greater than a second number, where the second number is equal to the target number-the first number-a preset value, that is, when a sum of the first number and the second number is equal to or slightly greater than a difference between the target number and the preset value, the binary conversion on the first number of targets is stopped. In this way, the amount of computation of the device can be reduced.
The implementation mode can be executed by the server, namely the server takes the digital string to be encrypted out of the database, obtains the character string corresponding to the digital string to be encrypted, and codes the character string corresponding to the digital string to be encrypted to obtain an initial coding result; changing the target character in the initial coding result according to a preset rule to obtain a target coding result; and obtaining a target encryption result based on the target coding result. And after receiving the target encryption result, the server side can decrypt the target encryption result to obtain a digital string to be encrypted, and inquires corresponding data and returns the data to the client side.
The encryption method of the digital string mainly comprises the steps of adding, dividing, remaining and squaring the digital string, and the like, and has the advantages of simple steps, low complexity and extremely low performance consumption on a computer CPU; the security of the target decryption result is higher, and the target characters in the initial coding result are changed according to the preset rule, so that other users cannot decrypt the target encryption result according to the conventional logic, and the security of the digital string in network transmission is ensured; moreover, the number of elements contained in the target encryption result can be set, and when the target encryption result is stored in the database, the storage space can be reduced.
Referring to fig. 3, fig. 3 is a schematic flowchart illustrating an embodiment of a decryption method provided in the present application, where the decryption method includes:
s310: and acquiring a target encryption result.
And the target encryption result is obtained by encrypting the digital string to be encrypted by adopting any one encryption method of the digital string.
S320: and obtaining a target coding result based on the target encryption result.
In one embodiment, the target encryption result may be used as the target encoding result.
In another embodiment, the target encryption result includes a target encoding result and interference ciphertext data, and the target encryption result is split into the target encoding result and the interference ciphertext data, for example, the target encryption result is a7uxq18c0, where a7uxq is the target encoding result and 18c0 is the interference ciphertext data.
In other embodiments, the target encryption result includes a target encoding result and interference ciphertext data and a target number, where the target number connects the target encoding result and the interference ciphertext data, and the target encryption result is a7uxq018c0, a7uxq is the target encoding result, 18c0 is the interference ciphertext data, and 0 is the target number. When the target number is set, the first target number in the target encryption result can be detected, the target encryption result positioned on the left side of the target number is used as a target coding result, and the target encryption result positioned on the left side and the right side of the target number is used as interference ciphertext data.
S330: and restoring the target coding result according to a preset rule to obtain an initial coding result.
In an embodiment, if the target encryption result is the target encoding result, the target encoding result is restored according to a preset rule, for example, the preset rule during encryption is to change letters j, g, and y in the initial encoding result to numbers 1, 8, and 9, respectively, and the preset rule during decryption is to restore numbers 1, 8, and 9 in the target encoding result to letters j, g, and y, so as to obtain the initial encoding result. It is understood that the step of restoring the target encoding result according to the preset rule is the reverse process of modifying the target character in the initial encoding result according to the preset rule in step S130 in the encryption method of the above-mentioned digital string.
In another embodiment, the target encryption result includes a target coding result and interference ciphertext data, and the target coding result may be subjected to binary conversion to obtain a binary conversion result; judging whether the binary conversion result is the same as the interference ciphertext data; if the target coding result is the same as the preset coding result, the step of restoring the target coding result according to a preset rule is executed; and if not, the step of restoring the target coding result according to a preset rule is not executed. The process of performing the binary conversion on the target coding result in the decryption process to obtain the binary conversion result is the same as the process of performing the binary conversion on the target coding result in the encryption process to obtain the interference ciphertext data, and is not described herein again. It can be understood that the target encoding result can be decrypted only when the binary conversion result is the same as the interference ciphertext data.
S340: and decoding the initial coding result to obtain a character string corresponding to the digital string to be encrypted.
In one embodiment, a base32 method is adopted to encode a character string corresponding to a numeric string to be encrypted, so as to obtain an initial encoding result. When the initial coding result is decoded, the inverse process of coding is adopted for decoding, and the character string corresponding to the digital string to be encrypted can be obtained.
S350: and obtaining the numeric string to be encrypted based on the character string corresponding to the numeric string to be encrypted.
In an embodiment, an inverse process of obtaining a character string corresponding to a to-be-encrypted numeric string is performed to obtain the to-be-encrypted numeric string. In a specific implementation mode, a target remainder is obtained by a character string and an ASCII code table corresponding to a numeric string to be encrypted; and obtaining the digit string to be encrypted by using the target remainder and a preset constant.
According to the method, the interference ciphertext data are verified firstly, and the target coding result can be decrypted only if the verification is passed, so that the decryption difficulty is enhanced, and the safety of the target encryption result is ensured.
Referring to fig. 4, fig. 4 is a schematic diagram of a frame structure of an embodiment of an electronic device provided in the present application.
The electronic device 40 comprises a memory 41 and a processor 42 coupled to each other, the memory 41 storing program instructions, and the processor 42 being configured to execute the program instructions stored in the memory 41 to implement the steps of any of the above-mentioned method embodiments. In one particular implementation scenario, electronic device 40 may include, but is not limited to: a microcomputer, a server, and in addition, the electronic device 40 may also include a mobile device such as a notebook computer, a tablet computer, and the like, which is not limited herein.
In particular, the processor 42 is adapted to control itself and the memory 41 to implement the steps of any of the above-described method embodiments. Processor 42 may also be referred to as a CPU (Central Processing Unit). The processor 42 may be an integrated circuit chip having signal processing capabilities. The Processor 42 may also be a general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. In addition, the processor 42 may be commonly implemented by an integrated circuit chip.
Referring to fig. 5, fig. 5 is a block diagram illustrating an embodiment of a computer-readable storage medium according to the present disclosure.
The computer readable storage medium 50 stores program instructions 51, and the program instructions 51 are executed by the processor to implement the steps of any of the above-described method embodiments.
The computer-readable storage medium 50 may be a medium that can store a computer program, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, or may be a server that can send the stored computer program to another device for running or can run the stored computer program by itself.
If the technical scheme of the application relates to personal information, a product applying the technical scheme of the application clearly informs personal information processing rules before processing the personal information, and obtains personal independent consent. If the technical scheme of the application relates to sensitive personal information, before the sensitive personal information is processed, a product applying the technical scheme of the application obtains individual consent and simultaneously meets the requirement of 'explicit consent'. For example, at a personal information collection device such as a camera, a clear and significant identifier is set to inform that the personal information collection range is entered, the personal information is collected, and if the person voluntarily enters the collection range, the person is regarded as agreeing to collect the personal information; or on the device for processing the personal information, under the condition of informing the personal information processing rule by using obvious identification/information, obtaining personal authorization by modes of popping window information or asking a person to upload personal information of the person by himself, and the like; the personal information processing rule may include information such as a personal information processor, a personal information processing purpose, a processing method, and a type of personal information to be processed.
The above description is only an embodiment of the present application, and is not intended to limit the scope of the present application, and all equivalent structures or equivalent processes performed by the present application and the contents of the attached drawings, which are directly or indirectly applied to other related technical fields, are also included in the scope of the present application.

Claims (10)

1. A method for encrypting a string of numbers, the method comprising:
acquiring a character string corresponding to a numeric string to be encrypted;
coding the character string corresponding to the digital string to be encrypted to obtain an initial coding result;
changing the target character in the initial coding result according to a preset rule to obtain a target coding result;
and obtaining a target encryption result based on the target coding result.
2. The method of claim 1, wherein obtaining a target encryption result based on the target encoding result comprises:
obtaining interference ciphertext data by using the target coding result;
combining the interference ciphertext data with the target coding result to obtain a target encryption result;
or, the target coding result is used as the target encryption result.
3. The method of claim 2, wherein the target encoding result comprises a first number of target elements;
the obtaining of the interference ciphertext data by using the target coding result includes:
and carrying out binary conversion on the first number of target elements to obtain the interference ciphertext data.
4. The method of claim 3, wherein the target encryption result further comprises a target number;
the combining the interference ciphertext data and the target encoding result to obtain the target encryption result includes:
and connecting the target coding result and the interference ciphertext data by using the target number to obtain the target encryption result.
5. The method of claim 4, wherein the target encryption result contains a target number of elements, and wherein the interfering ciphertext data comprises a second number of interfering elements;
stopping the step of performing the binary conversion on the first number of target elements when the sum of the first number and the second number is equal to the difference between the target number and a preset value.
6. The method according to claim 1, wherein the obtaining a character string corresponding to a number string to be encrypted comprises:
dividing the digital string to be encrypted by a preset constant to obtain at least one target remainder;
obtaining the target character corresponding to the at least one target remainder;
and connecting the target characters corresponding to the at least one target remainder to obtain the character string.
7. A decryption method for decrypting a target encryption result according to any one of claims 1 to 6;
the decryption method comprises the following steps:
acquiring the target encryption result;
obtaining the target coding result based on the target encryption result;
restoring the target coding result according to the preset rule to obtain the initial coding result;
decoding the initial coding result to obtain a character string corresponding to the digital string to be encrypted;
and obtaining the numeric string to be encrypted based on the character string corresponding to the numeric string to be encrypted.
8. The method of claim 7, wherein the target encryption result comprises the target encoding result and interfering ciphertext data;
before the restoring the target coding result according to the preset rule, the method further includes:
carrying out scale conversion on the target coding result to obtain a scale conversion result;
judging whether the binary conversion result is the same as the interference ciphertext data; if the target coding result is the same as the preset coding result, the step of restoring the target coding result according to the preset rule is executed; and if not, not executing the step of restoring the target coding result according to the preset rule.
9. An electronic device, comprising a memory and a processor coupled to each other,
the memory stores program instructions;
the processor is configured to execute program instructions stored in the memory to implement the method of any of claims 1-8.
10. A computer-readable storage medium for storing program instructions executable to implement the method of any one of claims 1-8.
CN202210914942.5A 2022-07-29 2022-07-29 Encryption method and decryption method of numeric string, electronic device and storage medium Pending CN115442073A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210914942.5A CN115442073A (en) 2022-07-29 2022-07-29 Encryption method and decryption method of numeric string, electronic device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210914942.5A CN115442073A (en) 2022-07-29 2022-07-29 Encryption method and decryption method of numeric string, electronic device and storage medium

Publications (1)

Publication Number Publication Date
CN115442073A true CN115442073A (en) 2022-12-06

Family

ID=84242276

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210914942.5A Pending CN115442073A (en) 2022-07-29 2022-07-29 Encryption method and decryption method of numeric string, electronic device and storage medium

Country Status (1)

Country Link
CN (1) CN115442073A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116132159A (en) * 2023-02-02 2023-05-16 马上消费金融股份有限公司 Data encryption method, device, electronic equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116132159A (en) * 2023-02-02 2023-05-16 马上消费金融股份有限公司 Data encryption method, device, electronic equipment and storage medium
CN116132159B (en) * 2023-02-02 2024-04-09 马上消费金融股份有限公司 Data encryption method, device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN106817358B (en) Encryption and decryption method and device for user resources
CN111698088B (en) Key alternation method, key alternation device, electronic equipment and medium
CN113259132B (en) Data transmission encryption and decryption method and device, computer equipment and storage medium
KR20060134992A (en) Computer system, computer program, and addition method
CN111740830B (en) Information encryption and decryption method and device, information processing equipment and storage medium
CN111241596B (en) Block chain asset account recovery method and device
CN115442073A (en) Encryption method and decryption method of numeric string, electronic device and storage medium
Li et al. A image encryption algorithm based on coexisting multi-attractors in a spherical chaotic system
CN117708847A (en) 3C product leasing platform data processing method based on data compression and encryption
US20020136400A1 (en) R-conversion encryption method and system
CN108183785A (en) A kind of method, system, device and readable storage medium storing program for executing for preventing from hitting library or dragging library
CN112199730A (en) Method and device for processing application data on terminal and electronic equipment
CN114221753B (en) Key data processing method and electronic equipment
CN116842532A (en) Data processing method, device, computer equipment and computer readable storage medium
CN115757535A (en) Data query method, data storage method and device and electronic equipment
CN114139177A (en) Token generation method, system and device
CN115426111A (en) Data encryption method and device, electronic equipment and storage medium
CN113347270A (en) Method and device for preventing horizontal unauthorized network transmission file
CN114390318A (en) User data encryption and decryption method and device and electronic equipment
CN116484407B (en) Data security protection method and device, electronic equipment and storage medium
CN113922947A (en) Adaptive symmetric coding method and system based on weighted probability model
CN112214776A (en) Encryption and decryption method and device based on convolutional neural network
Usman et al. A novel encoding-decoding scheme using Huffman coding for multimedia networks
CN112182593A (en) Data processing method and device and electronic equipment
CN110247912B (en) Data processing method and device

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