MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / sha256

Function sha256

dstack-util/src/utils.rs:18–23  ·  view source on GitHub ↗
(data: &[u8])

Source from the content-addressed store, hash-verified

16}
17
18pub fn sha256(data: &[u8]) -> [u8; 32] {
19 use sha2::Digest;
20 let mut sha256 = sha2::Sha256::new();
21 sha256.update(data);
22 sha256.finalize().into()
23}
24
25pub fn sha256_file(path: impl AsRef<Path>) -> Result<[u8; 32]> {
26 let data = fs::read(path).context("Failed to read file")?;

Callers 6

sha256_fileFunction · 0.70
measure_app_infoMethod · 0.70
get_sealing_keyMethod · 0.70
decode_app_info_exMethod · 0.50
decode_mr_tdx_from_quoteFunction · 0.50
decode_mr_tdxMethod · 0.50

Calls

no outgoing calls

Tested by 3

decode_app_info_exMethod · 0.40
decode_mr_tdx_from_quoteFunction · 0.40
decode_mr_tdxMethod · 0.40