let suffix (a: keccak_alg) = if is_shake a then byte 0x1f else byte 0x06
let suffix (a: keccak_alg) =
if is_shake a then byte 0x1f else byte 0x06
Spec.SHA3.Incremental.fst.checked
Spec.SHA3.fst.checked Spec.Hash.Lemmas.fsti.checked Spec.Hash.Incremental.Definitions.fst.checked Spec.Hash.Definitions.fst.checked Spec.Agile.Hash.fst.checked Spec.Agile.Hash.fst.checked prims.fst.checked Lib.UpdateMulti.fst.checked Lib.Sequence.Lemmas.fsti.checked Lib.Sequence.fsti.checked Lib.LoopCombinators.fsti.checked Lib.IntTypes.fsti.checked FStar.Seq.fst.checked FStar.Pervasives.fsti.checked FStar.Mul.fst.checked FStar.Calc.fsti.checked
Spec.SHA3.Incremental.fst
Spec.Hash.Definitions.keccak_alg Spec.Hash.Definitions.is_shake Lib.IntTypes.byte Prims.bool Lib.IntTypes.byte_t Prims.l_or Prims.eq2 Prims.int Lib.IntTypes.range Lib.IntTypes.U8 Prims.l_and Prims.b2t Prims.op_GreaterThanOrEqual Prims.op_LessThan Lib.IntTypes.v Lib.IntTypes.PUB
module Spec.SHA3.Incremental

module S = FStar.Seq

open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Hash.Incremental.Definitions
open Spec.Hash.Lemmas

friend Spec.Agile.Hash

open FStar.Mul
module Loops = Lib.LoopCombinators
module UpdateMulti = Lib.UpdateMulti

open Lib.IntTypes

#set-options "--fuel 0 --ifuel 0 --z3rlimit 200"

let update_is_update_multi (a:keccak_alg) (inp:bytes{S.length inp == block_length a}) (s:words_state a)
  : Lemma (Spec.SHA3.absorb_inner (rate a/8) inp s == update_multi a s () inp)
  = let rateInBytes = rate a/8 in
    let f = Spec.SHA3.absorb_inner rateInBytes in
    let bs = block_length a in
    let f' = Lib.Sequence.repeat_blocks_f bs inp f 1 in
    assert (bs == rateInBytes);
    calc (==) {
      update_multi a s () inp;
      (==) { }
      Lib.Sequence.repeat_blocks_multi #_ #(words_state a) rateInBytes inp f s;
      (==) { Lib.Sequence.lemma_repeat_blocks_multi #_ #(words_state a) bs inp f s }
      (let len = S.length inp in
       let nb = len / bs in
      Loops.repeati #(words_state a) nb (Lib.Sequence.repeat_blocks_f bs inp f nb) s);
      (==) {
        Loops.unfold_repeati 1 f' s 0;
        Loops.eq_repeati0 1 f' s }
      f' 0 s;
      (==) { assert (Seq.slice inp (0 * bs) (0 * bs + bs) `S.equal` inp) }
      f inp s;
    }
val suffix : a: Spec.Hash.Definitions.keccak_alg
  -> b: Lib.IntTypes.byte_t{Lib.IntTypes.v b == 0x1f \/ Lib.IntTypes.v b == 0x06}
a: Spec.Hash.Definitions.keccak_alg
  -> b: Lib.IntTypes.byte_t{Lib.IntTypes.v b == 0x1f \/ Lib.IntTypes.v b == 0x06}