1#![no_std]
2
3mod strobe;
4
5use bevis::{Hasher, Sampler, Sponge, SpongeTranscript};
6
7use strobe::Strobe128;
8
9use rand_core::{impls, CryptoRng, RngCore};
10
11pub type Transcript = SpongeTranscript<Strobe128>;
12
13impl Hasher for Strobe128 {
14 fn write(&mut self, buf: &[u8]) {
15 self.bevis_absorb(buf)
16 }
17}
18
19impl RngCore for Strobe128 {
20 fn next_u32(&mut self) -> u32 {
21 impls::next_u32_via_fill(self)
22 }
23
24 fn next_u64(&mut self) -> u64 {
25 impls::next_u64_via_fill(self)
26 }
27
28 fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), rand_core::Error> {
29 self.bevis_squeeze(dest);
30 Ok(())
31 }
32
33 fn fill_bytes(&mut self, dest: &mut [u8]) {
34 self.bevis_squeeze(dest)
35 }
36}
37
38impl CryptoRng for Strobe128 {}
39
40impl Sponge for Strobe128 {
41 fn new(protocol_label: &str) -> Self {
42 Strobe128::new(protocol_label.as_bytes())
43 }
44}
45
46impl Sampler for Strobe128 {}