Come from:http://blog.csdn.net/lonelyroamer/article/details/7630594
I. Overview
The MAC algorithm combines the advantages of the MD5 and Sha algorithms and joins the key support, which is a more secure message digest algorithm.
MAC (Message
Ah, a little bit of comment, too lazy to introduce, put a code bar, to understand the effect can be.1 PackageJdbc.pro.lin;2 3 Importjava.security.InvalidKeyException;4 Importjava.security.MessageDigest;5 Importjava.security.NoSuchAlgorithmException;
Two common encryption methods on the Web: MD5 and sha512.Here are two methods to use.
The following two spaces of. NET are required.Using system. TextUsing system. Security. Cryptography
1 MD5(Without a key, the MD5 encryption results for any
MAC (Message authentication code, messaging authentication Code algorithm) is a key hash function algorithm that is compatible with the features of the MD and SHA algorithms, and the key is added on this basis. Therefore, the Mac is also called an
Message Digest also known as data fingerprint, mainly used for data integrity check, such as when you download a jar package in Apache, in addition to the download list will provide a download link, but also provide the MD5 summary value, when you
MAC (Message authentication code, messaging authentication Code algorithm) is a key hash function algorithm that is compatible with the features of the MD and SHA algorithms, and adds a key on this basis. So Mac algorithms are often called HMAC
The HMAC (hash message authentication code) hashes the authorization code, which encrypts the message digest using a key based on the Message digest algorithm (for example, the Md5,sha Series algorithm). It is equivalent to a vest, inside can use MD5
Use of HMAC
The HMAC algorithm is mainly used for authentication, as follows:
1. The client issues
a login request 2. The server returns a random value, which is stored in the session record
3. The client uses the random value as the
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.