Base64 and 3DES algorithms

Source: Internet
Author: User

BASE64 Encryption Algorithm
Base64 is one of the most common encoding methods for transmitting 8Bit bytes of code on the network, and can be used to pass longer identity information in an HTTP environment. Its advantage is that the algorithm is efficient, the results of the coding is relatively short, but also has a non-readable.

3DES Encryption algorithm

To understand 3DES, you must first understand what des is. Des is a long-standing American encryption standard that works by encrypting or decrypting data in a 8-byte segment, resulting in a 8-byte cipher or plaintext. The computed data is then linked sequentially. It is important to note that since DES encryption decryption requires that the data length must be a multiple of 8 bytes, the data must be populated when the length of the data is insufficient, and the fill algorithm used here may differ slightly depending on the system.

The DES algorithm has two modes of operation, the ECB (electronic dense-mode) and CBC (Ciphertext grouping link mode)

The encryption steps are as follows:

1) First the data is grouped in groups of 8 bytes to get d1d2 ... Dn (data is populated first if the data length is not an integer multiple of 8 bytes)

2) The first set of data D1 and initialization vector i xor result des encryption obtained the first set of ciphertext C1

3) The second set of data D2 with the first set of encryption results C1 or later results des encryption, the second set of ciphertext C2

4) After the data and so on, get CN

5) sequentially connected to c1c2c3 ... The CN is the result of encryption.

Decryption is the inverse of the encryption process, as follows:

1) First the data is grouped in groups of 8 bytes to get c1c2c3 ... Cn

2) After decrypting the first set of data with the initialization vector I to be different or get the first set of plaintext D1 (note: must first decrypt and then XOR)

3) The second set of data C2 after decryption with the first set of ciphertext data or get the second set of data D2

4) and so on, get the DN

5) sequentially connected to d1d2d3 ... The DN is the decryption result.

Note here that the result of decryption is not necessarily our original encrypted data, may also contain your complement, be sure to remove the complement is your original data.

OK, finally let's say 3DES. 3DES is also known as Triple DES, as its name implies is three des algorithm. More secure than the original des,3des. It is a block encryption algorithm based on DES as the basic module, which is designed by combining grouping method. Set Ek () and DK () on behalf of the DES algorithm encryption and decryption process, K for the DES algorithm used by the key, p for plaintext, c for ciphertext, then the process of 3DES encryption decryption can be expressed as:

C=ek3 (Dk2 (EK1 (P)))

P=DK1 (Ek2 (DK3 (C)))

This can be k1=k3, but not k1=k2=k3 (if equal, it becomes DES algorithm)

Base64 and 3DES algorithms

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.