Skip to content

Instantly share code, notes, and snippets.

@10maurycy10
Created January 23, 2021 00:12
Show Gist options
  • Save 10maurycy10/0e30096d37269c986f676e4e854b187e to your computer and use it in GitHub Desktop.
Save 10maurycy10/0e30096d37269c986f676e4e854b187e to your computer and use it in GitHub Desktop.
a terrible encription.
struct Gen {
key: i32
}
impl Iterator for Gen {
type Item = u8;
fn next(&mut self) -> Option<Self::Item> {
self.key += 1;
Some((
((self.key+3*3)^17)%256
) as u8)
}
}
fn main() {
use std::io;
use std::io::Read;
use std::io::Write;
let mut gen = Gen{key:0};
for ch in io::stdin().bytes() {
let code = ch.unwrap()^gen.next().unwrap();
io::stdout().write(&[code]).unwrap();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment