Skip to content

Commit

Permalink
deps: upgrade base64
Browse files Browse the repository at this point in the history
  • Loading branch information
Nugine committed Dec 11, 2022
1 parent 7c0620a commit 7d1245f
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 15 deletions.
6 changes: 3 additions & 3 deletions benches/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
8 changes: 4 additions & 4 deletions benches/base64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion crates/base64-simd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
22 changes: 15 additions & 7 deletions crates/base64-simd/tests/it.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down

0 comments on commit 7d1245f

Please sign in to comment.