Не подтверждена Коммит c99f0249 создал по автору Fangdun Tsai's avatar Fangdun Tsai Зафиксировано автором GitHub
Просмотр файлов

fix(native): needless borrows for generic args (#6039)

владелец 3aba2d22
...@@ -45,7 +45,7 @@ impl Stamp { ...@@ -45,7 +45,7 @@ impl Stamp {
// check challenge // check challenge
let mut hasher = Sha3_256::new(); let mut hasher = Sha3_256::new();
hasher.update(&self.format().as_bytes()); hasher.update(self.format().as_bytes());
let result = format!("{:x}", hasher.finalize()); let result = format!("{:x}", hasher.finalize());
result[..hex_digits] == String::from_utf8(vec![b'0'; hex_digits]).unwrap() result[..hex_digits] == String::from_utf8(vec![b'0'; hex_digits]).unwrap()
} else { } else {
...@@ -87,7 +87,7 @@ impl Stamp { ...@@ -87,7 +87,7 @@ impl Stamp {
let hex_digits = ((bits as f32) / 4.).ceil() as usize; let hex_digits = ((bits as f32) / 4.).ceil() as usize;
let zeros = String::from_utf8(vec![b'0'; hex_digits]).unwrap(); let zeros = String::from_utf8(vec![b'0'; hex_digits]).unwrap();
loop { loop {
hasher.update(&format!("{}:{:x}", challenge, counter).as_bytes()); hasher.update(format!("{}:{:x}", challenge, counter).as_bytes());
let result = format!("{:x}", hasher.finalize_reset()); let result = format!("{:x}", hasher.finalize_reset());
if result[..hex_digits] == zeros { if result[..hex_digits] == zeros {
break format!("{:x}", counter); break format!("{:x}", counter);
......
Поддерживает Markdown
0% или .
You are about to add 0 people to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Пожалуйста, зарегистрируйтесь или чтобы прокомментировать