Fixpoint get_first_None (limit:nat) (s: ENTROPY.stream): nat :=
match limit with
| O => O (* bogus *)
| S limit' =>
match s O with
| None => O
| Some _ => S (get_first_None limit' (fun i => s (S i)))
end
end
.

Lemma get_bytes_Zlength:
forall k s b s',
k >= 0 ->
ENTROPY.success b s' = ENTROPY.get_bytes (Z.to_nat k) s ->
Zlength b = k.