Local Open Scope logic.
Definition CoreInSEP (data : SixteenByte * SixteenByte * (SixteenByte * SixteenByte))
(v: val * val * val) : mpred :=
match data with (Nonce, C, K) =>
match v with (n, c, k) =>
(SByte Nonce n) * (SByte C c) * (ThirtyTwoByte K k)
end end.
Definition prepare_data
(data : SixteenByte * SixteenByte * (SixteenByte * SixteenByte)) :=
match data with ((Nonce, C), K) =>
match Nonce with (N1, N2, N3, N4) =>
match C with (C1, C2, C3, C4) =>
match K with ((K1, K2, K3, K4), (L1, L2, L3, L4)) =>
map littleendian [C1; K1; K2; K3; K4; C2; N1; N2; N3; N4; C3; L1; L2; L3; L4; C4]
end end end
end.
Definition sumlist := combinelist _ Int.add.
Definition sumlist_Some:= combinelist _ Int.add.
Definition sumlist_SomeInv:= combinelist_SomeInv _ Int.add.
Definition sumlist_length:= combinelist_length _ Int.add.
Definition sumlist_symm:= combinelist_symm _ Int.add Int.add_commut.
Definition sumlist_char_nth:= combinelist_char_nth _ Int.add.
Definition sumlist_char_Znth:= combinelist_char_Znth _ Int.add.
Definition Snuffle20 x := bind (Snuffle 20 x) (fun y => sumlist y x).

Lemma Snuffle20_length s l: Snuffle20 s = Some l -> length s = 16%nat -> length l = 16%nat.