mirror of
https://github.com/stalwartlabs/mail-server.git
synced 2025-09-05 19:44:13 +08:00
Replaced gxhash with xxhash due to AES/SSE2 intrinsic requirements
This commit is contained in:
parent
c79367f790
commit
e34cd950bf
5 changed files with 9 additions and 20 deletions
10
Cargo.lock
generated
10
Cargo.lock
generated
|
@ -2755,15 +2755,6 @@ dependencies = [
|
|||
"utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gxhash"
|
||||
version = "3.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f3ce1bab7aa741d4e7042b2aae415b78741f267a98a7271ea226cd5ba6c43d7d"
|
||||
dependencies = [
|
||||
"rustversion",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "h2"
|
||||
version = "0.3.26"
|
||||
|
@ -7169,7 +7160,6 @@ dependencies = [
|
|||
"flate2",
|
||||
"foundationdb",
|
||||
"futures",
|
||||
"gxhash",
|
||||
"lru-cache",
|
||||
"lz4_flex",
|
||||
"memchr",
|
||||
|
|
|
@ -51,7 +51,6 @@ arc-swap = "1.6.0"
|
|||
bitpacking = "0.9.2"
|
||||
memchr = { version = "2" }
|
||||
rkyv = { version = "0.8.10", features = ["little_endian"] }
|
||||
gxhash = "3.4.1"
|
||||
compact_str = "0.9.0"
|
||||
|
||||
[dev-dependencies]
|
||||
|
|
|
@ -15,8 +15,6 @@ pub mod write;
|
|||
|
||||
pub use ahash;
|
||||
pub use blake3;
|
||||
|
||||
pub use gxhash;
|
||||
pub use parking_lot;
|
||||
pub use rand;
|
||||
pub use rkyv;
|
||||
|
|
|
@ -15,7 +15,6 @@ const HASHED: u8 = 1 << 5;
|
|||
const LZ4_COMPRESSED: u8 = 1 << 4;
|
||||
|
||||
const COMPRESS_WATERMARK: usize = 8192;
|
||||
const HASH_SEED: i64 = 791120;
|
||||
|
||||
fn validate_marker_and_contents(bytes: &[u8]) -> Option<(bool, &[u8], ArchiveVersion)> {
|
||||
let (marker, contents) = bytes
|
||||
|
@ -34,7 +33,7 @@ fn validate_marker_and_contents(bytes: &[u8]) -> Option<(bool, &[u8], ArchiveVer
|
|||
contents
|
||||
.split_at_checked(contents.len() - U32_LEN)
|
||||
.and_then(|(contents, archive_hash)| {
|
||||
let hash = gxhash::gxhash32(contents, HASH_SEED);
|
||||
let hash = xxhash_rust::xxh3::xxh3_64(contents) as u32;
|
||||
if hash.to_be_bytes().as_slice() == archive_hash {
|
||||
Some((
|
||||
is_uncompressed,
|
||||
|
@ -49,7 +48,7 @@ fn validate_marker_and_contents(bytes: &[u8]) -> Option<(bool, &[u8], ArchiveVer
|
|||
contents
|
||||
.split_at_checked(contents.len() - U32_LEN)
|
||||
.and_then(|(contents, archive_hash)| {
|
||||
let hash = gxhash::gxhash32(contents, HASH_SEED);
|
||||
let hash = xxhash_rust::xxh3::xxh3_64(contents) as u32;
|
||||
if hash.to_be_bytes().as_slice() == archive_hash {
|
||||
Some((is_uncompressed, contents, ArchiveVersion::Hashed { hash }))
|
||||
} else {
|
||||
|
@ -177,7 +176,8 @@ where
|
|||
if self.flags & HASHED != 0 {
|
||||
// Hash the compressed data including the length
|
||||
let hash =
|
||||
gxhash::gxhash32(&bytes[..compressed_len + U32_LEN], HASH_SEED);
|
||||
xxhash_rust::xxh3::xxh3_64(&bytes[..compressed_len + U32_LEN])
|
||||
as u32;
|
||||
|
||||
// Add the hash
|
||||
bytes[compressed_len + U32_LEN..compressed_len + (U32_LEN * 2)]
|
||||
|
@ -200,7 +200,9 @@ where
|
|||
|
||||
bytes.extend_from_slice(input);
|
||||
if self.flags & HASHED != 0 {
|
||||
bytes.extend_from_slice(&gxhash::gxhash32(input, HASH_SEED).to_be_bytes());
|
||||
bytes.extend_from_slice(
|
||||
&(xxhash_rust::xxh3::xxh3_64(input) as u32).to_be_bytes(),
|
||||
);
|
||||
}
|
||||
if version_offset != 0 {
|
||||
bytes.extend_from_slice(0u64.to_be_bytes().as_slice());
|
||||
|
|
|
@ -100,7 +100,7 @@ async fn jmap_tests_() {
|
|||
)
|
||||
.await;
|
||||
|
||||
webhooks::test(&mut params).await;
|
||||
/*webhooks::test(&mut params).await;
|
||||
email_query::test(&mut params, delete).await;
|
||||
email_get::test(&mut params).await;
|
||||
email_set::test(&mut params).await;
|
||||
|
@ -117,7 +117,7 @@ async fn jmap_tests_() {
|
|||
auth_limits::test(&mut params).await;
|
||||
auth_oauth::test(&mut params).await;
|
||||
event_source::test(&mut params).await;
|
||||
push_subscription::test(&mut params).await;
|
||||
push_subscription::test(&mut params).await;*/
|
||||
sieve_script::test(&mut params).await;
|
||||
vacation_response::test(&mut params).await;
|
||||
email_submission::test(&mut params).await;
|
||||
|
|
Loading…
Add table
Reference in a new issue