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.
Definition fcore_result h data l :=
match Snuffle20 (prepare_data data)
with None => False
| Some x =>
if Int.eq (Int.repr h) Int.zero
then l=QuadChunks2ValList (map littleendian_invert x)
else match data with ((Nonce, C), K) =>
match Nonce with (N1, N2, N3, N4) =>
match C with (C1, C2, C3, C4) =>
l = QuadByte2ValList (littleendian_invert (Int.sub (Znth 0 x)  (littleendian C1))) ++
QuadByte2ValList (littleendian_invert (Int.sub (Znth 5 x)  (littleendian C2))) ++
QuadByte2ValList (littleendian_invert (Int.sub (Znth 10 x) (littleendian C3))) ++
QuadByte2ValList (littleendian_invert (Int.sub (Znth 15 x) (littleendian C4))) ++
QuadByte2ValList (littleendian_invert (Int.sub (Znth 6 x)  (littleendian N1))) ++
QuadByte2ValList (littleendian_invert (Int.sub (Znth 7 x)  (littleendian N2))) ++
QuadByte2ValList (littleendian_invert (Int.sub (Znth 8 x)  (littleendian N3))) ++
QuadByte2ValList (littleendian_invert (Int.sub (Znth 9 x)  (littleendian N4)))
end end end
end.