Base64, Des, RSA, sha1, MD5 notes

Source: Internet
Author: User
Tags sha1 asymmetric encryption
ArticleDirectory
    • 1, base64
    • 2. Des and RSA
    • 3. sha1 and MD5
1, base64

Scenario: You want to express a set of binary data as a group of visible characters, which is more conducive to transmission in some cases, such as transmission in emails.

Algorithm: Http://zh.wikipedia.org/wiki/Base64

2. Des and RSA

Scenario: You want to encrypt a set of binary data. For example, if you want to protect your data from being stolen by others, even if they have your encrypted binary data, they still cannot be unlocked without a password.

Algorithm:

Des: http://zh.wikipedia.org/wiki/DES
RSA: http://zh.wikipedia.org/wiki/RSA%E5%8A%A0%E5%AF%86%E6%BC%94%E7% AE %97%E6%B3%95

Differences: Des is symmetric encryption, that is, encryption and decryption use the same key. RSA uses asymmetric encryption, Public Key for encryption, and private key for decryption.

Discussion:

Des can be cracked by brute force attacks. AES is generally used to replace DES encryption.

Because RSA is non-symmetric encryption, you can use the private key to encrypt it and decrypt it with the unique public key. However, this is not the way public encryption works. For details, see:

Http://stackoverflow.com/questions/1181421/is-possible-to-encrypt-with-private-key-using-net-rsacryptoserviceprovider

The real encryption method with the private key is digital signature. That is, you sign a binary stream with a private key. The receiver uses the public key to verify your signature. In this way, you can know the authenticity of the source and anti-repudiation. The specific C # instance can refer to: https://gist.github.com/3991414

3. sha1 and MD5

Scenario: You have a set of binary data. To ensure the integrity of this set of binary data, you want to generate a unique digital signature for this set of binary data.

Algorithm:

Sha1: http://zh.wikipedia.org/wiki/SHA1
MD5: http://zh.wikipedia.org/wiki/MD5

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.