All Products
Search
Document Center

Object Storage Service:hash (Calculate CRC64 or MD5)

Last Updated:Mar 20, 2026

Calculate the MD5 or CRC-64 hash of a local file or an OSS object.

For OSS objects, ossutil retrieves the hash from the server using a HeadObject request, which returns the stored CRC-64 or Content-MD5 value. If the server-side value is not available, ossutil downloads the object and computes the hash locally. Use --download to download the object for hash calculation.

Prerequisites

Before you begin, ensure that you have:

Syntax

ossutil hash md5|crc64 source [flags]

Supported algorithms:

AlgorithmDescription
md5Computes the MD5 hash of the source
crc64Computes the CRC-64 checksum of the source

Flags

FlagTypeDescription
--base64/Encodes the hash output in Base64.
-d, --dirs/Returns objects and subdirectories in the current directory only, without recursing into subdirectories.
--download/Downloads the object before computing the hash locally.
--encoding-typestringEncoding for object names or file names. Valid value: url.
--end-withstringMatches objects whose names are lexicographically before or equal to the specified value.
--excludestringArrayExclusion rule for paths or object names.
--exclude-fromstringArrayReads exclusion rules from a file.
--files-fromstringArrayReads source file names from a file. Ignores empty lines and comment lines.
--files-from-rawstringArrayReads source file names from a file.
--filterstringArrayFilter rule for paths or object names.
--filter-fromstringArrayReads filter rules from a file.
-f, --force/Forces the operation without prompting for confirmation.
--includestringArrayInclusion rule for paths or object names.
--include-fromstringArrayReads inclusion rules from a file.
--limited-numintMaximum number of results to return.
--list-objects/Uses the ListObjects operation to list objects.
--min-ageDurationProcesses only files modified before the specified interval. The default unit is seconds. Supported suffixes: h for hours. For example, --min-age 1h processes files modified 1 hour ago or earlier.
--max-ageDurationProcesses only files modified within the specified interval. The default unit is seconds. For example, --max-age 1h processes files modified within the last hour.
--min-mtimeTimeProcesses only files modified after the specified time. Format: UTC, for example, 2006-01-02T15:04:05.
--max-mtimeTimeProcesses only files modified before the specified time. Format: UTC, for example, 2006-01-02T15:04:05.
--max-sizeSizeSuffixMaximum file size to process. Default unit: bytes (B). Supported suffixes: K (kibibyte), M (mebibyte), G (gibibyte), T (tebibyte), P (pebibyte).
--metadata-excludestringArrayExclusion rule for object metadata.
--metadata-filterstringArrayFilter rule for object metadata.
--metadata-filter-fromstringArrayReads metadata filter rules from a file.
--metadata-includestringArrayInclusion rule for object metadata.
--min-sizeSizeSuffixMinimum file size to process. Default unit: bytes (B). Supported suffixes: same as --max-size.
--page-sizeintMaximum number of objects returned per page. Default: 1000. Valid values: 1–1000.
-r, --recursive/Applies the operation to all matching objects in the bucket. If this option is not specified, the command performs the operation only on the specified object.
--request-payerstringSpecifies the request payer when pay-by-requester is enabled. Valid value: requester.
--start-afterstringReturns objects whose names are alphabetically after the specified value.
For a complete list of global options, see Command-line options.

Examples

Compute the MD5 hash of a local file:

ossutil hash md5 example.txt

Compute the MD5 hash and encode the output in Base64:

ossutil hash md5 example.txt --base64

Compute the CRC-64 checksum of a local file:

ossutil hash crc64 example.txt

Compute MD5 hashes for all files in a local directory:

ossutil hash md5 folder/ -r

Compute MD5 hashes for all files in a local directory, Base64-encoded:

ossutil hash md5 folder/ -r --base64

Compute CRC-64 checksums for all files in a local directory:

ossutil hash crc64 folder/ -r

Compute the MD5 hash of an OSS object:

ossutil hash md5 oss://examplebucket/example.txt