How to decode S3/minio multipart uploads whole file Md5chksum

What is the problem you are having with rclone?

How can I decode the value of the X-Amz-Meta-Md5chksum to a text string?
For example when I copy ubuntu-22.04.3-live-server-amd64.iso I can read in the logs.

...
<7>DEBUG : ubuntu-22.04.3-live-server-amd64.iso: multipart upload starting chunk 407 size 4.561Mi offset 1.982Gi/1.987Gi
<7>DEBUG : ubuntu-22.04.3-live-server-amd64.iso: Multipart upload Etag: c8494bf14c8a3ea7195ccf9d4ef20350-407 OK
<7>DEBUG : ubuntu-22.04.3-live-server-amd64.iso: md5 = 2072007c1d5b504c9a4858240e28e669 OK
<6>INFO  : ubuntu-22.04.3-live-server-amd64.iso: Copied (new)
...

In the MinIO Console I can see: "X-Amz-Meta-Md5chksum" : "IHIAfB1bUEyaSFgkDijmaQ=="

So based on this example my question is how can I decode IHIAfB1bUEyaSFgkDijmaQ== that it's equals 2072007c1d5b504c9a4858240e28e669

Thanks in advance!

IHIAfB1bUEyaSFgkDijmaQ== is base64 encoded hexadecimal string 2072007c1d5b504c9a4858240e28e669

so you need base64<->hex encoder/decoder

you can google countless examples in different programming languages (you have not mentioned how you want to use it) or even online solutions.

e.g. in bash it can be single line:

$ echo "IHIAfB1bUEyaSFgkDijmaQ==" | base64 -d | hexdump -v -e '/1 "%02x" '
2072007c1d5b504c9a4858240e28e669
2 Likes

Thank you very much. I was looking for the "way" in general.

This is one way to do it in Python:

convertsample = "IHIAfB1bUEyaSFgkDijmaQ=="
decoded_bytes = base64.b64decode(convertsample)
hexencoder = codecs.getencoder('hex')
print(hexencoder(decoded_bytes)[0])
1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.