MCPcopy Create free account
hub / github.com/FrameworkComputer/framework-system / hash

Function hash

framework_lib/src/commandline/mod.rs:2038–2058  ·  view source on GitHub ↗

Useful to hash update files to check integrity

(data: &[u8])

Source from the content-addressed store, hash-verified

2036
2037/// Useful to hash update files to check integrity
2038fn hash(data: &[u8]) {
2039 let mut sha256_hasher = Sha256::new();
2040 let mut sha384_hasher = Sha384::new();
2041 let mut sha512_hasher = Sha512::new();
2042
2043 sha256_hasher.update(data);
2044 sha384_hasher.update(data);
2045 sha512_hasher.update(data);
2046
2047 let sha256 = &sha256_hasher.finalize()[..];
2048 let sha384 = &sha384_hasher.finalize()[..];
2049 let sha512 = &sha512_hasher.finalize()[..];
2050
2051 println!("Hashes");
2052 print!(" SHA256: ");
2053 util::print_buffer(sha256);
2054 print!(" SHA384: ");
2055 util::print_buffer(sha384);
2056 print!(" SHA512: ");
2057 util::print_buffer(sha512);
2058}
2059
2060fn print_board_ids(ec: &CrosEc) {
2061 println!("Board IDs");

Callers 1

run_with_argsFunction · 0.85

Calls 1

print_bufferFunction · 0.85

Tested by

no test coverage detected