(* Functional implementation of Salsa20 whose structure matches the one of tweetnacl.c implementation, plus proof of coorrectness wrt Salsa20.v  Lennart Beringer, June 2015*)
(*Processing time for this file: approx 13mins*)
Local Open Scope logic.
(*Require Import general_lemmas.  Require Import split_array_lemmas.*)
Opaque littleendian_invert. Opaque Snuffle.Snuffle.
Definition HTrue_inv intsums xs ys:Prop:=
Zlength intsums = 16 /\
(forall j, 0 <= j < 16 ->
exists xj, exists yj,
Znth j (map Vint xs) = Vint xj /\
Znth j (map Vint ys) = Vint yj /\
Znth j (map Vint intsums) = Vint (Int.add yj xj)).

Lemma HTrue_inv_char l xs ys: Zlength xs = 16 -> Zlength ys=16 ->
HTrue_inv l xs ys -> Some l = sumlist xs ys.