- NAME
-
- gcloud storage hash - calculates hashes on local or cloud files
- SYNOPSIS
-
-
gcloud storage hashURLS[URLS…] [--additional-headers=HEADER=VALUE] [--hex] [--skip-crc32c|--skip-md5] [--decryption-keys=[DECRYPTION_KEY, …]] [GCLOUD_WIDE_FLAG …]
-
- DESCRIPTION
- Calculates hashes on local or cloud files that can be used to compare with
"gcloud storage ls -L" output. If a specific hash option is not provided, this
command calculates all gcloud storage-supported hashes for the file.
Note that gcloud storage automatically performs hash validation when uploading or downloading files, so this command is only needed if you want to write a script that separately checks the hash for some reason.
If you calculate a CRC32C hash for the file without a precompiled google-crc32c installation, hashing will be very slow.
- EXAMPLES
- To get the MD5 and CRC32C hash digest of a cloud object in Base64 format:
gcloud storage hash gs://bucket/objectTo get just the MD5 hash digest of a local object in hex format:
gcloud storage hash /dir/object.txt --skip-crc32c --hex - POSITIONAL ARGUMENTS
-
-
URLS[URLS…] - Local or cloud URLs of objects to hash.
-
- FLAGS
-
-
--additional-headers=HEADER=VALUE - Includes arbitrary headers in storage API calls. Accepts a comma separated list
of key=value pairs, e.g.
header1=value1,header2=value2. Overrides the defaultstorage/additional_headersproperty value for this command invocation. -
--hex - Output hash digests in hex format. By default, digests are displayed in base64.
- At most one of these can be specified:
-
--skip-crc32c - Skip CRC32C hash calculation. Useful if command is running slow.
-
--skip-md5 - Skip MD5 hash calculation. Useful if command is running slow.
-
-
- ENCRYPTION FLAGS
-
-
--decryption-keys=[DECRYPTION_KEY,…] - A comma-separated list of customer-supplied encryption keys (RFC 4648 section 4 base64-encoded AES256 strings) that will be used to decrypt Cloud Storage objects. Data encrypted with a customer-managed encryption key (CMEK) is decrypted automatically, so CMEKs do not need to be listed here.
-
- GCLOUD WIDE FLAGS
- These flags are available to all commands:
--access-token-file,--account,--billing-project,--configuration,--flags-file,--flatten,--format,--help,--impersonate-service-account,--log-http,--project,--quiet,--trace-token,--user-output-enabled,--verbosity.Run
$ gcloud helpfor details. - NOTES
- This variant is also available:
gcloud alpha storage hash
gcloud storage hash
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-05-27 UTC.

