From 5c789533e3ad68eff1502cdd4fc1f5021848b6e8 Mon Sep 17 00:00:00 2001 From: StNicolay Date: Thu, 25 Jul 2024 17:45:36 +0300 Subject: [PATCH] Updated to Rust 1.80 and changed to LazyLock --- Cargo.lock | 8 ++------ Cargo.toml | 1 - src/cryptography/account.rs | 4 ++-- src/cryptography/hashing.rs | 4 ++-- 4 files changed, 6 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8646b06..8ecfcee 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1078,9 +1078,9 @@ dependencies = [ [[package]] name = "object" -version = "0.36.1" +version = "0.36.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "081b846d1d56ddfc18fdf1a922e4f6e07a11768ea1b92dec44e42b72712ccfce" +checksum = "3f203fa8daa7bb185f760ae12bd8e097f63d17041dcdcaf675ac54cdf863170e" dependencies = [ "memchr", ] @@ -1090,9 +1090,6 @@ name = "once_cell" version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" -dependencies = [ - "parking_lot_core", -] [[package]] name = "opaque-debug" @@ -1150,7 +1147,6 @@ dependencies = [ "futures", "hex", "itertools 0.13.0", - "once_cell", "parking_lot", "pbkdf2", "rand", diff --git a/Cargo.toml b/Cargo.toml index 827e3f8..5b5eef6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,7 +29,6 @@ dotenvy = "0.15" futures = "0.3" hex = "0.4" itertools = "0.13" -once_cell = { version = "1", features = ["parking_lot"] } parking_lot = "0.12" pbkdf2 = { version = "0.12", features = ["parallel"] } rand = { version = "0.8", default-features = false, features = [ diff --git a/src/cryptography/account.rs b/src/cryptography/account.rs index bc2536f..96680eb 100644 --- a/src/cryptography/account.rs +++ b/src/cryptography/account.rs @@ -107,10 +107,10 @@ impl Decrypted { #[cfg(test)] mod tests { use super::*; - use once_cell::sync::Lazy; + use std::sync::LazyLock; const TESTING_MASTER_PASSWORD: &str = "VeryStr^n#M@$terP@$$!word"; - static CIPHER: Lazy = Lazy::new(|| { + static CIPHER: LazyLock = LazyLock::new(|| { let mut salt = [0; 64]; OsRng.fill_bytes(&mut salt); diff --git a/src/cryptography/hashing.rs b/src/cryptography/hashing.rs index bf7a18c..42ae04f 100644 --- a/src/cryptography/hashing.rs +++ b/src/cryptography/hashing.rs @@ -1,13 +1,13 @@ use crate::entity::master_pass::MasterPass; -use once_cell::sync::Lazy; use rand::{rngs::OsRng, RngCore}; use scrypt::{scrypt, Params}; +use std::sync::LazyLock; use subtle::ConstantTimeEq; pub const HASH_LENGTH: usize = 64; pub const SALT_LENGTH: usize = 64; -static PARAMS: Lazy = Lazy::new(|| Params::new(14, 8, 1, HASH_LENGTH).unwrap()); +static PARAMS: LazyLock = LazyLock::new(|| Params::new(14, 8, 1, HASH_LENGTH).unwrap()); /// Hashes the bytes with Scrypt with the given salt #[must_use]