Module PAD := HMAC_Pad HF I.
Definition h_v (iv:Bvector EQ.c) (blk:Bvector EQ.b): Bvector EQ.c :=
of_list_length _
(EQ.h_length _ _ (VectorToList_length _ iv) (VectorToList_length _ blk)).
Definition ipd := Byte.repr 54.
Definition opd :=Byte.repr 92.
Definition IPAD:=bytesToBits (PAD.HM.sixtyfour ipd).
Definition OPAD:=bytesToBits (PAD.HM.sixtyfour opd).
unfold IPAD. rewrite bytesToBits_len, PAD.HM.length_SF, <- EQ.BS; trivial.
Qed.
unfold OPAD. rewrite bytesToBits_len, PAD.HM.length_SF, <- EQ.BS; trivial.
Qed.
Definition ipad_v: Bvector EQ.b := of_list_length _ IL.
Definition opad_v : Bvector EQ.b := of_list_length _ OL.
apply bytes_bits_comp_ind.
unfold PAD.HM.sixtyfour.
unfold opad_v. rewrite of_length_proof_irrel. reflexivity.
Qed.
apply bytes_bits_comp_ind.
unfold PAD.HM.sixtyfour.
unfold ipad_v. rewrite of_length_proof_irrel. reflexivity.
Qed.
intros N.
assert ((Vector.to_list ipad_v)  = bytesToBits (PAD.HM.sixtyfour ipd)  ).
apply bits_bytes_ind_comp; trivial.
apply IPADX.
assert ((Vector.to_list opad_v)  = bytesToBits (PAD.HM.sixtyfour opd)  ).
apply bits_bytes_ind_comp; trivial.
apply OPADX.
rewrite N, H in H0; clear N H.
apply bytesToBits_injective in H0; trivial.
unfold PAD.HM.sixtyfour in H0.
apply list_repeat_injective in H0. inv H0.
apply BS_pos.
Qed.

Lemma Equivalence (P : Blist -> Prop) (HP: forall msg, P msg -> NPeano.Nat.divide 8 (length msg))
(kv : Bvector EQ.b) (m : HMAC_Abstract.Message P):
Vector.to_list (HMAC_spec.HMAC h_v EQ.iv_v (HMAC_Abstract.wrappedSAP _ _ EQ.splitAndPad_v)
EQ.fpad_v opad_v ipad_v kv m) =
bytesToBits (PAD.HM.HmacCore ipd opd
(bitsToBytes (HMAC_Abstract.Message2Blist m))
(bitsToBytes (Vector.to_list kv))).