diff --git a/benches/Cargo.toml b/benches/Cargo.toml index 10e6b35..5dcad24 100644 --- a/benches/Cargo.toml +++ b/benches/Cargo.toml @@ -96,16 +96,16 @@ uuid = "1.2.2" const-str = "0.5.3" faster-hex = "0.6.1" radix64 = { version = "0.6.2", default-features = false } -base64 = "0.13.1" +base64 = "0.20.0" hex = "0.4.3" base16 = "0.2.1" getrandom = { version = "0.2", features = ["js"] } base64ct = "1.5.3" base16ct = "0.1.1" base32ct = "0.1.0" -data-encoding = "2.3.2" +data-encoding = "2.3.3" encoding_rs = "0.8.31" -rayon = { version = "1.6.0", optional = true } +rayon = { version = "1.6.1", optional = true } [dev-dependencies] criterion = { version = "0.4.0", default-features = false, features = ["rayon"] } diff --git a/benches/base64.rs b/benches/base64.rs index f9f34a4..3d15762 100644 --- a/benches/base64.rs +++ b/benches/base64.rs @@ -29,8 +29,8 @@ pub fn bench_encode(c: &mut Criterion) { radix64::STD.encode_slice(src, dst); }), ("base64/fallback", |src, dst| { - let config = base64::STANDARD; - base64::encode_config_slice(src, config, dst); + let config = base64::engine::DEFAULT_ENGINE; + base64::encode_engine_slice(src, dst, &config); }), ("base64ct/fallback", |src, dst| { use base64ct::Encoding; @@ -71,8 +71,8 @@ pub fn bench_decode(c: &mut Criterion) { radix64::STD.decode_slice(src, dst).unwrap(); }), ("base64/fallback", |src, dst| { - let config = base64::STANDARD; - base64::decode_config_slice(src, config, dst).unwrap(); + let config = base64::engine::DEFAULT_ENGINE; + base64::decode_engine_slice(src, dst, &config).unwrap(); }), ("base64ct/fallback", |src, dst| { use base64ct::Encoding; diff --git a/crates/base64-simd/Cargo.toml b/crates/base64-simd/Cargo.toml index a46ef3c..c34b25e 100644 --- a/crates/base64-simd/Cargo.toml +++ b/crates/base64-simd/Cargo.toml @@ -26,7 +26,7 @@ outref = "0.4.0" vsimd = { path = "../vsimd", version = "0.8.0-dev" } [dev-dependencies] -base64 = "0.13.1" +base64 = "0.20.0" rand = "0.8.5" const-str = "0.5.3" diff --git a/crates/base64-simd/tests/it.rs b/crates/base64-simd/tests/it.rs index 795f265..3b38fc0 100644 --- a/crates/base64-simd/tests/it.rs +++ b/crates/base64-simd/tests/it.rs @@ -81,17 +81,25 @@ fn random() { STANDARD_NO_PAD, // URL_SAFE_NO_PAD, // ]; - let base_config = [ - base64::STANDARD, - base64::URL_SAFE, - base64::STANDARD_NO_PAD, - base64::URL_SAFE_NO_PAD, - ]; + + let base_config = { + use base64::alphabet::*; + use base64::engine::fast_portable::{FastPortable, NO_PAD, PAD}; + + let f = FastPortable::from; + + [ + f(&STANDARD, PAD), + f(&URL_SAFE, PAD), + f(&STANDARD, NO_PAD), + f(&URL_SAFE, NO_PAD), + ] + }; for (base64, config) in test_config.into_iter().zip(base_config.into_iter()) { dbgmsg!("base64 = {:?}", base64); - let encoded = base64::encode_config(&bytes, config); + let encoded = base64::encode_engine(&bytes, &config); let encoded = encoded.as_bytes(); assert!(base64.check(encoded).is_ok());