Hash, MAC和Digital Signature的区别

最近在研究security的时候被这几个概念混淆了,上网找到一段内容,Mark一下,原文链接如下:

http://www.davidlprowse.com/article-mac-hashes-digsig.php


First let's give a short description of each:

- Cryptographic hash functions: This is a procedure that calculates a fixed-size bit string (hash value) from a piece of data. If the data is changed while it is in storage or in transit, the hash value will also be changed. This allows a person to verify whether the data has been tampered with. often, the data will be called the "message", and the hash value will be called the "message digest" or "digest".
An example would be to take basic text as data, such as the sentence "Study hard for the Security+ exam!" and calculate a hash from that data. The hash will be different every time it is calculated, but a typical example of the hash output would be:

8FD8 6CD1 CBE2 18DE AEFE
1799 76B1 79A9 B121 BCF8

When a file is downloaded from a website, the file can be checked against the hash (for example an MD5 or SHA-1 hash) that is often listed next to the file download link. If the original hash and the downloaded file's hash are the same, you can be fairly sure the data hasn't been tampered with. If they are not the same, the downloaded file should be discarded as it has probably been compromised. Cryptographic hash functions can be used in conjunction with digital signatures and MACs as well.

- Digital Signatures: These are mathematical processes for proving the authenticity of a document or message. A proper digital signatureimplies that the message or document was created by the actual sender and not someone else. They are commonly used to prove that an electronic signature (a person's actual signature performed on the computer) is authentic. They use asymmetric cryptography.

- MAC (Message authentication code): This is a small piece of information used to authenticate a message. The MAC algorithm takes a message and secret key and outputs a MAC value or "tag". MACs only use secret keys, and rely on symmetric encryption. However, to function as intended the MAC must be able to resist plaintext attacks even if a hacker knows the secret key. Although the hacker can create their own MACs from the key, the MAC algorithm must be strong enough to make it impossible for the hacker to calculate the MAC for other messages. MACs can be built from hash functions; these are known as keyed hash functions.

Now, let's cite some of the differences between the three:

- A MAC can be a cryptographic hash function (as in keyed hash functions), but a cryptographic hash function is not always a MAC.

- Digital signatures can be used in conjunction with cryptographic hash functions (as in SHA-1 and the Digital Signature Algorithm), but a cryptographic hash function is not always a digital signature.

- Digital signatures utilize asymmetric cryptography, whereas MACs use symmetric cryptography.

- Digital signatures provide for non-repudiation, whereas MACs do not, and cryptographic hash functions usually do not.

- MACs require additional security requirements than cryptographic hash functions, for example, the MAC must be resistant to plaintext attacks.


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值