Skip to content

Instantly share code, notes, and snippets.

@cpcloud
Created April 15, 2021 22:58
Show Gist options
  • Select an option

  • Save cpcloud/bf840af1310d6de79882b117d9fb324a to your computer and use it in GitHub Desktop.

Select an option

Save cpcloud/bf840af1310d6de79882b117d9fb324a to your computer and use it in GitHub Desktop.
pub fn munge<D, I>(&'a mut self, data: D) -> impl Iterator<Item = u8> + 'a
where
D: IntoIterator<Item = I> + 'a,
I: Borrow<u8> + 'a,
{
data.into_iter()
.zip(&mut self.key)
.map(|(byte, k)| byte.borrow() ^ k)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment