Use lower bcrypt cost

This commit is contained in:
Alex Kotov 2021-03-06 07:48:34 +05:00
parent a26fcbdb54
commit ddb64ee759
1 changed files with 4 additions and 2 deletions

View File

@ -1,4 +1,4 @@
use bcrypt::{hash, verify, DEFAULT_COST};
use bcrypt::{hash, verify};
use rand::{distributions::Standard, Rng};
use rocket::{
fairing::{Fairing as RocketFairing, Info, Kind},
@ -9,6 +9,8 @@ use rocket::{
use std::borrow::Cow;
use time::Duration;
const BCRYPT_COST: u32 = 8;
const _PARAM_NAME: &str = "authenticity_token";
const _HEADER_NAME: &str = "X-CSRF-Token";
const _PARAM_META_NAME: &str = "csrf-param";
@ -80,7 +82,7 @@ impl CsrfConfig {
impl CsrfToken {
pub fn authenticity_token(&self) -> String {
hash(&self.0, DEFAULT_COST).unwrap()
hash(&self.0, BCRYPT_COST).unwrap()
}
pub fn verify(&self, form_authenticity_token: &String) -> Result<(), VerificationFailure> {