def bf_unop_op

bend-osdev-blowfish@0.1.0.0 · PROOF.bend:11

import bend-osdev-blowfish@0.1.0.0/PROOF.bend as PROOF
import Base
import bend-osdev-cipher-core@0.1.0.0/cipher_core.bend as L
import bend-osdev-cipher-core@0.1.0.0/LAWS.bend as CoreL
import bend-osdev-blowfish@0.1.0.0/blowfish.bend as BF

11def bf_unop_op(o: BF.LcBfOp, b: L.LcBlock64) -> {b == BF.bf.unop(o, BF.bf.op(o, b)) : L.LcBlock64}:
12  match o:
13    case BF.LcBfRound{+p, +t}:
14      match b:
15        case L.LcBlock64{+l, +r}:
16          %CoreL.u32_xor_cancel(l, p) : {L.LcBlock64{l, r} == L.LcBlock64{_, U32.xor(U32.xor(r, BF.bf.f(t, U32.xor(l, p))), BF.bf.f(t, U32.xor(l, p)))} : L.LcBlock64}
17          %CoreL.u32_xor_cancel(r, BF.bf.f(t, U32.xor(l, p))) : {L.LcBlock64{l, r} == L.LcBlock64{l, _} : L.LcBlock64}
18          {==}
19    case BF.LcBfFinal{+p17, +p18}:
20      match b:
21        case L.LcBlock64{+l, +r}:
22          %CoreL.u32_xor_cancel(l, p17) : {L.LcBlock64{l, r} == L.LcBlock64{_, U32.xor(U32.xor(r, p18), p18)} : L.LcBlock64}
23          %CoreL.u32_xor_cancel(r, p18) : {L.LcBlock64{l, r} == L.LcBlock64{l, _} : L.LcBlock64}
24          {==}

Uses (7)

Used by (1)