Comparison Study of Commonly Used Encryption Algorithms

Source: Diao Si Java Programmer (ID: java_diaosi)

Information encryption technology utilizes mathematical or physical means to protect electronic information during transmission and storage to prevent leakage. Due to the illegal copying of computer software, communication leaks, and threats to data security, issues of decryption and piracy have become increasingly severe, even leading to international disputes. Therefore, encryption technology occupies an irreplaceable position in information security technology, and research and development of information encryption technology and methods have received significant attention from the global computer community, evolving rapidly. This article compares several commonly used encryption algorithms.

1. DES

The DES algorithm was developed by IBM and was established as the U.S. Federal Information Processing Standard in 1977. It is a block cipher that encrypts data in 64-bit blocks, with a key length of 56 bits (with every 8th bit used for parity). The same algorithm is used for both encryption and decryption. The DES algorithm keeps the key secret while the algorithm itself, including the encryption and decryption processes, is public. Thus, only those who possess the same key as the sender can decrypt the ciphertext generated by the DES algorithm. Therefore, breaking the DES algorithm essentially involves searching for the key. For a 56-bit key, if exhaustive search is used, the number of operations required is 2^56. With the continuous advancement of computer system capabilities, the security of DES is much weaker than when it first appeared; however, from a practical standpoint, it can still be considered sufficient. Nevertheless, DES is now only used for authentication in legacy systems, with newer encryption standards like the Advanced Encryption Standard (AES) being preferred.

2. AES

The Advanced Encryption Standard (AES), also known as Rijndael, was designed by Belgian cryptographers Joan Daemen and Vincent Rijmen, combining their names to form Rijndael. This algorithm employs a symmetric block cipher system, supporting key lengths of at least 128, 192, and 256 bits, with a block length of 128 bits. The algorithm is designed to be easily implemented in various hardware and software. AES is the block encryption standard adopted by the U.S. federal government, replacing the original DES, and has been widely analyzed and used globally. The AES algorithm is designed to support data block sizes of 128/192/256 bits (/32=Nb) and key lengths of 128/192/256 bits (/32=Nk), corresponding to 3.4 x 10^38, 6.2 x 10^57, and 1.1 x 10^77 keys in decimal.

3. RSA

RSA is currently the most influential public key encryption algorithm and is widely regarded as one of the best public key schemes available. RSA is the first algorithm that can be used for both encryption and digital signatures, capable of resisting all known cryptographic attacks to date, and has been recommended by ISO as a public key data encryption standard. The RSA algorithm is based on a very simple number theory fact: multiplying two large prime numbers is easy, but factoring their product is extremely difficult, allowing the product to be made public as the encryption key.

4. BASE64

Base64 is one of the most common encoding methods used on the internet for transmitting 8-bit byte codes. Base64 encoding can be used to transmit longer identification information in an HTTP environment. For example, in the Java Persistence framework Hibernate, Base64 is used to encode a long unique identifier (typically a 128-bit UUID) into a string for use as parameters in HTTP forms and HTTP GET URLs. In other applications, binary data often needs to be encoded into a format suitable for placement in URLs (including hidden form fields). In this case, using Base64 encoding not only results in a shorter representation but also provides obfuscation, meaning the encoded data cannot be directly viewed by the naked eye. The rules for this encoding are: 1) convert 3 characters into 4 characters; 2) add a newline character every 76 characters; 3) handle the final terminator as well.

5. MD5

The Message Digest Algorithm 5 (MD5) is a widely used hash function in computer security, providing message integrity protection. A brief description of the MD5 algorithm is as follows: MD5 processes input information in 512-bit blocks, with each block divided into 16 sub-blocks of 32 bits. After a series of processing, the algorithm outputs four 32-bit blocks, which are concatenated to generate a 128-bit hash value. MD5 is widely used for password authentication and key identification in various software applications. MD5 uses a hash function, and its typical application is to generate a message digest (fingerprint) from a piece of information to prevent tampering. If a third-party certification authority uses MD5, it can also prevent the denial of the file’s author, which is known as a digital signature application. MD5 is also widely used for login authentication in operating systems, such as Unix and various BSD systems.

6. SHA1

SHA1 (Secure Hash Algorithm) is a message digest algorithm as popular as MD5. In 1995, the Federal Information Processing Standards (FIPS) published FIPS PUB 180-1 as a secure hash standard. The algorithm defined in 180-1 is known as Secure Hash Algorithm 1 (SHA1), developed by the National Institute of Standards and Technology (NIST) and the National Security Agency (NSA). The SHA1 algorithm mimics the MD4 algorithm, and there is now an updated draft of SHA1, FIPS PUB 180-2. SHA1 is designed to be used with the Digital Signature Algorithm (DSA) and is primarily applicable to the Digital Signature Standard (DSS). For messages shorter than 2^64 bits, SHA1 produces a 160-bit message digest. When a message is received, this message digest can be used to verify data integrity. During transmission, data may change, resulting in a different message digest. SHA1 cannot restore information from the message digest, and two different messages will not produce the same message digest. Thus, SHA1 can verify data integrity, making it a technology to ensure file integrity.

SHA1 can accept data inputs of up to 2^64 bits and produce a 160-bit digest. The input is divided into 512-bit blocks and processed individually. A 160-bit buffer is used to store intermediate and final results of the hash function, represented by five 32-bit registers (A, B, C, D, and E).

SHA1 is a more secure algorithm than MD5. In theory, any digital verification algorithm that uses message digest methods is susceptible to collisions, meaning two different items can yield the same message digest, which is a method of cheating. However, it is difficult to find a collision for a specified data set with a high-security algorithm, and calculating a collision using formulas is even more challenging. To date, only MD5 has been broken among commonly used secure algorithms.

Cryptographic algorithms are the core of cryptographic technology. The above-mentioned algorithms are commonly used encryption algorithms, some of which have been broken, some have low security, some have unclear strength, some require further analysis, and some need in-depth research. The mysterious world of cryptographic algorithms will continue to see new members join, and we look forward to the birth of more secure algorithms.

Leave a Comment