Function hash_blocks_bits (b:nat) (B:(0<b)%nat) (hash_block_bit : Blist -> Blist -> Blist) (r: Blist)
         (msg: Blist) {measure length msg} : Blist :=
  match msg with
  | nil => r
  | _ => hash_blocks_bits b B hash_block_bit (hash_block_bit r (firstn b msg)) (skipn b msg)
  end.

(* Specifications: *)
Lemma add_blocksize_length l n: 0<=n -> BinInt.Z.add n (Zcomplements.Zlength l) = Zcomplements.Zlength ((Coqlib.list_repeat (Z.to_nat n) true) ++ l).
Lemma hash_blocks_bits_len c b (B:(0<b)%nat) h (HH: forall x y, length x = c -> length y = b -> length (h x y) = c) r l: length r = c -> InBlocks b l -> length (hash_blocks_bits b B h r l) = c.