Current location - Quotes Website - Signature design - Overview of Android encryption algorithms
Overview of Android encryption algorithms
1. Concept:

Base64 is a method of representing binary data with 64 characters (abcdefghijklmnopkrstuwxyzabcdefghijklmnopkrstuwxyz 0123456789+/), which is just an encoding method. It is not recommended to use Base64 to encrypt data.

2. Place of origin:

Why is there a Base64 code? Because the data in the computer is stored in ascii code, and the values between 128 ~ 255 in ascii code are invisible characters. For example, when exchanging data on the network, every byte of the picture binary stream can't be a visible character, so it can't be transmitted. The best way is to make an extension scheme, which supports the transmission of binary files without changing the traditional protocol, and uses printable characters to represent unprintable characters, so the data is encoded with Base64 first and turned into visible characters to reduce the error rate.

3. Example:

The key used in encryption and decryption is the same. This encryption method is very fast and suitable for frequent data transmission. The disadvantage is that the transmission of keys is troublesome.

1. data encryption standard

DES, known as the data encryption standard, is a block algorithm using key encryption.

DES algorithm turns a 64-bit plaintext input block into a 64-bit ciphertext output block, and the key it uses is also 64 bits. In fact, the key is a plaintext group, and the 56 bits after 56 bits participate in DES operation (the 8th, 16, 24th, 32nd, 40th, 48th, 56th and 64th bits are check bits, so each key has an odd number of 1).

2.3DES

3DES (or triple DES) is a general term for triple data encryption algorithm (TDEA) block cipher. This is an encryption algorithm from DES to AES. It uses three 56-bit keys to encrypt data three times. Is a safer variant of DES. It uses DES as the basic module, and designs a block encryption algorithm by combining the block method. Compared with the original DES, 3DES is more secure.

3. Auger electron spectroscopy

AES, the full name of advanced encryption standard, is one of the most popular symmetric encryption algorithms and a substitute for DES. Supports keys of three lengths: 128 bits, 192 bits and 256 bits.

AES algorithm divides plaintext into independent plaintext blocks, and the length of each plaintext block is 128bit. These plaintext blocks are processed by AES encryptor to generate independent ciphertext blocks, which are spliced together to obtain the final AES encryption result.

But there is a problem involved here: if the length of a plaintext is 192bit, if a plaintext block is split every 128bit, the second plaintext block is only 64 bits, which is less than 128bit. What should I do at this time? It is necessary to fill the plaintext block:

The working mode of AES is embodied in the process of encrypting plaintext blocks into cipher blocks.

The keys used for encryption and decryption are different. This encryption method is constructed by mathematical problems. Usually, the encryption and decryption speed is slow, which is suitable for sending data occasionally. The advantage is convenient key transmission.

1. Stellar time angle

Secure Hash Algorithm (SHA) is a family of cryptographic hash functions, and it is a FIPS certified secure hash algorithm. An algorithm can calculate a fixed-length string (also called message digest) corresponding to a digital message. If the input messages are different, the probability that they correspond to different strings is very high.

SHA can be divided into five algorithms: SHA- 1, SHA-224, SHA-256, SHA-384 and SHA-5 12. The last four algorithms are sometimes called SHA-2. SHA- 1 is widely used in many security protocols, including TLS and SSL, PGP, SSH, S/MIME and IPsec, and was once regarded as the successor of MD5 (a widely used hash function in the early days). However, the security of SHA- 1 is now seriously questioned by cryptographers. Although SHA-2 is not effectively attacked, its algorithm is basically similar to SHA- 1. So some people began to develop other alternative hash algorithms.

2. Republic of South Africa

RSA algorithm appeared in 1978, which is the first algorithm that can be used for data encryption and digital signature at the same time, and it is easy to understand and operate.

RSA is based on a number theory fact: it is very easy to multiply two large prime numbers, but it is extremely difficult to factorize their product, so the product can be disclosed as an encryption key, that is, a public key, and two large prime number arrays can be combined into a private key. The public key can be provided to anyone, and the private key can be decrypted by itself.

3. Message summary 5

MD5 Message-Digest Algorithm (English: MD5 Message-Digest Algorithm) is a widely used cryptographic hash function, which can generate a hash value of 128 bits (16 bytes) to ensure the integrity and consistency of information transmission. Has the following advantages:

XOR: XOR encryption, that is, a character or a numerical value X and a numerical value M are XOR to get Y, and then Y and M are XOR to restore X. ..

Usage scenario:

(1) Interchange of two variables (without the help of the third variable);

(2) Simple encryption and decryption of data.