This topic describes how to run the hash command to calculate the MD5 hash or CRC-64 of a local file.
Sample command lines in this topic are based on the 64-bit Linux system. For other systems, replace ./ossutil64 in the commands with the corresponding binary name. For more information, see ossutil.
Command syntax
./ossutil64 hash localfile [--type=<value>]
The following table describes the parameters that you can configure when you run the hash command.
Parameter | Description |
localfile | The full path of the local file you want to upload. |
--type | The method used to calculate the value of the local file. Default value: crc64. Valid values:
|
After you upload the local file to the specified bucket, take note of the following items when you want to query or use the CRC-64 or MD5 hash:
You can use the
X-Oss-Hash-Crc64ecma
field to query the CRC-64 or theContent-Md5
field in the stat command to query the MD5 hash of the local file. For more information, see stat.If you upload a local file before Object Storage Service (OSS) supports CRC-64, the stat command cannot be run to query the CRC-64 of the local file.
If you upload a local file by using append upload or multipart upload, the stat command cannot be run to query the Content-MD5 value of the local file.
Examples
Calculate the CRC-64 of the
test.txt
local file./ossutil64 hash test.txt --type=crc64 CRC64-ECMA : 295992936743767023
Calculate the MD5 hash of the
test.txt
local file./ossutil64 hash test.txt --type=md5 MD5 : 01C3C45C03B2AF225EFAD9F911A33D73 Content-MD5 : AcPEXAOyryJe+tn5EaM9cw==