LAWS.bend
bend-osdev-cast5@0.1.0.0 · 35 lines · 4 definitions
1
2
3
4import Base
5import bend-osdev-bytes@0.1.1.0/bytes.bend as B
6import bend-osdev-cipher-core@0.1.0.0/cipher_core.bend as L
7import bend-osdev-cast5@0.1.0.0/cast5.bend as C5
8
9
10
11law cast5_round_trip:
12 for k: C5.LcCast5Key
13 for +b: L.LcBlock64
14 {C5.LcCast5.decrypt(k, C5.LcCast5.encrypt(k, b)) == b : L.LcBlock64}
15
16law cast5_round_trip_dual:
17 for k: C5.LcCast5Key
18 for +b: L.LcBlock64
19 {C5.LcCast5.encrypt(k, C5.LcCast5.decrypt(k, b)) == b : L.LcBlock64}
20
21
22
23
24
25
26
27
28law cast5_rfc2144:
29 {Result.map(&2, &2, L.LcError, C5.LcCast5Key, L.LcBlock64, k => C5.LcCast5.encrypt(k, L.LcBlock64{19088743, 2309737967}), C5.LcCast5.key(B.Octets.of_list([1, 35, 69, 103, 18, 52, 86, 120, 35, 69, 103, 137, 52, 86, 120, 154]))) == Done{L.LcBlock64{596332517, 2222867634}} : Result<&2, &2, L.LcError, L.LcBlock64>}
30
31
32law cast5_bad_key_length:
33 {Result.map(&2, &2, L.LcError, C5.LcCast5Key, Unit, k => Unit{}, C5.LcCast5.key(B.Octets.of_list([0, 0, 0, 0]))) == Fail{L.LcBadKeyLength{4n}} : Result<&2, &2, L.LcError, Unit>}
34
35