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_length:
forall k s b s',
ENTROPY.success b s' = ENTROPY.get_bytes k s ->
length b = k.