Skip to content
Snippets Groups Projects
Commit a4832059 authored by Sébastien Blin's avatar Sébastien Blin Committed by Adrien Béraud
Browse files

infohash: add from_bytes

parent 96df1d43
Branches
Tags
No related merge requests found
......@@ -47,6 +47,14 @@ impl InfoHash {
h
}
pub fn from_bytes(data: &Vec<u8>) -> InfoHash {
let mut h = InfoHash::new();
unsafe {
dht_infohash_get(&mut h, data.as_ptr() as *mut u8, data.len());
}
h
}
pub fn is_zero(&self) -> bool {
unsafe {
dht_infohash_is_zero(self)
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment