1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use scsys::prelude::H256;
use std::io::{self, BufRead, BufReader};
pub fn convert_hash_into_binary(hash: &[u8]) -> Vec<u8> {
let mut res: String = String::default();
for c in hash {
res.push_str(&format!("{:b}", c));
}
res.into_bytes()
}
pub fn compute_key_hash(key: Vec<u8>) -> H256 {
key.into()
}
pub fn file_to_vec(filename: String) -> io::Result<Vec<String>> {
let file_in = std::fs::File::open(filename)?;
let file_reader = BufReader::new(file_in);
Ok(file_reader.lines().filter_map(io::Result::ok).collect())
}