Stream: general

Topic: ".crate" file?

Sean Klein (May 03 2020 at 19:11, on Zulip):

I'm working on making some contributions to a Bazel x Cargo project, and basically, there is a need to have a sha256 identifier for crates. Digging around, I noticed that taking the sha256 of a ".crate" file seems to be the standard -- it's mentioned here: -- but I'm having trouble finding more detail on this file format.

Are there other docs / tools I should read up on to see where this value is being generated? Or perhaps how I can dervice this value given a Cargo.toml + Cargo.lock file?

Sean Klein (May 03 2020 at 19:13, on Zulip):

From what I can gather, the ".crate" file exists in my filesystem under $HOME/.cargo/registry/cache/..., supposedly it is a tarball of the package, and the checksum used in registries is a sha256 checksum of that tarball

Sean Klein (May 03 2020 at 19:14, on Zulip):

but I can't find any reference to that value (either the path to the cache, nor the checksum itself) under commands like cargo metadata

Sean Klein (May 03 2020 at 21:13, on Zulip):

Follow-up for anyone else who has seen this: This is the same checksum that's available in the Cargo.lock file. Parsing it from a lock file (via the cargo-lock crate) seems way easier than trying to access the ".crate" file.

nagisa (May 04 2020 at 13:35, on Zulip):

.crate in ~/.cargo is just a cached file downloaded from You can download those directly from

Last update: Jun 05 2020 at 23:20UTC