title: How to programmatically get the MD5 Checksum of Amazon S3 file using boto
body: <p>Referred Posts:
      <a href="https://stackoverflow.com/questions/8618218/amazon-s3-checksum">Amazon S3 &amp; Checksum</a>, 
      <a href="https://stackoverflow.com/questions/4583967/how-to-encode-md5-sum-into-base64-in-bash">How to encode md5 sum into base64 in BASH</a></p>
  
  <p>I have to download a tar file from S3 bucket with limited access. [ Mostly access permissions given only to download ]</p>
  
  <p>After I download I have to check the md5 check sum of the downloaded file against the MD5-Check Sum of the data present as metadata in S3</p>
  
  <p>I currently use a S3 file browser to manually note the "x-amz-meta-md5" of the content header and validate that value against the computed md5 of the downloaded file.</p>
  
  <p>I would like to know if there is programmatic way using boto to capture the md5 hash value of a S3 file as mentioned as metadata.</p>
  
  <pre><code>from boto.s3.connection import S3Connection
  
  conn = S3Connection(access_key, secret_key)
  bucket=conn.get_bucket("test-bucket")
  rs_keys = bucket.get_all_keys()
  for key_val in rs_keys:
      print key_val, key_val.**HOW_TO_GET_MD5_FROM_METADATA(?)**
  </code></pre>
  
  <p>Please correct if my understanding is wrong. I am looking for a way to capture the header data programmatically</p>