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
//! What the schemes give back: a stored term and a query, each the
//! serialised bytes of a ciphertext.
//!
//! The block count of a ciphertext is the plaintext's width, known only
//! when the plaintext arrives, so a scheme cannot give back a ciphertext
//! typed by its block count. It gives back the bytes, under a type that
//! says which half they are: a [`Term`] is a full ciphertext, left and
//! right halves, and is what is stored; a [`Query`] is the left half
//! alone, made from the value searched for, and is what a comparison
//! needs from the other side. The bytes carry their scheme and block
//! count in the wire header, and the comparators parse and check them.
//!
//! The plaintext type is not in the bytes. vitaminc's `OrderTerm` and
//! `QueryTerm` label a term with its target; here a `Term` is whatever
//! the caller says it is, and the comparators refuse only what they can
//! tell apart (another scheme; on a fixed-width scheme another block
//! count; on the chained scheme another padding policy), as the scheme
//! docs say.
/// A full ciphertext, serialised: left and right halves, with the wire
/// header. What a scheme stores. Compared with the scheme's
/// `compare_raw_slices`, or against a [`Query`] with
/// `compare_left_to_full`; never byte by byte, since a full ciphertext
/// carries a random nonce and one value has many. So no `PartialEq`:
/// `==` on two terms of one value would be `false`.
;
/// A left (query) ciphertext, serialised: the per-block permuted
/// symbols and tags, with the wire header, and no nonce or right half.
/// Made from the value searched for, and compared against a stored
/// [`Term`] with the scheme's `compare_left_to_full`. Deterministic:
/// one value under one key and salt gives one query.
;
bytes_newtype!;
bytes_newtype!;