azure Blob MD5 校验和与本地 MD5 校验和不匹配

azure Blob MD5 checksum and local MD5 checksum not matching

我的文件 test.txt 包含

checksum test file

当我上传到 blob 时,它的 md5 是

CONTENT-MD5 cvL65GNcvWFoqZUTI5oscw==

当我运行在本地md5Sum test.txt它的值是

72f2fae4635cbd6168a99513239a2c73

如评论中所述。来自 here 的解决方案:

Googled around and found a suggestion to use openssl dgst, and it worked!

openssl dgst -md5 -binary $filename | base64

Turns out, md5sum returns a hex representation of the hash and I had to unhex it before computing its base64:

md5sum --binary $filename | awk '{print }' | xxd -p -r | base64