Definition bxorlist := combinelist _ Byte.xor.
Definition Bl2VL (l: list byte) := map Vint (map Int.repr (map Byte.unsigned l)).
Definition message_at (mCont: list byte) (m:val): mpred :=
match m with
Vint i => !!(i=Int.zero) && emp
| Vptr b z => data_at Tsh (tarray tuchar (Zlength mCont)) (Bl2VL mCont) m
| _ => FF
end.
Inductive CONTENT SIGMA K (mInit:val) (mCont zbytes:list byte): nat -> list byte -> list byte -> Prop :=
CONT_zero: CONTENT SIGMA K mInit mCont  zbytes O zbytes nil
| CONT_succ: forall n zN resN ,
CONTENT SIGMA K mInit mCont zbytes n zN resN ->
forall d,
SixteenByte2ValList d = Bl2VL (ZCont n zbytes) ->
forall snuff srbytes Xor,
Snuffle20 (prepare_data (d, SIGMA, K)) = Some snuff ->
QuadChunks2ValList (map littleendian_invert snuff) =
map Vint (map Int.repr (map Byte.unsigned srbytes)) ->
bxorlist (bytes_at mInit (Z.of_nat n * 64) 64 mCont) srbytes = Some Xor ->
CONTENT SIGMA K mInit mCont zbytes (S n) (snd (ZZ zN (8:nat))) (resN++Xor).

(* Specifications: *)
Lemma CONT_Zlength SIGMA K mInit mCont zbytes:
forall n zB x,
CONTENT SIGMA K mInit mCont zbytes n zB x ->
Zlength x = (Z.of_nat n * 64)%Z.
Lemma CONTCONT SIGMA K mInit mCont zbytes:
forall n zB x,
CONTENT SIGMA K mInit mCont zbytes n zB x ->
ZCont n zbytes = zB.
Lemma ZZ_Zlength: forall n zbytes u U, ZZ zbytes n = (u,U) ->
Zlength zbytes=16 -> Z.of_nat n <= 8 -> Zlength U = 16.
Lemma Zlength_ZCont: forall n zbytes, Zlength zbytes = 16 -> Zlength (ZCont n zbytes) = 16.
Lemma SixteenByte2ValList_exists bytes: Zlength bytes = 16 ->
exists d, SixteenByte2ValList d = map Vint (map Int.repr (map Byte.unsigned bytes)).