1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
use core::fmt;
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub enum Error {
AdTooLong,
AlgorithmInvalid,
LanesTooFew,
LanesTooMany,
MemoryTooLittle,
MemoryTooMuch,
OutputTooShort,
OutputTooLong,
PwdTooLong,
SaltTooShort,
SaltTooLong,
SecretTooLong,
ThreadsTooFew,
ThreadsTooMany,
TimeTooSmall,
VersionInvalid,
}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(match self {
Error::AdTooLong => "associated data is too long",
Error::AlgorithmInvalid => "algorithm identifier invalid",
Error::LanesTooFew => "too few lanes",
Error::LanesTooMany => "too many lanes",
Error::MemoryTooLittle => "memory cost is too small",
Error::MemoryTooMuch => "memory cost is too large",
Error::OutputTooShort => "output is too short",
Error::OutputTooLong => "output is too long",
Error::PwdTooLong => "password is too long",
Error::SaltTooShort => "salt is too short",
Error::SaltTooLong => "salt is too long",
Error::SecretTooLong => "secret is too long",
Error::ThreadsTooFew => "not enough threads",
Error::ThreadsTooMany => "too many threads",
Error::TimeTooSmall => "time cost is too small",
Error::VersionInvalid => "invalid version",
})
}
}