use base64 crate instead of base64ct, no constant time necessary
This commit is contained in:
parent
fada53044d
commit
b9e553f112
4 changed files with 6 additions and 12 deletions
8
Cargo.lock
generated
8
Cargo.lock
generated
|
|
@ -85,12 +85,6 @@ version = "0.22.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
|
||||
|
||||
[[package]]
|
||||
name = "base64ct"
|
||||
version = "1.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "55248b47b0caf0546f7988906588779981c43bb1bc9d0c44087278f80cdb44ba"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "2.9.1"
|
||||
|
|
@ -881,7 +875,7 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
|||
name = "shrupl"
|
||||
version = "0.1.0-alpha"
|
||||
dependencies = [
|
||||
"base64ct",
|
||||
"base64",
|
||||
"blake2b_simd",
|
||||
"clap",
|
||||
"console",
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ edition = "2024"
|
|||
description = "ShrUpl is a tool to upload files to a Sharry Instance through a public Alias, leveraging the tus protocol"
|
||||
|
||||
[dependencies]
|
||||
base64ct = { version = "1.8.0", default-features = false, features = ["alloc"] }
|
||||
base64 = { version = "0.22.1", default-features = false }
|
||||
blake2b_simd = "1.0.3"
|
||||
clap = { version = "4.5.38", features = ["derive"] }
|
||||
console = { version = "0.15.11", default-features = false }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use std::{convert::Infallible, fmt, io, time::Duration};
|
||||
|
||||
use base64ct::{Base64UrlUnpadded, Encoding};
|
||||
use base64::{Engine, prelude::BASE64_URL_SAFE_NO_PAD as BASE64URL};
|
||||
use blake2b_simd::Params as Blake2b;
|
||||
use clap::{Parser, builder::TypedValueParser, value_parser};
|
||||
use log::LevelFilter;
|
||||
|
|
@ -153,6 +153,6 @@ impl Cli {
|
|||
hasher.update(chk.as_ref());
|
||||
}
|
||||
|
||||
Base64UrlUnpadded::encode_string(hasher.finalize().as_bytes())
|
||||
BASE64URL.encode(hasher.finalize())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ mod uploading;
|
|||
|
||||
use std::{ffi::OsStr, fs, io::Read, path::Path};
|
||||
|
||||
use base64ct::{Base64, Encoding};
|
||||
use base64::{Engine, prelude::BASE64_STANDARD_NO_PAD as BASE64};
|
||||
use blake2b_simd::Params as Blake2b;
|
||||
|
||||
pub use checked::Checked;
|
||||
|
|
@ -35,7 +35,7 @@ fn compute_file_hash(path: &Path, size: u64, on_progress: impl Fn(u64)) -> crate
|
|||
return Err(crate::Error::mismatch(size, bytes_read));
|
||||
}
|
||||
|
||||
let result = Base64::encode_string(hasher.finalize().as_bytes());
|
||||
let result = BASE64.encode(hasher.finalize());
|
||||
debug!("hashed {:?}: {result:?}", path.display());
|
||||
Ok(result)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue