diff --git a/src/lib.rs b/src/lib.rs index 95ffce224..e5f68b45e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -124,12 +124,12 @@ use xor_name::XorName; pub use bytes; pub use xor_name; -/// The minimum size (before compression) of data to be self-encrypted, defined as 3kiB. +/// The minimum size (before compression) of data to be self-encrypted, defined as 3B. pub const MIN_ENCRYPTABLE_BYTES: usize = 3 * MIN_CHUNK_SIZE; /// The maximum size (before compression) of an individual chunk of a file, defined as 500kiB. pub const MAX_CHUNK_SIZE: usize = 512 * 1024; -/// The minimum size (before compression) of an individual chunk of a file, defined as 1kiB. -pub const MIN_CHUNK_SIZE: usize = 1024; +/// The minimum size (before compression) of an individual chunk of a file, defined as 1B. +pub const MIN_CHUNK_SIZE: usize = 1; /// Controls the compression-speed vs compression-density tradeoffs. The higher the quality, the /// slower the compression. Range is 0 to 11. pub const COMPRESSION_QUALITY: i32 = 6; diff --git a/tests/lib.rs b/tests/lib.rs index c0ff47d57..fca253f97 100644 --- a/tests/lib.rs +++ b/tests/lib.rs @@ -71,8 +71,8 @@ async fn cross_platform_check() -> Result<()> { 145, 206, 168, 75, 176, 141, 46, 197, 1, 83, 199, 165, 37, 28, ]), dst_hash: XorName([ - 91, 220, 23, 234, 225, 117, 102, 56, 66, 156, 244, 221, 200, 200, 209, 201, 243, - 186, 176, 29, 76, 93, 211, 59, 14, 196, 32, 112, 176, 1, 204, 125, + 160, 57, 64, 193, 147, 235, 173, 54, 53, 206, 248, 12, 40, 147, 119, 107, 154, 21, + 50, 57, 151, 18, 151, 0, 95, 157, 103, 220, 160, 79, 248, 85, ]), index: 0, src_size: 0, @@ -295,24 +295,24 @@ async fn cross_platform_check() -> Result<()> { }, ChunkInfo { src_hash: XorName([ - 234, 107, 8, 130, 125, 216, 160, 160, 13, 230, 7, 11, 37, 118, 105, 223, 105, 87, - 90, 209, 211, 79, 27, 158, 16, 167, 235, 67, 91, 131, 251, 172, + 227, 224, 98, 89, 131, 120, 169, 214, 165, 171, 189, 187, 15, 7, 80, 133, 16, 63, + 74, 197, 17, 127, 22, 137, 171, 117, 34, 195, 186, 185, 51, 2, ]), dst_hash: XorName([ - 115, 244, 10, 81, 146, 92, 255, 68, 159, 239, 113, 254, 174, 79, 20, 28, 89, 48, - 192, 18, 78, 92, 61, 129, 26, 243, 119, 250, 119, 18, 168, 130, + 166, 232, 206, 232, 6, 23, 232, 20, 105, 230, 249, 86, 35, 117, 181, 65, 192, 245, + 65, 130, 238, 50, 188, 82, 193, 115, 172, 113, 237, 33, 248, 102, ]), index: 0, src_size: 0, }, ChunkInfo { src_hash: XorName([ - 173, 132, 16, 44, 184, 235, 162, 98, 194, 197, 157, 156, 131, 245, 181, 91, 83, 51, - 15, 204, 124, 193, 209, 249, 155, 19, 89, 201, 64, 247, 95, 73, + 199, 77, 9, 166, 29, 63, 254, 6, 165, 71, 110, 151, 121, 199, 60, 144, 197, 6, 92, + 182, 237, 202, 223, 171, 20, 80, 193, 237, 148, 96, 190, 70, ]), dst_hash: XorName([ - 64, 23, 138, 48, 198, 43, 63, 70, 55, 164, 9, 209, 103, 37, 27, 45, 49, 204, 180, - 86, 179, 79, 240, 178, 148, 160, 184, 252, 32, 102, 123, 216, + 221, 131, 122, 148, 84, 180, 72, 155, 240, 84, 4, 189, 156, 65, 164, 204, 215, 198, + 118, 227, 41, 95, 185, 117, 152, 128, 119, 205, 173, 180, 155, 86, ]), index: 0, src_size: 0, @@ -320,6 +320,11 @@ async fn cross_platform_check() -> Result<()> { ]; for (i, c) in data_map.infos().into_iter().enumerate() { + println!("expected[i].src_hash {:?}", ref_data_map[i].src_hash.0); + println!("got .src_hash {:?}", c.src_hash.0); + println!("expected[i].dst_hash {:?}", ref_data_map[i].dst_hash.0); + println!("got .dst_hash {:?}", c.dst_hash.0); + assert_eq!(c.src_hash, ref_data_map[i].src_hash); assert_eq!(c.dst_hash, ref_data_map[i].dst_hash); }