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
//! The crate's error type (plan 00009 STEP-05).
use fmt;
/// What kind of input was rejected.
///
/// One variant per exception class in the `fpr-ff1` Python package, so code
/// ported between the two maps each exception to exactly one kind:
///
/// | Kind | Python exception |
/// |---|---|
/// | [`KeyLength`](ErrorKind::KeyLength) | `KeyLengthError` |
/// | [`Radix`](ErrorKind::Radix) | `RadixError` |
/// | [`Length`](ErrorKind::Length) | `LengthError` |
/// | [`ValueRange`](ErrorKind::ValueRange) | `ValueRangeError` |
/// | [`TweakLength`](ErrorKind::TweakLength) | `TweakLengthError` |
/// | [`Alphabet`](ErrorKind::Alphabet) | `AlphabetError` |
/// | [`AlphabetRequired`](ErrorKind::AlphabetRequired) | `FF1Error` (the base class) |
///
/// Python's `BackendError` has no counterpart: backend selection is a
/// Python-side concern.
/// A rejected input.
///
/// The message matches the Python package's for the same rejection. It never
/// contains key material, a numeral value or a character from the input:
/// validation errors are routinely logged, and those are secrets or
/// plaintext. It names the offending position or length instead.