# 数学代写|密码学代写cryptography theory代考|CS6260

## 数学代写|密码学代写cryptography theory代考|Merkle-Damgard

Before we delve into specific hashing algorithms, it is worthwhile to examine a function that is key to many commonly used cryptographic hashes. A MerkleDamgard function (also called a Merkle-Damgard construction) is a method for building hash functions (Backes et al. 2012). Merkle-Damgard functions form the basis for MD5, SHA1, SHA2, and other hashing algorithms. This function was first described in Ralph Merkle’s doctoral dissertation published in 1979.

The function starts by applying some padding function to create an output that is of some particular size (256-bits, 512-bits, 1024-bits, etc.) (Backes et al. 2012). The specific size will vary from one algorithm to another, but 512 -bits is a common size that many algorithms use. The function then processes blocks one at a time, combining the new block of input with the block from the previous round (recall our trivial hashing algorithm that takes output from one block and combines it with the next). Put another way if you have a 1024-bit message that you break into four 256-bit blocks. Block 1 will be processed, then its output is combined with block 2 before block 2 is processed. Then that output is combined with block 3 before it is processed. And finally, that output is combined with block 4 before that block is processed. Thus, Merkle-Damgard is often referred to as a compression function as it compresses all the message into a single output block. The algorithm will start with some initial value, or initialization vector that is specific to the implementation. The final message block is always padded to the appropriate size (256-bits, 512-bits, etc.) and includes a 64-bit integer that indicates the size of the original message.

## 数学代写|密码学代写cryptography theory代考|MAC and HMAC

As we have previously discussed, hashing algorithms are often used to ensure message integrity. If a message is altered in transit, the recipient can compare the hash they received against the hash they computer and detect the error in transmission. But what about intentional alteration of messages? What happens if someone alters the message intentionally, deletes the original hash, and re-computes a new one? Unfortunately, a simple hashing algorithm cannot account for this scenario.
A Message Authentication Code (or MAC) is one way to detect intentionally alterations in a message. A MAC is also often called a keyed cryptographic hash function. That name should tell you how this works. One way to do this is the HMAC or Hashing Message Authentication Code. Let us assume you are using MD5 to verify message integrity. To detect an intercepting party intentionally altering a message, both the sender and recipient must previously exchange a key of the appropriate size (in this case 128 bits). The sender will hash the message, then XOR that hash with this key. The recipient will hash what they receive, and XOR that computed hash with the key. Then the two hashes are exchanged. Should an intercepting party simply re-compute the hash, they will not have the key to XOR that with (and may not even be aware that it should be XOR’d) and thus the hash the interceptor creates won’t match the hash the recipient computes and the interference will be detected (Easttom 2019).

Another common way of accomplishing a MAC is called a CBC-MAC. For this a block cipher is used (any cipher will do) rather than a hash. The algorithm is used in CBC mode. Then only the final block is used for the Message Authentication Code. This can be done with any block cipher you choose. From a practical perspective both MAC’s and HMAC’s are more secure than hashes. The addition of a shared secret key improves the security. Whenever possible, using a MAC or HMAC is preferred overusing just a hash.

# 密码学代考

## 数学代写|密码学代写cryptography theory代考|MAC和HMAC

myassignments-help数学代考价格说明

1、客户需提供物理代考的网址，相关账户，以及课程名称，Textbook等相关资料~客服会根据作业数量和持续时间给您定价~使收费透明，让您清楚的知道您的钱花在什么地方。

2、数学代写一般每篇报价约为600—1000rmb，费用根据持续时间、周作业量、成绩要求有所浮动(持续时间越长约便宜、周作业量越多约贵、成绩要求越高越贵)，报价后价格觉得合适，可以先付一周的款，我们帮你试做，满意后再继续，遇到Fail全额退款。

3、myassignments-help公司所有MATH作业代写服务支持付半款，全款，周付款，周付款一方面方便大家查阅自己的分数，一方面也方便大家资金周转，注意:每周固定周一时先预付下周的定金，不付定金不予继续做。物理代写一次性付清打9.5折。

Math作业代写、数学代写常见问题

myassignments-help擅长领域包含但不是全部: