Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2708230
hash.rs
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
541 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
::
info
!
(
"creating hash for {:?}"
,
path
);
let
tree
=
match
MerkleTree
::
builder
(
&
path
.
to_str
().
unwrap
()).
algorithm
(
Algorithm
::
Blake3
).
hash_names
(
false
).
build
()
{
Ok
(
v
)
=>
v
,
// fix issue on post /daemon/create
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
Sun, Feb 1, 9:04 PM (1 d, 18 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
490557
Default Alt Text
hash.rs (541 B)
Attached To
Mode
rPMC Process Management Controller
Attached
Detach File
Event Timeline
Log In to Comment