Unified · Split
| @@ -77,6 +77,8 @@ All feature toggles are additive. · 76 unmodified lines | |||
| 77 | * **fast-sha1** | 77 | * **fast-sha1** |
| 78 | * a multi-crate implementation that can use hardware acceleration, thus bearing the potential for up to 2Gb/s throughput on | 78 | * a multi-crate implementation that can use hardware acceleration, thus bearing the potential for up to 2Gb/s throughput on |
| 79 | CPUs that support it, like AMD Ryzen or Intel Core i3. | 79 | CPUs that support it, like AMD Ryzen or Intel Core i3. |
| 80 | * **crc32** | ||
| 81 | * provide a proven `crc32` implementation. | ||
| 80 | * _mutually-exclusive_ | 82 | * _mutually-exclusive_ |
| 81 | * **interrupt-handler** | 83 | * **interrupt-handler** |
| 82 | * Listen to interrupts and termination requests and provide long-running operations tooling to allow aborting the input stream. | 84 | * Listen to interrupts and termination requests and provide long-running operations tooling to allow aborting the input stream. |
| @@ -17,6 +17,7 @@ fast-sha1 = ["fastsha1"] · 16 unmodified lines | |||
| 17 | interrupt-handler = ["ctrlc"] | 17 | interrupt-handler = ["ctrlc"] |
| 18 | disable-interrupts = [] | 18 | disable-interrupts = [] |
| 19 | io-pipe = ["bytes"] | 19 | io-pipe = ["bytes"] |
| 20 | crc32 = ["crc"] | ||
| 20 | 21 | ||
| 21 | [[test]] | 22 | [[test]] |
| 22 | name = "parallel" | 23 | name = "parallel" |
| @@ -51,7 +52,7 @@ walkdir = { version = "2.3.1" } # used when parallel is off · 28 unmodified lines | |||
| 51 | 52 | ||
| 52 | # hashing and 'fast-sha1' feature | 53 | # hashing and 'fast-sha1' feature |
| 53 | sha1 = "0.6.0" | 54 | sha1 = "0.6.0" |
| 54 | crc = "1.8.1" | 55 | crc = { version = "1.8.1", optional = true } |
| 55 | fastsha1 = { package = "sha-1", version = "0.9.1", optional = true } | 56 | fastsha1 = { package = "sha-1", version = "0.9.1", optional = true } |
| 56 | 57 | ||
| 57 | # progress | 58 | # progress |
| @@ -55,6 +55,7 @@ pub use _impl::Sha1; · 54 unmodified lines | |||
| 55 | /// When calling this function for the first time, `previous_value` should be `0`. Otherwise it | 55 | /// When calling this function for the first time, `previous_value` should be `0`. Otherwise it |
| 56 | /// should be the previous return value of this function to provide a hash of multiple sequential | 56 | /// should be the previous return value of this function to provide a hash of multiple sequential |
| 57 | /// chunks of `bytes`. | 57 | /// chunks of `bytes`. |
| 58 | #[cfg(feature = "crc32")] | ||
| 58 | pub fn crc32_update(previous_value: u32, bytes: &[u8]) -> u32 { | 59 | pub fn crc32_update(previous_value: u32, bytes: &[u8]) -> u32 { |
| 59 | crc::crc32::update(previous_value, &crc::crc32::IEEE_TABLE, bytes) | 60 | crc::crc32::update(previous_value, &crc::crc32::IEEE_TABLE, bytes) |
| 60 | } | 61 | } |
| @@ -62,6 +63,7 @@ pub fn crc32_update(previous_value: u32, bytes: &[u8]) -> u32 { · 1 unmodified line | |||
| 62 | /// Compute a CRC32 value of the given input `bytes`. | 63 | /// Compute a CRC32 value of the given input `bytes`. |
| 63 | /// | 64 | /// |
| 64 | /// In case multiple chunkes of `bytes` are present, one should use [`crc32_update()`] instead. | 65 | /// In case multiple chunkes of `bytes` are present, one should use [`crc32_update()`] instead. |
| 66 | #[cfg(feature = "crc32")] | ||
| 65 | pub use crc::crc32::checksum_ieee as crc32; | 67 | pub use crc::crc32::checksum_ieee as crc32; |
| 66 | 68 | ||
| 67 | /// Compute the hash of `kind` for the bytes in the file at `path`, hashing only the first `num_bytes_from_start` | 69 | /// Compute the hash of `kind` for the bytes in the file at `path`, hashing only the first `num_bytes_from_start` |
| @@ -32,7 +32,7 @@ required-features = [] · 31 unmodified lines | |||
| 32 | all-features = true | 32 | all-features = true |
| 33 | 33 | ||
| 34 | [dependencies] | 34 | [dependencies] |
| 35 | git-features = { version = "^0.14.0", path = "../git-features" } | 35 | git-features = { version = "^0.14.0", path = "../git-features", features = ["crc32"] } |
| 36 | git-hash = { version = "^0.3.0", path = "../git-hash" } | 36 | git-hash = { version = "^0.3.0", path = "../git-hash" } |
| 37 | git-object = { version = "^0.10.0", path = "../git-object" } | 37 | git-object = { version = "^0.10.0", path = "../git-object" } |
| 38 | git-traverse = { version = "^0.3", path = "../git-traverse" } | 38 | git-traverse = { version = "^0.3", path = "../git-traverse" } |