diff --git a/Cargo.lock b/Cargo.lock index ceed3a1..41a57f2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -34,7 +34,7 @@ dependencies = [ "p256", "prost", "quick-xml", - "rand 0.10.1", + "rand 0.8.5", "reqwest", "rocket", "rocket_cors", @@ -607,6 +607,12 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + [[package]] name = "chacha20" version = "0.10.0" @@ -3880,7 +3886,7 @@ dependencies = [ "rand 0.8.5", "rsa", "serde", - "sha1", + "sha1 0.10.6", "sha2 0.10.9", "smallvec", "sqlx-core", diff --git a/Cargo.toml b/Cargo.toml index ceca6bf..e9f3a2b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -45,7 +45,7 @@ juniper_rocket = "0.10.0" prost = "0.14.0" lettre = "0.11.15" -rand = { version = "0.10.0", features = ["std"] } +rand = "0.8.5" reqwest = "0.13.0" binrw = "0.15.1" ecdsa = { version = "0.16.9", features = ["pem", "std", "verifying"] } @@ -55,4 +55,4 @@ k256 = "0.13.4" dsa = "0.6.3" openssl = "0.10.78" time = "0.3.47" -hickory-resolver = { version = "0.24", features = ["tokio-runtime"] } +hickory-resolver = { version = "0.24", features = ["tokio-runtime"] } \ No newline at end of file diff --git a/src/account/account.rs b/src/account/account.rs index fd58a1b..2d43166 100644 --- a/src/account/account.rs +++ b/src/account/account.rs @@ -20,7 +20,7 @@ use openssl::ecdsa::EcdsaSig; use openssl::error::ErrorStack; use openssl::nid::Nid; use openssl::pkey::Public; -use rand::prelude::*; +use rand::Rng; use rocket::http::Status; use rocket::request::{FromRequest, Outcome}; use rocket::{Request, async_trait}; @@ -81,9 +81,9 @@ pub struct _CertificatePid { fn generate_nintendo_hash(pid: i32, text_password: &str) -> String { let mut sha = Sha256::new(); - sha.update(&bytes_of(&pid)); - sha.update(&[0x02, 0x65, 0x43, 0x46]); - sha.update(text_password.as_bytes()); + sha.write_all(&bytes_of(&pid)).unwrap(); + sha.write_all(&[0x02, 0x65, 0x43, 0x46]).unwrap(); + sha.write_all(text_password.as_bytes()).unwrap(); hex::encode(&sha.finalize()[..]) } @@ -193,18 +193,18 @@ pub async fn read_bearer_auth_token(connection: &Pool, token: &str) -> Option String { - let mut rng = rand::rng(); + let mut rng = rand::thread_rng(); let mut output = String::with_capacity(16); while output.len() < 16 { - let offset: u8 = rng.random_range(0..62); + let offset: u8 = rng.gen_range(0..62); let character = if offset < 10 { (offset + b'0') as char } else if offset < 36 { - (offset + 55) as char // A-Z + (offset + 55) as char } else { - (offset + 61) as char // a-z + (offset + 61) as char }; output.push(character); diff --git a/src/nnid/people.rs b/src/nnid/people.rs index db9e690..7d5f721 100644 --- a/src/nnid/people.rs +++ b/src/nnid/people.rs @@ -11,7 +11,7 @@ use crate::nnid::timezones::{OFFSET_FROM_TIMEZONE}; use crate::Pool; use crate::xml::{Xml, YesNoVal}; use crate::email::send_verification_email; -use rand::prelude::*; +use rand::Rng; // Not in use currently. //use mii::{get_image_png, get_image_tga}; use crate::mii_util::get_mii_img_url; @@ -118,7 +118,7 @@ pub async fn create_account(database: &State, data: Xml