Updated to Rust 1.80 and changed to LazyLock

This commit is contained in:
2024-07-25 17:45:36 +03:00
parent 4121857854
commit 5c789533e3
4 changed files with 6 additions and 11 deletions

View File

@ -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<Cipher> = Lazy::new(|| {
static CIPHER: LazyLock<Cipher> = LazyLock::new(|| {
let mut salt = [0; 64];
OsRng.fill_bytes(&mut salt);

View File

@ -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<Params> = Lazy::new(|| Params::new(14, 8, 1, HASH_LENGTH).unwrap());
static PARAMS: LazyLock<Params> = LazyLock::new(|| Params::new(14, 8, 1, HASH_LENGTH).unwrap());
/// Hashes the bytes with Scrypt with the given salt
#[must_use]