Skip to content

Commit d6c0a06

Browse files
committed
Merge bryant#39
2 parents 9c1c1b4 + d3e1e66 commit d6c0a06

3 files changed

Lines changed: 14 additions & 0 deletions

File tree

src/argon2.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ fn h0(lanes: u32, hash_length: u32, memory_kib: u32, passes: u32, version: u32,
7070

7171
/// Main entry point for running Argon2 on customized parameters (cf. note for
7272
/// `Argon2::new`).
73+
#[derive(Debug, Eq, PartialEq)]
7374
pub struct Argon2 {
7475
passes: u32,
7576
lanes: u32,

src/verifier.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ impl Error for DecodeError {
213213

214214
/// Represents a single Argon2 hashing session. A hash session comprises of the
215215
/// hash algorithm parameters, salt, key, and data used to hash a given input.
216+
#[derive(Debug, Eq, PartialEq)]
216217
pub struct Encoded {
217218
params: Argon2,
218219
hash: Vec<u8>,
@@ -450,6 +451,16 @@ mod test {
450451
}
451452
}
452453

454+
#[test]
455+
fn encode_decode() {
456+
for &(s, _) in BASE64_CASES.iter() {
457+
let salt = b"Yum! Extra salty";
458+
let key = b"ff5dfa4d7a048f9db4ad0caad82e75c";
459+
let enc = Encoded::default2i(s, salt, key, &[]);
460+
assert_eq!(Encoded::from_u8(&enc.to_u8()), Ok(enc));
461+
}
462+
}
463+
453464
#[test]
454465
fn bad_encoded() {
455466
use super::DecodeError::*;

travis.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#!/bin/sh
2+
set -e
13
cargo build
24
cargo test
35

0 commit comments

Comments
 (0)