CN110995415A - Encryption algorithm based on MD5 algorithm - Google Patents
Encryption algorithm based on MD5 algorithm Download PDFInfo
- Publication number
- CN110995415A CN110995415A CN201911404233.7A CN201911404233A CN110995415A CN 110995415 A CN110995415 A CN 110995415A CN 201911404233 A CN201911404233 A CN 201911404233A CN 110995415 A CN110995415 A CN 110995415A
- Authority
- CN
- China
- Prior art keywords
- algorithm
- data
- bit
- processing
- encryption
- 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
Links
- 238000012545 processing Methods 0.000 claims abstract description 43
- 238000000034 method Methods 0.000 claims abstract description 26
- 230000000903 blocking effect Effects 0.000 claims abstract description 4
- 238000000638 solvent extraction Methods 0.000 claims description 3
- 238000012805 post-processing Methods 0.000 abstract description 3
- 238000010586 diagram Methods 0.000 description 3
- 238000004891 communication Methods 0.000 description 2
- 230000009466 transformation Effects 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 238000006243 chemical reaction Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000002427 irreversible effect Effects 0.000 description 1
- 238000005457 optimization Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
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/06—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols the encryption apparatus using shift registers or memories for block-wise or stream coding, e.g. DES systems or RC4; Hash functions; Pseudorandom sequence generators
- H04L9/0643—Hash functions, e.g. MD5, SHA, HMAC or f9 MAC
Landscapes
- Engineering & Computer Science (AREA)
- Power Engineering (AREA)
- Computer Security & Cryptography (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Storage Device Security (AREA)
Abstract
The invention particularly relates to an encryption algorithm based on an MD5 algorithm. According to the encryption algorithm based on the MD5 algorithm, the initial data acquisition amount is increased, the initial data processing is carried out, the data is firstly blocked, and the first sub-cycle is carried out; and then carrying out second blocking and second circulation, and processing the result. According to the encryption algorithm based on the MD5 algorithm, the MD5 algorithm circular processing process is optimized, so that the time for encryption is reduced, and the sub-cycle times are reduced; by changing a single cycle into a secondary post-processing cycle, the complexity of encryption is increased.
Description
Technical Field
The invention relates to the technical field of optimization of electric communication and encryption algorithms, in particular to an encryption algorithm based on an MD5 algorithm.
Background
MD5 Message Digest Algorithm (MD5 Message-Digest Algorithm), a widely used cryptographic hash function, may generate a 128-bit (16-byte) hash value (hash value) to ensure the integrity of the Message transmission. The MD5 algorithm was developed in the early 90 s by the computer science laboratory of MIT and the invention of RSA Data Security Inc through the MD2, MD3 and MD4 algorithms.
The MD5 algorithm can convert a "string of bytes" of arbitrary length into a 128-bit large integer, and is an irreversible string transformation algorithm. In other words, even if the skilled person sees the source program and the algorithm description, it is not possible to transform the value of one MD5 algorithm back to the original string, which is mathematically infinite because there are infinite original strings.
A typical application of the MD5 algorithm is to generate a so-called fingerprint (fingerprint) for a piece of information string (Message) to prevent "tampering". For example, a technician writes a session in a text file, generates and records a value of the MD5 algorithm for the text file, and then propagates the file to others who, if modifying any of the contents of the file, will find the file modified by the technician when recalculating the MD5 value for the file. The MD5 algorithm also prevents "repudiation" of the document author if there is a third party certification authority, a so-called digital signature application.
The MD5 algorithm is also widely used in encryption and decryption technology, and in many operating systems, the user's password is stored as an MD5 value (or similar other algorithm), and when the user logs in, the system calculates the password input by the user as an MD5 value and then compares the value with the MD5 value stored in the system, and the system does not "know" what the user's password is.
The principle of the MD5 algorithm can be briefly described as: the MD5 code processes incoming information in 512-bit packets, each of which is divided into 16 32-bit sub-packets, and after a series of processing, the output of the algorithm consists of four 32-bit packets, which are concatenated to produce a 128-bit hash value.
The overall flow of the MD5 algorithm is shown in fig. 1, and each operation is performed by the 128-bit result value of the previous round and the current 512-bit value.
In the basic cycle processing process of the MD5 algorithm, 4 standard values are given, the output of the previous time is the input of the next time, and the given data is repeatedly designated times in an addition and transformation mode according to the corresponding algorithm, so that the encryption purpose is achieved. The MD5 algorithm is a single basic cycle process, as shown in fig. 2.
The MD5 algorithm basic cycle processing process is used for preparing required data, and comprises the following steps:
(1)4 constants: 0x67452301 for a, 0x0EFCDAB89 for B, 0x98BADCFE for C, 0x10325476 for D;
(2)4 functions: f (X, Y, Z) ═ X & Y) | ((-X) & Z); g (X, Y, Z) ═ X & Z | (Y & (∼ Z)); h (X, Y, Z) ═ X ^ Y ^ Z; i (X, Y, Z) ═ Y ^ (X | (-Z));
the message is divided into 512 bits to be processed into packets, each packet is subjected to 4 rounds of conversion, the 4 constants are used as initial variables for calculation, 4 variables are output again, the 4 variables are used for carrying out the operation of the next packet, and if the packet is the last packet, the 4 variables are the final result, namely the MD5 value.
Based on the situation, the invention provides an encryption algorithm based on the MD5 algorithm aiming at the problems of multiple loop times and long encryption time of the MD5 algorithm. The method aims to reduce the time used for encryption and improve the complexity of encryption by optimizing the MD5 algorithm circular processing process.
Disclosure of Invention
In order to make up for the defects of the prior art, the invention provides a simple and efficient encryption algorithm based on the MD5 algorithm.
The invention is realized by the following technical scheme:
an encryption algorithm based on the MD5 algorithm, characterized in that: the method comprises the following steps:
first, increase the initial acquisition data volume
Taking the remainder of 1024 in the original text processing process, filling the original text, and obtaining the information with the length of 1024 × N +896 after filling;
second, data initial processing
The information length after the data initial processing is 1024 x (N +1), and then the 1024-bit data is changed into 256-bit data by using a hash algorithm;
thirdly, partitioning the data, and performing a first sub-cycle;
and fourthly, performing second blocking and second circulation, and processing the result.
In the first step, the 1024 bits are left in the original text processing process, and if the result is not 896 bits, the original text is filled; the method of padding is that the first bit is padded with 1 and the rest of the bits are padded with 0.
In the second step, the true length of the original text is recorded by using the remaining positions (1024-.
In the third step, the MD5 algorithm is used to perform primary encryption processing on the 256-bit data obtained by the haar algorithm in the second step, so as to obtain 256-bit encrypted data.
Dividing the 256-bit data obtained by the Hash algorithm in the second step into 4 groups, wherein each group has 64 bits, taking 16 bits of each of four initial values, processing each group according to the processing process of the MD5 algorithm to obtain 4 64-bit data, and then splicing the 4 groups to obtain 256-bit encrypted data.
In the fourth step, the MD5 algorithm is used to perform secondary encryption processing on the 256-bit encrypted data, so as to obtain the final data.
Dividing 256-bit encrypted data into 4 groups of 32-bit initial values, continuously processing according to the MD5 processing process to obtain final data, and integrating the final data to form a character string.
The cycle number of the main cycle is M/1024, wherein M is the length of the processed original text; each cycle contains 64/16 × 4+256/32 × 2 ═ 32 subcycles.
The invention has the beneficial effects that: according to the encryption algorithm based on the MD5 algorithm, the MD5 algorithm circular processing process is optimized, so that the time for encryption is reduced, and the sub-cycle times are reduced; by changing a single cycle into a secondary post-processing cycle, the complexity of encryption is increased.
Drawings
Fig. 1 is a general flow chart diagram of the MD5 algorithm.
FIG. 2 is a schematic diagram of a single basic cycle processing of the MD5 algorithm.
Fig. 3 is a schematic diagram of an encryption algorithm based on the MD5 algorithm.
Detailed Description
In order to make the technical problems, technical solutions and advantageous effects to be solved by the present invention more apparent, the present invention is described in detail below with reference to the embodiments. It should be noted that the specific embodiments described herein are only for explaining the present invention and are not used to limit the present invention.
The encryption algorithm based on the MD5 algorithm comprises the following steps:
first, increase the initial acquisition data volume
Taking the remainder of 1024 in the original text processing process, filling the original text, and obtaining the information with the length of 1024 × N +896 after filling;
second, data initial processing
The information length after the data initial processing is 1024 x (N +1), and then the 1024-bit data is changed into 256-bit data by using a hash algorithm;
thirdly, partitioning the data, and performing a first sub-cycle;
and fourthly, performing second blocking and second circulation, and processing the result.
In the first step, the 1024 bits are left in the original text processing process, and if the result is not 896 bits, the original text is filled; the method of padding is that the first bit is padded with 1 and the rest of the bits are padded with 0.
In the second step, the true length of the original text is recorded by using the remaining positions (1024-.
In the third step, the MD5 algorithm is used to perform primary encryption processing on the 256-bit data obtained by the haar algorithm in the second step, so as to obtain 256-bit encrypted data.
Dividing the 256-bit data obtained by the Hash algorithm in the second step into 4 groups, wherein each group has 64 bits, taking 16 bits of each of four initial values, processing each group according to the processing process of the MD5 algorithm to obtain 4 64-bit data, and then splicing the 4 groups to obtain 256-bit encrypted data.
In the fourth step, the MD5 algorithm is used to perform secondary encryption processing on the 256-bit encrypted data, so as to obtain the final data.
Dividing 256-bit encrypted data into 4 groups of 32-bit initial values, continuously processing according to the MD5 processing process to obtain final data, and integrating the final data to form a character string.
The cycle number of the main cycle is M/1024, wherein M is the length of the processed original text; each cycle contains 64/16 × 4+256/32 × 2 ═ 32 subcycles.
Compared with the prior art, the encryption algorithm based on the MD5 algorithm has the following characteristics:
firstly, the MD5 algorithm circular processing process is optimized, so that the time for encryption is reduced, and the sub-cycle times are reduced;
secondly, by changing a single cycle into a secondary post-processing cycle, the complexity of encryption is improved, thereby further ensuring the data security in the process of electric communication.
The above-described embodiment is only one specific embodiment of the present invention, and general changes and substitutions by those skilled in the art within the technical scope of the present invention are included in the protection scope of the present invention.
Claims (8)
1. An encryption algorithm based on the MD5 algorithm, which is characterized by comprising the following steps:
first, increase the initial acquisition data volume
Taking the remainder of 1024 in the original text processing process, filling the original text, and obtaining the information with the length of 1024 × N +896 after filling;
second, data initial processing
The information length after the data initial processing is 1024 x (N +1), and then the 1024-bit data is changed into 256-bit data by using a hash algorithm;
thirdly, partitioning the data, and performing a first sub-cycle;
and fourthly, performing second blocking and second circulation, and processing the result.
2. The MD5 algorithm based encryption algorithm of claim 1, wherein: in the first step, the 1024 bits are left in the original text processing process, and if the result is not 896 bits, the original text is filled; the method of padding is that the first bit is padded with 1 and the rest of the bits are padded with 0.
3. The MD5 algorithm based encryption algorithm of claim 1, wherein: in the second step, the real length of the original text is recorded by using the residual positions, and the binary value of the length is complemented at the end, so that the length of the processed information is 1024 x (N + 1).
4. The MD5 algorithm based encryption algorithm of claim 1, wherein: in the third step, the MD5 algorithm is used to perform primary encryption processing on the 256-bit data obtained by the haar algorithm in the second step, so as to obtain 256-bit encrypted data.
5. The MD5 algorithm-based encryption algorithm of claim 4, wherein: dividing the 256-bit data obtained by the Hash algorithm in the second step into 4 groups, wherein each group has 64 bits, taking 16 bits of each of four initial values, processing each group according to the processing process of the MD5 algorithm to obtain 4 64-bit data, and then splicing the 4 groups to obtain 256-bit encrypted data.
6. The encryption algorithm based on the MD5 algorithm according to claim 1 or 4, wherein: in the fourth step, the MD5 algorithm is used to perform secondary encryption processing on the 256-bit encrypted data, so as to obtain the final data.
7. The MD5 algorithm-based encryption algorithm of claim 6, wherein: dividing 256-bit encrypted data into 4 groups of 32-bit initial values, continuously processing according to the MD5 processing process to obtain final data, and integrating the final data to form a character string.
8. The MD5 algorithm based encryption algorithm of claim 1, wherein: the cycle number of the main cycle is M/1024, wherein M is the length of the processed original text; each cycle contains 64/16 × 4+256/32 × 2 ═ 32 subcycles.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911404233.7A CN110995415A (en) | 2019-12-31 | 2019-12-31 | Encryption algorithm based on MD5 algorithm |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911404233.7A CN110995415A (en) | 2019-12-31 | 2019-12-31 | Encryption algorithm based on MD5 algorithm |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110995415A true CN110995415A (en) | 2020-04-10 |
Family
ID=70079386
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201911404233.7A Pending CN110995415A (en) | 2019-12-31 | 2019-12-31 | Encryption algorithm based on MD5 algorithm |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110995415A (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113572592A (en) * | 2021-06-16 | 2021-10-29 | 昆明理工大学 | Asymmetric key encryption method |
CN114465820A (en) * | 2022-03-31 | 2022-05-10 | 京东方科技集团股份有限公司 | Data encryption method, data encryption device, electronic device, program, and medium |
CN114531284A (en) * | 2022-02-03 | 2022-05-24 | 百果园技术(新加坡)有限公司 | Data encryption method and device, electronic equipment and storage medium |
CN118555141A (en) * | 2024-07-29 | 2024-08-27 | 广东电网有限责任公司佛山供电局 | Data transmission method, electronic equipment and computer product of distribution network area |
-
2019
- 2019-12-31 CN CN201911404233.7A patent/CN110995415A/en active Pending
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113572592A (en) * | 2021-06-16 | 2021-10-29 | 昆明理工大学 | Asymmetric key encryption method |
CN114531284A (en) * | 2022-02-03 | 2022-05-24 | 百果园技术(新加坡)有限公司 | Data encryption method and device, electronic equipment and storage medium |
CN114531284B (en) * | 2022-02-03 | 2024-02-09 | 百果园技术(新加坡)有限公司 | Data encryption method, device, electronic equipment and storage medium |
CN114465820A (en) * | 2022-03-31 | 2022-05-10 | 京东方科技集团股份有限公司 | Data encryption method, data encryption device, electronic device, program, and medium |
CN114465820B (en) * | 2022-03-31 | 2024-07-30 | 京东方科技集团股份有限公司 | Data encryption method, data encryption device, electronic device, program, and medium |
CN118555141A (en) * | 2024-07-29 | 2024-08-27 | 广东电网有限责任公司佛山供电局 | Data transmission method, electronic equipment and computer product of distribution network area |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Teh et al. | A chaos-based keyed hash function based on fixed point representation | |
US7054445B2 (en) | Authentication method and schemes for data integrity protection | |
CN110995415A (en) | Encryption algorithm based on MD5 algorithm | |
US5651069A (en) | Software-efficient message authentication | |
US7860241B2 (en) | Simple universal hash for plaintext aware encryption | |
Saraf et al. | Text and image encryption decryption using advanced encryption standard | |
WO2014136386A1 (en) | Tag generation device, tag generation method, and tag generation program | |
RU2638639C1 (en) | Encoder, decoder and method for encoding and encrypting input data | |
KR101989813B1 (en) | Generating and verifying the alternative data in a specified format | |
Seyedzade et al. | A novel image encryption algorithm based on hash function | |
CN112202754A (en) | Data encryption method and device, electronic equipment and storage medium | |
Qi et al. | A hybrid security and compressive sensing-based sensor data gathering scheme | |
CN102946315B (en) | A kind of method and system adopting packet mode to construct MAC code | |
US20210036840A1 (en) | Enhanced randomness for digital systems | |
KR101445339B1 (en) | Integrated cryptographic apparatus for providing confidentiality and integrity | |
CN114239073A (en) | Adaptive encryption method, apparatus, device and medium | |
CN102542070A (en) | Method for structuring one-way Hash function based on random function | |
CN102546159B (en) | Random one-way hash function construction method capable of preventing table check-up attack | |
CN111931194A (en) | Security monitoring big data processing method and device based on cloud computing | |
Hakim et al. | Improving data integrity in communication systems by designing a new security hash algorithm | |
CN114422209A (en) | Data processing method, device and storage medium | |
Sagar | Cryptographic hashing functions-md5 | |
Yap et al. | Security analysis of GCM for communication | |
Karmakar et al. | Varibox encryption algorithm: The new generation of hybrid security measure for the era of quantum computation | |
CN111130768B (en) | Method for quickly generating message digest in lightweight block chain |
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 | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20200410 |