如何得到一个文件的md5sum在Amazon的S3 [英] How to get the md5sum of a file on Amazon's S3

查看:806
本文介绍了如何得到一个文件的md5sum在Amazon的S3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我有Amazon的S3现有文件,是什么让他们的md5sum无需下载的文件,最简单的方法?

If I have existing files on Amazon's S3, what's the easiest way to get their md5sum without having to download the files?

感谢

推荐答案

嗯......我想你可以看看ETag头。 (在这种情况下,你可以使用HTTP HEAD 的方法,而不是GET)。它们不相当明确说出来,但几乎可以肯定的亚马逊使用MD5哈希值的ETag。从 PUT对象文档(说不上为什么他们不只是来的权利,说出来):

Hmm... I think you can look at the ETag header. (in which case you can use the HTTP HEAD method rather than GET.) They don't quite say it explicitly, but it's almost certain Amazon uses MD5 hash for the ETag. From the PUT Object documentation (dunno why they don't just come right out and say it):

要确保数据不被损坏通过网络,使用Content-MD5标头。当您使用Content-MD5标头,Amazon S3的检查对所提供的MD5值的对象。如果它们不匹配,亚马逊S3返回一个错误。此外,可以计算出MD5,同时把一个对象到Amazon S3和比较返回的Etag的计算出的MD5值。

To ensure data is not corrupted over the network, use the Content-MD5 header. When you use the Content-MD5 header, Amazon S3 checks the object against the provided MD5 value. If they do not match, Amazon S3 returns an error. Additionally, you can calculate the MD5 while putting an object to Amazon S3 and compare the returned Etag to the calculated MD5 value.

此外, SOAP方法让你要求只是元数据,而不是数据本身。

Also, the SOAP methods let you request just the metadata and not the data itself.

这篇关于如何得到一个文件的md5sum在Amazon的S3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆