Changed default sha1 to crypto_hash.

Hopefully it'll be easier to build now. The downside is that it allocates
a small vec on each finish, but it's much faster than rust-sha1 anyway,
at least on ARM (where I'm running rqbit myself).
This commit is contained in:
Igor Katson 2021-10-17 12:03:21 +01:00
parent cbd47c7ba6
commit ebfc20c291
5 changed files with 5 additions and 5 deletions

View file

@ -6,7 +6,7 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[features]
default = ["sha1-openssl"]
default = ["sha1-system"]
sha1-system = ["sha1w/sha1-system"]
sha1-openssl = ["sha1w/sha1-openssl"]
sha1-rust = ["sha1w/sha1-openssl"]

View file

@ -5,7 +5,7 @@ authors = ["Igor Katson <igor.katson@gmail.com>"]
edition = "2018"
[features]
default = ["sha1-openssl"]
default = ["sha1-system"]
sha1-system = ["sha1w/sha1-system"]
sha1-openssl = ["sha1w/sha1-openssl"]
sha1-rust = ["sha1w/sha1-openssl"]

View file

@ -6,7 +6,7 @@ authors = ["Igor Katson <igor.katson@gmail.com>"]
edition = "2018"
[features]
default = ["sha1-openssl"]
default = ["sha1-system"]
sha1-system = ["librqbit/sha1-system"]
sha1-openssl = ["librqbit/sha1-openssl"]
sha1-rust = ["librqbit/sha1-rust"]

View file

@ -6,7 +6,7 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[features]
default = ["sha1-openssl"]
default = ["sha1-system"]
sha1-system = ["crypto-hash"]
sha1-openssl = ["openssl"]
sha1-rust = ["sha1"]

View file

@ -83,7 +83,7 @@ impl ISha1 for Sha1System {
fn finish(mut self) -> [u8; 20] {
let result = self.inner.finish();
assert_eq!(result.len(), 20);
debug_assert_eq!(result.len(), 20);
let mut result_arr = [0u8; 20];
result_arr.copy_from_slice(&result);
result_arr