Skip to content

Commit

Permalink
Dependency updates, lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
CraZySacX committed Jan 27, 2025
1 parent 11080e6 commit 6966d32
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ getset = "0.1.4"
num-bigint = "0.4.6"
num-traits = "0.2.19"
num-integer = "0.1.46"
rand = "0.8.5"
rand = "0.9.0"
serde = { version = "1.0.217", features = ["derive"] }
thiserror = "2.0.11"

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ assert_eq!(unlock(&shares)?, secret);

// Remove a random share from `shares` and check that 4 shares can unlock
// the secret
let mut rng = thread_rng();
let mut rng = rng();
remove_random_entry(&mut rng, &mut shares);
assert_eq!(shares.len(), 4);
assert_eq!(unlock(&shares)?, secret);
Expand Down
4 changes: 2 additions & 2 deletions src/base62/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use anyhow::Result;
use num_bigint::BigUint;
use num_integer::Integer;
use num_traits::{One, ToPrimitive, Zero};
use rand::{thread_rng, RngCore};
use rand::{rng, RngCore};

use crate::error::SsssError::BadCharacter;

Expand All @@ -28,7 +28,7 @@ pub(crate) fn encode(bytes: &[u8]) -> String {
String::new()
} else {
let mut nonce = [0u8; 10];
thread_rng().fill_bytes(&mut nonce);
rng().fill_bytes(&mut nonce);
let mut input = nonce.to_vec();
input[0] = 1;
input.extend_from_slice(bytes);
Expand Down
2 changes: 1 addition & 1 deletion src/gf256/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use constants::{EXP, LOG};
use rand::RngCore;

pub(crate) fn generate_coeffs(d: u8, x: u8) -> Vec<u8> {
let mut rng = rand::thread_rng();
let mut rng = rand::rng();
let d_usize = usize::from(d);
let mut rand_bytes = vec![0; d_usize];

Expand Down
5 changes: 2 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
//!
//! ```rust
//! # use anyhow::Result;
//! # use rand::{thread_rng, rngs::ThreadRng};
//! # use rand::{rng, rngs::ThreadRng};
//! # use ssss::{unlock, gen_shares, remove_random_entry, SsssConfig};
//! #
//! # fn main() -> Result<()> {
Expand All @@ -49,7 +49,7 @@
//!
//! // Remove a random share from `shares` and check that 4 shares can unlock
//! // the secret
//! let mut rng = thread_rng();
//! let mut rng = rng();
//! remove_random_entry(&mut rng, &mut shares);
//! assert_eq!(shares.len(), 4);
//! assert_eq!(unlock(&shares)?, secret);
Expand Down Expand Up @@ -229,7 +229,6 @@
unused_variables,
useless_ptr_null_checks,
variant_size_differences,
wasm_c_abi,
while_true,
)
)]
Expand Down
8 changes: 4 additions & 4 deletions src/shamir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ fn validate_split_args(config: &SsssConfig, secret: &[u8]) -> Result<()> {
/// # Example
/// ```
/// # use anyhow::Result;
/// # use rand::{thread_rng, rngs::ThreadRng};
/// # use rand::{rng, rngs::ThreadRng};
/// # use ssss::{gen_shares, unlock, remove_random_entry, SsssConfig};
/// #
/// # pub fn main() -> Result<()> {
Expand All @@ -173,7 +173,7 @@ fn validate_split_args(config: &SsssConfig, secret: &[u8]) -> Result<()> {
///
/// // Remove a random share from `shares` and check that 4 shares can unlock
/// // the secret
/// let mut rng = thread_rng();
/// let mut rng = rng();
/// remove_random_entry(&mut rng, &mut shares);
/// assert_eq!(shares.len(), 4);
/// assert_eq!(unlock(&shares)?, secret);
Expand Down Expand Up @@ -237,7 +237,7 @@ mod test {
use super::{gen_shares, unlock, utils::encode_share, SsssConfig};
use crate::utils::{check_err_result, remove_random_entry};
use anyhow::Result;
use rand::thread_rng;
use rand::rng;

#[test]
fn empty_secret() -> Result<()> {
Expand Down Expand Up @@ -333,7 +333,7 @@ mod test {
assert_eq!(unlock(&parts)?, secret);

// 4 parts shoud work
let mut rng = thread_rng();
let mut rng = rng();
remove_random_entry(&mut rng, &mut parts);
assert_eq!(parts.len(), 4);
assert_eq!(unlock(&parts)?, secret);
Expand Down

0 comments on commit 6966d32

Please sign in to comment.