CN114726516B - Encryption method for fusing card number and password, terminal equipment and storage medium - Google Patents
Encryption method for fusing card number and password, terminal equipment and storage medium Download PDFInfo
- Publication number
- CN114726516B CN114726516B CN202210313411.0A CN202210313411A CN114726516B CN 114726516 B CN114726516 B CN 114726516B CN 202210313411 A CN202210313411 A CN 202210313411A CN 114726516 B CN114726516 B CN 114726516B
- Authority
- CN
- China
- Prior art keywords
- key
- character string
- secret key
- initial character
- card number
- 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.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 30
- 238000004590 computer program Methods 0.000 claims description 19
- 238000007781 pre-processing Methods 0.000 claims description 14
- 230000004927 fusion Effects 0.000 claims 1
- 238000012545 processing Methods 0.000 description 3
- 238000010586 diagram Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000003491 array Methods 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 238000005336 cracking Methods 0.000 description 1
- 230000001419 dependent effect Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/08—Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
- H04L9/0861—Generation of secret information including derivation or calculation of cryptographic keys or passwords
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/08—Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
- H04L9/088—Usage controlling of secret information, e.g. techniques for restricting cryptographic keys to pre-authorized uses, different access levels, validity of crypto-period, different key- or password length, or different strong and weak cryptographic algorithms
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/08—Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
- H04L9/0894—Escrow, recovery or storing of secret information, e.g. secret key escrow or cryptographic key storage
Landscapes
- Engineering & Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Storage Device Security (AREA)
- Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)
Abstract
The application relates to a method, a system, a terminal device and a storage medium for encrypting a card number and a password, belonging to the technical field of password security, wherein the method comprises the following steps: obtaining a card number and an original password, and combining the card number and the original password to form an initial character string; obtaining a secret key based on the initial character string and a preset secret key generation rule; performing position exchange operation on the initial character string based on the secret key to obtain ciphertext data; and storing the secret key and the ciphertext data as encryption information. The application has the effect of improving the security of the password encryption.
Description
Technical Field
The present application relates to the field of password security technologies, and in particular, to a method for encrypting a card number and a password, a terminal device, and a storage medium.
Background
With the rapid development and wide application of data communication technology, the society is increasingly dependent on safe storage, safe processing and safe transmission of information, and the problem of safe protection of information is more important.
At present, a card swiping mode is adopted in many fields to acquire information in a card, and for safety, encryption processing is required to be carried out on a password of the card, and generally, various encryption modes need to generate encryption keys with fixed lengths and the same type, and the password can be encrypted and decrypted through the keys.
With respect to the related art described above, the inventors consider that since the number of bits of the same type of password is the same and the number of bits of the key for encrypting the password is also fixed, when the password is cracked, the difficulty of cracking is reduced, resulting in lower security of the password.
Disclosure of Invention
In order to improve the security of password encryption, the application provides a method, a system, terminal equipment and a storage medium for encrypting a card number and a password.
In a first aspect, the present application provides a method for encrypting a card number and a password, which adopts the following technical scheme:
An encryption method for fusing a card number and a password comprises the following steps:
obtaining a card number and an original password, and combining the card number and the original password to form an initial character string;
Obtaining a secret key based on the initial character string and a preset secret key generation rule;
performing position exchange operation on the initial character string based on the secret key to obtain ciphertext data;
and storing the secret key and the ciphertext data as encryption information.
By adopting the technical scheme, the card number and the password are combined to form the initial character string, and the secret key is obtained according to the initial character string, so that each card number and the original password correspond to one secret key, and the safety of the card number and the password in the system is improved; the initial character string is subjected to position exchange operation through the secret key to obtain ciphertext data, the lengths of the secret key and the ciphertext data are determined by the lengths of the card number and the password, and compared with the prior art, the secret key and the ciphertext data are dynamically changed along with the change of the card number and the password, so that the secret key and the ciphertext data can be changed at any time according to the requirements of users, the secret key and the ciphertext data have stronger dynamic adjustment capability, and meanwhile, the data length of the encrypted secret key and ciphertext data is not increased, so that the storage space is saved.
Optionally, the step of obtaining the key based on the initial string and a preset key generation rule includes the following steps:
determining a key length based on the length of the initial string;
And determining the key based on a preset key generation rule and the key length.
By adopting the technical scheme, the key length is determined according to the length of the initial character string, and the key dynamically changes along with the initial character string.
Optionally, the performing a position exchange operation on the initial string based on the key to obtain ciphertext data includes the following steps:
determining the character exchange position and the character exchange times of the initial character string based on the secret key;
And performing position exchange operation on the initial character string based on the character exchange position and the character exchange times to obtain ciphertext data.
By adopting the technical scheme, the ciphertext data is obtained by adjusting the positions of the characters of the initial character string, the obtained ciphertext data has the same length as the initial character string, the data length is not increased, and the storage space is saved.
Optionally, the storing the key and the ciphertext data as encryption information includes the steps of:
Associating the ciphertext data with the secret key to form encryption information of the card number and the original password;
and storing the encrypted information.
By adopting the technical scheme, the ciphertext data and the secret key are associated, so that a user can conveniently call the corresponding secret key to decrypt the ciphertext data.
In a second aspect, the present application provides a system for encrypting a card number and a password, which adopts the following technical scheme:
The encryption system for fusing the card number and the password comprises a preprocessing module, a secret key generation module, a ciphertext generation module and an encryption storage module, wherein the secret key generation module is connected with the preprocessing module, the ciphertext generation module is connected with the secret key generation module, and the encryption storage module is connected with the ciphertext generation module and the secret key generation module;
The preprocessing module is used for acquiring a card number and an original password, and combining the card number and the original password to form an initial character string;
The key generation module is used for acquiring a key based on the initial character string and a preset key generation rule;
the ciphertext generating module is used for carrying out position exchange operation on the initial character string based on the secret key to obtain ciphertext data;
the encryption storage module is used for storing the secret key and the ciphertext data as encryption information.
By adopting the technical scheme, the preprocessing module combines the card numbers and the passwords to form the initial character string, and the secret key generation module obtains the secret keys according to the initial character string, so that each card number and the original password correspond to one secret key, and the safety of the card numbers and the passwords in the system is improved; the cipher text generation module performs position exchange operation on the initial character string through the secret key to obtain cipher text data, the lengths of the secret key and the cipher text data are determined by the lengths of the card number and the cipher, and compared with the prior art, the secret key and the cipher text data are dynamically changed along with the change of the card number and the cipher, so that the cipher text generation module can be changed at any time according to the requirement of a user, has stronger dynamic adjustment capability, and meanwhile, the encrypted secret key and the encrypted cipher text data do not increase the data length, so that the storage space is saved.
Optionally, the key generating module includes a key information unit and a key generating unit, and the key generating unit is connected with the key information unit;
The key information unit is used for determining the key length based on the length of the initial character string;
The key generation unit is used for determining a key based on a preset key generation rule and the key length.
By adopting the technical scheme, the key information unit determines the key length according to the length of the initial character string, and the key generated by the key generating unit dynamically changes along with the initial character string.
Optionally, the ciphertext generating module includes a ciphertext information unit and a ciphertext generating unit, and the ciphertext generating unit is respectively connected with the ciphertext information unit;
The ciphertext information unit is used for determining the character exchange position and the character exchange times of the initial character string based on the secret key;
The ciphertext generating unit is used for carrying out position exchange operation on the initial character string based on the character exchange position and the character exchange times to obtain ciphertext data.
By adopting the technical scheme, the ciphertext generating unit adjusts the positions of the characters of the initial character string to obtain ciphertext data, the obtained ciphertext data is the same as the initial character string in length, the data length is not increased, and the storage space is saved.
Optionally, the encryption storage module comprises an association unit and a storage unit, and the storage unit is connected with the association unit;
The association unit is used for associating the ciphertext data with the secret key to form the encryption information of the card number and the original password;
the storage unit is used for storing the encrypted information.
By adopting the technical scheme, the related unit ciphertext data and the secret key are related, so that a user can conveniently call the corresponding secret key from the storage unit to decrypt the ciphertext data.
In a third aspect, the present application provides a terminal device, which adopts the following technical scheme:
the terminal equipment comprises a memory, a processor and a computer program which is stored in the memory and can run on the processor, wherein the processor adopts the method for encrypting the card number and the password when loading and executing the computer program.
By adopting the technical scheme, the computer program is generated by the method for encrypting the card number and the password and is stored in the memory to be loaded and executed by the processor, so that the terminal equipment is manufactured according to the memory and the processor, and the terminal equipment is convenient to use.
In a fourth aspect, the present application provides a computer readable storage medium, which adopts the following technical scheme:
A computer readable storage medium having a computer program stored therein, which when loaded and executed by a processor, employs the method of card number and password encryption described above.
By adopting the technical scheme, the computer program is generated by the method of encrypting the card number and the password and is stored in the computer readable storage medium to be loaded and executed by the processor, and the computer program is convenient to read and store by the computer readable storage medium.
Drawings
Fig. 1 is a schematic overall flow diagram of an encryption method integrating a card number and a password in an embodiment of the present application.
Fig. 2 is a schematic flow chart of steps S201 to S202 in an encryption method combining a card number and a password in an embodiment of the present application.
Fig. 3 is a schematic flow chart of step S301 to step S302 in an encryption method for fusing a card number and a password according to an embodiment of the present application.
Fig. 4 is a schematic flow chart of step S401 to step S402 in an encryption method for fusing a card number and a password according to an embodiment of the present application.
Fig. 5 is a schematic diagram of the overall module connection of an encryption system integrating a card number and a password according to an embodiment of the present application.
Reference numerals illustrate:
1. A preprocessing module; 2. a key generation module; 21. a key information unit; 22. a key generation unit; 3. a ciphertext generating module; 31. a ciphertext information unit; 32. a ciphertext generating unit; 4. an encryption storage module; 41. an association unit; 42. and a memory cell.
Detailed Description
The present application will be described in further detail with reference to the accompanying drawings.
The embodiment of the application discloses an encryption method for fusing a card number and a password, which refers to fig. 1 and comprises the following steps:
s101, acquiring a card number and an original password, and combining the card number and the original password to form an initial character string;
s102, acquiring a secret key based on an initial character string and a preset secret key generation rule;
s103, performing position exchange operation on the initial character string based on the secret key to obtain ciphertext data;
S104, storing the secret key and the ciphertext data as encryption information.
In step S101, the user card number and the original password are first obtained, and the card number and the original password are initially combined to form an initial character string, and in this embodiment, the length of the initial character string after the combination of the card number and the original password is preferably greater than or equal to 6 bits. For example, if the card number is 123 and the original password is abc, the initial character string 123abc is obtained by initially combining the card number and the original password.
Step S102, after the initial character string is acquired, a key corresponding to the initial character string is acquired according to the initial character string, so that the initial character string is conveniently encrypted. Referring to fig. 2, the key acquisition specifically includes the following steps:
s201, determining a key length based on the initial character string length;
S202, determining a secret key based on a preset secret key generation rule and a secret key length.
In step S201, as shown in the above example, the card number is 123, and the initial string formed by the original password abc has a length of 6. In this embodiment, the key length is determined according to the length of the initial string, specifically, an upwardly rounded number equal to or greater than one-fourth of the initial string length is used as the key length. For example, the initial string 123abc has a key length of 6/4=1.5, and 1.5 is rounded up to 2, which means that the key length of the initial string is 2.
In step S202, the key generation rule preset in this embodiment is: randomly selecting N numbers from the integer from 1 to one half of the initial character string length, wherein N is the key length. For the above example, a 2-bit (key length) number is selected from integers randomly ranging from 1 to 6/2=3 as the key, for example, (1, 3) is selected as the key. Through the arrangement, the obtained secret keys are different according to different card numbers and original passwords, and meanwhile, the secret keys can be modified, for example, (1, 3) can be selected as the secret key at this time, and if modification is needed, (1, 2) or (2, 3) can be selected as the secret key, so that the secret keys can be conveniently adjusted at any time.
In step S103, after determining the key of the initial string, the initial string may be encrypted according to the key, and referring to fig. 3, the method specifically includes the following steps:
s301, determining the character exchange position and the character exchange times of an initial character string based on a secret key;
s302, performing position exchange operation on the initial character string based on the character exchange positions and the character exchange times to obtain ciphertext data.
Specifically, after the key is obtained, each character of the initial character string may be adjusted according to the key to form ciphertext data. In the present embodiment, the exchange rule is set as: the two characters to be exchanged are the position in the initial string and the integer of half the initial string length for each digit in the key plus the digit position of the key.
For example, the initial string is 123abc, the key is (1, 3), and it is known that the character exchange positions at which the first exchange is required are "the 1 st bit of the initial string (the first digit of the key) and the 6/2+1=4 th bit (the integer of one half of the initial string length+the first digit of the key)", and therefore, the result after the first character exchange is a231bc for the key (1, 3).
And determining the number of character exchange times according to the length of the secret key, and if the length of the secret key (1, 3) is 2, the a231bc is required to be subjected to two character exchanges, the character exchange positions of the second exchange are the initial character string 3 rd bit and the initial character string 6/2+3=6 bit, and the result after the second character exchange is a2c1b3. After the two character exchanges are completed, the result is a2c1b3, and a2c1b3 is taken as ciphertext data.
In step S104, after obtaining the ciphertext data, the ciphertext data and the secret key are stored, so that the purposes of card number and password encryption can be achieved. Referring to fig. 4, the method specifically comprises the following steps:
s401, associating the ciphertext data with a secret key to form encryption information of a card number and an original password;
s402, storing the encrypted information.
Specifically, the secret key and the ciphertext data are acquired, the ciphertext data and the secret key are associated to form encryption information, and the encryption information is stored, so that the secret key corresponding to the ciphertext data can be acquired in time, and decryption is facilitated.
Specifically, when decryption is needed, the encryption information is obtained, the encryption information is matched with the secret key and the ciphertext data, and the ciphertext data can be restored to the card number of the plaintext and the original password according to the sequence of the character strings in the ciphertext data.
The implementation principle of the method for encrypting the card number and the password in the embodiment of the application is as follows: the card number and the password are combined to form an initial character string, and a secret key is obtained according to the initial character string, so that each card number and the original password correspond to one secret key, and the safety of the card number and the password in the system is improved; the initial character string is subjected to position exchange operation through the secret key to obtain ciphertext data, the lengths of the secret key and the ciphertext data are determined by the lengths of the card number and the password, and compared with the prior art, the secret key and the ciphertext data are dynamically changed along with the change of the card number and the password, so that the secret key and the ciphertext data can be changed at any time according to the requirements of users, the secret key and the ciphertext data have stronger dynamic adjustment capability, and meanwhile, the data length of the encrypted secret key and ciphertext data is not increased, so that the storage space is saved.
The embodiment of the application also discloses an encryption system for fusing the card number and the password, referring to fig. 5, comprising a preprocessing module 1, a secret key generation module 2, a ciphertext generation module 3 and an encryption storage module 4, wherein the secret key generation module 2 is connected with the preprocessing module 1, the ciphertext generation module 3 is connected with the secret key generation module 2, and the encryption storage module 4 is connected with the ciphertext generation module 3 and the secret key generation module 2. The preprocessing module 1 is used for acquiring a card number and an original password, and combining the card number and the original password to form an initial character string; the key generation module 2 is configured to obtain a key based on an initial character string and a preset key generation rule; the ciphertext generating module 3 is used for performing position exchange operation on the initial character string based on the secret key to obtain ciphertext data; the encryption storage module 4 is configured to store the key and the ciphertext data as encryption information.
The preprocessing module 1 firstly obtains the user card number and the original password, and performs preliminary combination on the card number and the original password to form an initial character string, and in this embodiment, the length of the initial character string after the card number and the original password are combined is preferably greater than or equal to 6 bits. For example, if the card number is 123 and the original password is abc, the preprocessing module 1 performs preliminary combination on the card number and the original password to obtain an initial character string of 123abc.
The key generation module 2 includes a key information unit 21 and a key generation unit 22, where the key generation unit 22 is connected to the key information unit 21, the key generation unit 22 is configured to determine a key length based on a length of an initial string, and the key generation unit 22 is configured to determine a key based on a preset key generation rule and the key length.
Specifically, after the initial string is obtained, the key information unit 21 determines the key length according to the length of the initial string, and as shown in the above example, the card number is 123, the length of the initial string formed by the original password abc is 6, and in this embodiment, the number with the round-up length equal to or greater than one fourth of the length of the initial string is used as the key length. For example, the initial string 123abc has a key length of 6/4=1.5, and 1.5 is rounded up to 2, which means that the key length of the initial string is 2.
Specifically, the key generation rule preset in this embodiment is: randomly selecting N numbers from the integer from 1 to one half of the initial character string length, wherein N is the key length. For the above example, the key generation unit 22 selects 2-bit (key length) numbers from integers randomly ranging from 1 to 6/2=3 as the key, for example, (1, 3) as the key. Through the arrangement, the obtained secret keys are different according to different card numbers and original passwords, and meanwhile, the secret keys can be modified, for example, (1, 3) can be selected as the secret key at this time, and if modification is needed, (1, 2) or (2, 3) can be selected as the secret key, so that the secret keys can be conveniently adjusted at any time.
The ciphertext generating module 3 includes a ciphertext information unit 31 and a ciphertext generating unit 32, the ciphertext generating unit 32 is connected with the ciphertext information unit 31, the ciphertext information unit 31 is configured to determine a character exchange position and a character exchange number of times of an initial character string based on a key, and the ciphertext generating unit 32 is configured to perform a position exchange operation on the initial character string based on the character exchange position and the character exchange number of times, so as to obtain ciphertext data.
Specifically, after the key is obtained, each character of the initial character string may be adjusted according to the key to form ciphertext data. In the present embodiment, the exchange rule is set as: the two characters to be exchanged are the position in the initial string and the integer of half the initial string length for each digit in the key plus the digit position of the key. The ciphertext information unit 31 determines the character exchange position according to the exchange rules.
For example, the initial string is 123abc, the key is (1, 3), and the ciphertext information unit 31 may determine that the character exchange positions at which the first exchange is performed are "the 1 st bit of the initial string (the first digit of the key) and the 6/2+1=4 th bit (the integer of one half the length of the initial string+the first digit of the key)", and thus, the result after the first character exchange is a231bc for the key (1, 3).
Meanwhile, the ciphertext information unit 31 determines the number of character exchanges according to the length of the key, and if the key length of the key (1, 3) is 2, two character exchanges are required for a231bc, the ciphertext information unit 31 determines the character exchange positions of the second exchange as "the 3 rd bit and the 6/2+3=6 th bit of the initial character string", and after the second character exchange, the result is a2c1b3. After the completion of the two character exchanges, the result is a2c1b3, and the ciphertext generating unit 32 outputs a2c1b3 as ciphertext data.
The encryption storage module 4 includes an association unit 41 and a storage unit 42, the storage unit 42 is connected with the association unit 41, the association unit 41 is used for associating ciphertext data with a secret key to form encryption information of a card number and an original password, and the storage unit 42 is used for storing the encryption information.
Specifically, the association unit 41 obtains the secret key and the ciphertext data, associates the ciphertext data with the secret key to form encrypted information, and stores the encrypted information in the storage unit 42, so that the secret key corresponding to the ciphertext data can be timely obtained from the storage unit 42, thereby facilitating decryption.
Specifically, when decryption is required, the encryption information is acquired from the storage unit 42, the encryption information is matched with the secret key and the ciphertext data, and the ciphertext data can be restored to the card number and the original password of the plaintext according to the sequence of the character strings in the exchange ciphertext data.
The implementation principle of the encryption system integrating the card number and the password in the embodiment of the application is as follows: the preprocessing module 1 combines the card numbers and the passwords to form an initial character string, and the secret key generation module 2 obtains secret keys according to the initial character string, so that each card number and each original password correspond to one secret key, and the safety of the card numbers and the passwords in the system is improved; the ciphertext generating module 3 performs position exchange operation on the initial character string through the secret key to obtain ciphertext data, the lengths of the secret key and the ciphertext data are determined by the lengths of the card number and the password, and compared with the prior art, the secret key and the ciphertext data are dynamically changed along with the change of the card number and the password, so that the secret key and the ciphertext data can be changed at any time according to the user demand, the secret key and the ciphertext data have stronger dynamic adjustment capability, and meanwhile, the encrypted secret key and ciphertext data do not increase the data length, so that the storage space is saved.
The embodiment of the application also discloses a terminal device which comprises a memory, a processor and a computer program stored in the memory and capable of running on the processor, wherein the method for encrypting the card number and the password in the embodiment is adopted when the processor executes the computer program.
The terminal device may be a computer device such as a desktop computer, a notebook computer, or a cloud server, and the terminal device includes, but is not limited to, a processor and a memory, for example, the terminal device may further include an input/output device, a network access device, a bus, and the like.
The processor may be a Central Processing Unit (CPU), or of course, according to actual use, other general purpose processors, digital Signal Processors (DSP), application Specific Integrated Circuits (ASIC), ready-made programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., and the general purpose processor may be a microprocessor or any conventional processor, etc., which is not limited in this respect.
The memory may be an internal storage unit of the terminal device, for example, a hard disk or a memory of the terminal device, or an external storage device of the terminal device, for example, a plug-in hard disk, a Smart Memory Card (SMC), a secure digital card (SD), or a flash memory card (FC) provided on the terminal device, or the like, and may be a combination of the internal storage unit of the terminal device and the external storage device, where the memory is used to store a computer program and other programs and data required by the terminal device, and the memory may be used to temporarily store data that has been output or is to be output, which is not limited by the present application.
The method for encrypting the card number and the password in the embodiment is stored in the memory of the terminal device through the terminal device, and is loaded and executed on the processor of the terminal device, so that the method is convenient to use.
The embodiment of the application also discloses a computer readable storage medium, and the computer readable storage medium stores a computer program, wherein the method for encrypting the card number and the password in the embodiment is adopted when the computer program is executed by a processor.
The computer program may be stored in a computer readable medium, where the computer program includes computer program code, where the computer program code may be in a source code form, an object code form, an executable file form, or some middleware form, etc., and the computer readable medium includes any entity or device capable of carrying the computer program code, a recording medium, a usb disk, a removable hard disk, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM), a Random Access Memory (RAM), an electrical carrier signal, a telecommunication signal, a software distribution medium, etc., where the computer readable medium includes, but is not limited to, the above components.
The method for encrypting the card number and the password in the embodiment is stored in the computer readable storage medium through the computer readable storage medium, and is loaded and executed on a processor, so that the storage and the application of the method are convenient.
The above embodiments are not intended to limit the scope of the present application, so: all equivalent changes in structure, shape and principle of the application should be covered in the scope of protection of the application.
Claims (3)
1. An encryption method for fusing a card number and a password is characterized in that an encryption system for fusing the card number and the password is adopted, and the method comprises the following steps:
Obtaining a card number and an original password, and combining the card number and the original password to form an initial character string, wherein the length of the initial character string after the card number and the original password are combined is greater than or equal to six bits;
Obtaining a secret key based on the initial character string and a preset secret key generation rule;
performing position exchange operation on the initial character string based on the secret key to obtain ciphertext data;
Storing the secret key and the ciphertext data as encryption information;
The key obtaining step of obtaining the key based on the initial character string and a preset key generating rule comprises the following steps:
determining a key length based on the length of the initial string;
determining a secret key based on a preset secret key generation rule and the secret key length;
taking the number of the nearest integer upwards which is more than or equal to one fourth of the length of the initial character string as the key length;
wherein, the key generation rule is that randomly selecting N numbers from an integer from 1 to one half of the initial character string length, N being the key length;
Wherein the position exchange operation is carried out on the initial character string based on the secret key, obtaining ciphertext data includes the steps of:
Determining the character exchange position and the character exchange times of the initial character string based on the secret key, determining that two characters to be exchanged in the character exchange position of the initial character string are the position in the initial character string corresponding to each digit in the secret key and the position of the nearest integer which is more than or equal to half of the length of the initial character string and added with the secret key digit for exchange, wherein the position in the initial character string corresponding to each digit refers to the number of digits in the initial character string, and determining the character exchange times of the initial character string as the character exchange times according to the length of the secret key;
performing position exchange operation on the initial character string based on the character exchange position and the character exchange times to obtain ciphertext data;
wherein the storing the key and the ciphertext data as encryption information comprises the steps of:
Associating the ciphertext data with the secret key to form encryption information of the card number and the original password;
Storing the encrypted information;
When decryption is needed, obtaining encryption information, matching the encryption information with a secret key and ciphertext data, and restoring the ciphertext data into a card number and an original password of a plaintext according to the sequence of character strings in the ciphertext data;
The card number and password fusion encryption system comprises a preprocessing module (1), a secret key generation module (2), a ciphertext generation module (3) and an encryption storage module (4), wherein the secret key generation module (2) is connected with the preprocessing module (1), the ciphertext generation module (3) is connected with the secret key generation module (2), and the encryption storage module (4) is connected with the ciphertext generation module (3) and the secret key generation module (2);
The preprocessing module (1) is used for acquiring a card number and an original password, and combining the card number and the original password to form an initial character string;
The key generation module (2) is configured to obtain a key based on the initial character string and a preset key generation rule;
The ciphertext generating module (3) is used for carrying out position exchange operation on the initial character string based on the secret key to obtain ciphertext data;
the encryption storage module (4) is used for storing the secret key and the ciphertext data as encryption information;
The key generation module (2) comprises a key information unit (21) and a key generation unit (22), wherein the key generation unit (22) is connected with the key information unit (21);
-said key information unit (21) for determining a key length based on the length of said initial string;
The key generation unit (22) is configured to determine a key based on a preset key generation rule and the key length;
the ciphertext generating module (3) comprises a ciphertext information unit (31) and a ciphertext generating unit (32), and the ciphertext generating unit (32) is respectively connected with the ciphertext information unit (31);
The ciphertext information unit (31) is configured to determine, based on the key, a character exchange position and a character exchange number of the initial character string, determine that two characters to be exchanged are positions in the initial character string corresponding to each digit in the key and positions in which the nearest integer is taken upwards and the key number is added to the position greater than or equal to one half of the length of the initial character string, where the position in each digit corresponds to the number of digits in the initial character string, and determine that the character exchange number of the initial character string is the number of characters according to the length of the key;
the ciphertext generating unit (32) is used for performing position exchange operation on the initial character string based on the character exchange position and the character exchange times to obtain ciphertext data;
the encryption storage module (4) comprises an association unit (41) and a storage unit (42), and the storage unit (42) is connected with the association unit (41);
the association unit (41) is used for associating the ciphertext data with the secret key to form encryption information of the card number and the original password;
the storage unit (42) is used for storing the encrypted information.
2. A terminal device comprising a memory, a processor and a computer program stored in the memory and capable of running on the processor, characterized in that the processor performs the method according to claim 1 when loading and executing the computer program.
3. A computer readable storage medium having a computer program stored therein, which when loaded and executed by a processor performs the method of claim 1.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210313411.0A CN114726516B (en) | 2022-03-28 | 2022-03-28 | Encryption method for fusing card number and password, terminal equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210313411.0A CN114726516B (en) | 2022-03-28 | 2022-03-28 | Encryption method for fusing card number and password, terminal equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114726516A CN114726516A (en) | 2022-07-08 |
CN114726516B true CN114726516B (en) | 2024-08-30 |
Family
ID=82239647
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210313411.0A Active CN114726516B (en) | 2022-03-28 | 2022-03-28 | Encryption method for fusing card number and password, terminal equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114726516B (en) |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107895105A (en) * | 2017-11-03 | 2018-04-10 | 广东欧珀移动通信有限公司 | A kind of cipher processing method, terminal device and computer-readable recording medium |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN100479452C (en) * | 2003-09-30 | 2009-04-15 | 华为技术有限公司 | Method for security transmission of card number information from IP terminal to soft switch |
CN110011783B (en) * | 2019-03-21 | 2022-02-08 | 南通大学 | Encryption and decryption method for Chinese characters |
CN110457916B (en) * | 2019-07-19 | 2023-04-14 | 平安科技(深圳)有限公司 | Electronic contract encryption method and device and terminal equipment |
-
2022
- 2022-03-28 CN CN202210313411.0A patent/CN114726516B/en active Active
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107895105A (en) * | 2017-11-03 | 2018-04-10 | 广东欧珀移动通信有限公司 | A kind of cipher processing method, terminal device and computer-readable recording medium |
Also Published As
Publication number | Publication date |
---|---|
CN114726516A (en) | 2022-07-08 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109150499B (en) | Method and device for dynamically encrypting data, computer equipment and storage medium | |
US10142107B2 (en) | Token binding using trust module protected keys | |
EP3474209A1 (en) | Storing blockchain private keys in a sim card | |
US9325499B1 (en) | Message encryption and decryption utilizing low-entropy keys | |
US20100299529A1 (en) | Method and system for securing communication | |
US8600048B1 (en) | Format-translating encryption systems | |
CN204360381U (en) | mobile device | |
CN111859435B (en) | Data security processing method and device | |
CN110768784B (en) | Password transmission method, device, computer equipment and storage medium | |
CN111475824A (en) | Data access method, device, equipment and storage medium | |
US8953786B2 (en) | User input based data encryption | |
CN111010266B (en) | Message encryption and decryption, reading and writing method and device, computer equipment and storage medium | |
US20190065759A1 (en) | Method for protecting data | |
US11431489B2 (en) | Encryption processing system and encryption processing method | |
CN116866029B (en) | Random number encryption data transmission method, device, computer equipment and storage medium | |
CN114726516B (en) | Encryption method for fusing card number and password, terminal equipment and storage medium | |
CN115277064B (en) | Data encryption and data decryption methods and devices, electronic equipment and medium | |
US9203607B2 (en) | Keyless challenge and response system | |
CN117134914A (en) | One-time-pad random key stream encryption algorithm and system based on hardware characteristics | |
CN117371005A (en) | Software authorization method, device, computing equipment and dongle medium | |
CN110995437B (en) | ETC system-based user information input method, device, equipment and storage medium | |
CN117795901A (en) | Generating digital signature shares | |
CN114679721A (en) | Mobile phone number encryption method, decryption method and related equipment | |
CN112400295A (en) | Managing central private keys of multiple user devices associated with a single public key | |
CN118233095B (en) | Sensitive information protection method and system |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |