Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2572351
hash.rs
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
498 B
Referenced Files
None
Subscribers
None
hash.rs
View Options
use
macros_rs
::
crashln
;
use
merkle_hash
::{
bytes_to_hex
,
Algorithm
,
MerkleTree
};
use
std
::
path
::
PathBuf
;
pub
fn
create
(
path
:
PathBuf
)
->
String
{
log
::
debug
!
(
"creating hash for {:?}"
,
path
);
let
tree
=
match
MerkleTree
::
builder
(
&
path
.
to_str
().
unwrap
()).
algorithm
(
Algorithm
::
Blake3
).
hash_names
(
false
).
build
()
{
Ok
(
v
)
=>
v
,
Err
(
e
)
=>
crashln
!
(
"Invalid UTF-8 sequence: {}"
,
e
),
};
log
::
trace
!
(
"hash {:?}"
,
tree
.
root
.
item
.
hash
);
bytes_to_hex
(
tree
.
root
.
item
.
hash
)
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Dec 16, 11:55 AM (22 h, 53 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
484958
Default Alt Text
hash.rs (498 B)
Attached To
Mode
rPMC Process Management Controller
Attached
Detach File
Event Timeline
Log In to Comment