SHA-256 Merkle tree: Difference between revisions
no edit summary
No edit summary |
|||
Line 1:
{{task|Checksums}}
As described in [https://docs.aws.amazon.com/amazonglacier/latest/dev/checksum-calculations.html its documentation], [https://aws.amazon.com/glacier/ Amazon S3 Glacier] requires that all uploaded files come with a checksum computed as a [[wp:Merkle_tree|Merkle Tree]] using [[wp:SHA-2|SHA-256]].
Specifically, the SHA-256 hash is computed for each 1MiB block of the file. And then, starting from the beginning of the file, the raw hashes of consecutive blocks are paired up and concatenated together, and a new hash is computed from each concatenation. Then these are paired up and concatenated and hashed, and the process continues until there is only one hash left, which is the final checksum. The hexadecimal representation of this checksum is the value that must be included with the AWS API call to upload the object (or complete a multipart upload).
Implement this algorithm in your language; you can use the code from the [[SHA-256]] task for the actual hash computations. For better manageability and portability, build
=={{header|Raku}}==
|