The hash command is used to calculate the CRC64 or MD5 value of a local file.
--type specifies the algorithm that is used for calculation. Valid values: crc64 and md5. Default value: crc64.
./ossutil hash file_url [--type=hashtype]
- You can run the stat command to view the CRC64 or Content-MD5 value of objects in OSS. The
X-Oss-Hash-Crc64ecmafield indicates the CRC64 value. The
Content-Md5field indicates the MD5 value.
- If the object was uploaded before OSS supports CRC64, the stat command may fail to obtain the CRC64 value.
- The stat command may fail to obtain the Content-MD5 value of objects that are uploaded through append upload or multipart upload.
- If --type is set to md5, the MD5 and Content-MD5 values are displayed at the same time. The Content-MD5 value is obtained by calculating the MD5 hash to obtain a 128-bit number and then encoding the number in Base64.
- The CRC64 value is calculated based on Standard ECMA-182.
- For more information about Content-MD5, see RFC 1864.
- Calculate the CRC64 value of a local file
./ossutil hash test.txt --type=crc64 CRC64-ECMA : 295992936743767023
- Calculate the MD5 value of a local file
./ossutil hash test.txt --type=md5 MD5 : 01C3C45C03B2AF225EFAD9F911A33D73 Content-MD5 : AcPEXAOyryJe+tn5EaM9cw==
The following table describes the options you can add to the hash command.
|--type||Specifies the algorithm that is used for calculation. Valid values: crc64 and md5. Default value: crc64.|
|--loglevel||Specifies the log level. The default value is null, indicating that no log files are
generated. Valid values:
Note For more information about common options, see View all supported options.