Replace some checksums where it makes sense
This commit is contained in:
parent
e8e4418ca7
commit
6e6f7e8555
@ -141,7 +141,7 @@ impl Status {
|
|||||||
writeln!(&mut nodes_txt, "{} {}", hex::encode(&id), status.addr).unwrap();
|
writeln!(&mut nodes_txt, "{} {}", hex::encode(&id), status.addr).unwrap();
|
||||||
}
|
}
|
||||||
debug!("END --");
|
debug!("END --");
|
||||||
self.hash = sha256sum(nodes_txt.as_bytes());
|
self.hash = blake2sum(nodes_txt.as_bytes());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ impl TableFullReplication {
|
|||||||
|
|
||||||
let mut nodes = vec![];
|
let mut nodes = vec![];
|
||||||
for (node, _) in ring.config.members.iter() {
|
for (node, _) in ring.config.members.iter() {
|
||||||
let node_ranking = sha256sum(&[node.as_slice(), my_id.as_slice()].concat());
|
let node_ranking = fasthash(&[node.as_slice(), my_id.as_slice()].concat());
|
||||||
nodes.push((*node, node_ranking));
|
nodes.push((*node, node_ranking));
|
||||||
}
|
}
|
||||||
nodes.sort_by(|(_, rank1), (_, rank2)| rank1.cmp(rank2));
|
nodes.sort_by(|(_, rank1), (_, rank2)| rank1.cmp(rank2));
|
||||||
@ -54,6 +54,7 @@ impl TableFullReplication {
|
|||||||
.filter(|node| *node != my_id)
|
.filter(|node| *node != my_id)
|
||||||
.take(self.write_factor)
|
.take(self.write_factor)
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
neighbors.push(my_id);
|
neighbors.push(my_id);
|
||||||
self.neighbors.swap(Some(Arc::new(Neighbors {
|
self.neighbors.swap(Some(Arc::new(Neighbors {
|
||||||
ring,
|
ring,
|
||||||
|
@ -322,7 +322,7 @@ where
|
|||||||
.range(range.begin.clone()..range.end.clone())
|
.range(range.begin.clone()..range.end.clone())
|
||||||
{
|
{
|
||||||
let (key, value) = item?;
|
let (key, value) = item?;
|
||||||
let key_hash = sha256sum(&key[..]);
|
let key_hash = blake2sum(&key[..]);
|
||||||
if children.len() > 0
|
if children.len() > 0
|
||||||
&& key_hash.as_slice()[0..range.level]
|
&& key_hash.as_slice()[0..range.level]
|
||||||
.iter()
|
.iter()
|
||||||
@ -340,7 +340,7 @@ where
|
|||||||
end: vec![],
|
end: vec![],
|
||||||
level: 0,
|
level: 0,
|
||||||
};
|
};
|
||||||
children.push((item_range, sha256sum(&value[..])));
|
children.push((item_range, blake2sum(&value[..])));
|
||||||
}
|
}
|
||||||
Ok(RangeChecksum {
|
Ok(RangeChecksum {
|
||||||
bounds: range.clone(),
|
bounds: range.clone(),
|
||||||
@ -378,7 +378,7 @@ where
|
|||||||
}
|
}
|
||||||
let found_limit = sub_ck.found_limit.unwrap();
|
let found_limit = sub_ck.found_limit.unwrap();
|
||||||
|
|
||||||
let actual_limit_hash = sha256sum(&found_limit[..]);
|
let actual_limit_hash = blake2sum(&found_limit[..]);
|
||||||
if actual_limit_hash.as_slice()[0..range.level]
|
if actual_limit_hash.as_slice()[0..range.level]
|
||||||
.iter()
|
.iter()
|
||||||
.all(|x| *x == 0u8)
|
.all(|x| *x == 0u8)
|
||||||
@ -426,7 +426,7 @@ where
|
|||||||
);
|
);
|
||||||
|
|
||||||
let hash = if v.children.len() > 0 {
|
let hash = if v.children.len() > 0 {
|
||||||
Some(sha256sum(&rmp_to_vec_all_named(&v)?[..]))
|
Some(blake2sum(&rmp_to_vec_all_named(&v)?[..]))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user