azure Blob MD5 checksum and local MD5 checksum not matching

Viewed 856

my file test.txt contains

checksum test file

when I upload into blob its md5 is

CONTENT-MD5 cvL65GNcvWFoqZUTI5oscw==

when I run in local md5Sum test.txt its value is

72f2fae4635cbd6168a99513239a2c73

1 Answers

As discussed in the comments. Solution from 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 $1}' | xxd -p -r | base64

Related