aboutsummaryrefslogtreecommitdiff
path: root/src/crypto.rs
diff options
context:
space:
mode:
authorDaniel García <[email protected]>2018-12-30 23:34:31 +0100
committerDaniel García <[email protected]>2018-12-30 23:34:31 +0100
commit30e768613b3345405f118cbad2580107a8811af7 (patch)
tree2a71f22be0ffd888c1181f9225741758c9869b2d /src/crypto.rs
parent72ed05c4a4013e7a5f7030b5177f17cc011b2b03 (diff)
downloadvaultwarden-30e768613b3345405f118cbad2580107a8811af7.tar.gz
vaultwarden-30e768613b3345405f118cbad2580107a8811af7.zip
Start using rustfmt and some style changes to make some lines shorter
Diffstat (limited to 'src/crypto.rs')
-rw-r--r--src/crypto.rs16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/crypto.rs b/src/crypto.rs
index 2698c0e4..9321f25f 100644
--- a/src/crypto.rs
+++ b/src/crypto.rs
@@ -1,6 +1,6 @@
-///
-/// PBKDF2 derivation
-///
+//
+// PBKDF2 derivation
+//
use ring::{digest, pbkdf2};
@@ -19,9 +19,9 @@ pub fn verify_password_hash(secret: &[u8], salt: &[u8], previous: &[u8], iterati
pbkdf2::verify(DIGEST_ALG, iterations, salt, secret, previous).is_ok()
}
-///
-/// Random values
-///
+//
+// Random values
+//
pub fn get_random_64() -> Vec<u8> {
get_random(vec![0u8; 64])
@@ -30,7 +30,9 @@ pub fn get_random_64() -> Vec<u8> {
pub fn get_random(mut array: Vec<u8>) -> Vec<u8> {
use ring::rand::{SecureRandom, SystemRandom};
- SystemRandom::new().fill(&mut array).expect("Error generating random values");
+ SystemRandom::new()
+ .fill(&mut array)
+ .expect("Error generating random values");
array
}