Skip to content

Instantly share code, notes, and snippets.

@aimerneige
Last active July 14, 2022 02:28
Show Gist options
  • Save aimerneige/6ff800cb4eaa629dd49c0bead7c6b44a to your computer and use it in GitHub Desktop.
Save aimerneige/6ff800cb4eaa629dd49c0bead7c6b44a to your computer and use it in GitHub Desktop.
ddlcpad in rust
use std::fs::File;
use std::io::prelude::*;
fn main() {
let mut f = File::open("foo.cy").unwrap();
let mut buffer = Vec::new();
// read the whole file
f.read_to_end(&mut buffer).unwrap();
// xor the buffer with a key
for i in 0..buffer.len() {
buffer[i] ^= 40;
}
// write the xor-ed buffer to a new file
let mut f = File::create("bar.cy.out").unwrap();
f.write_all(&buffer).unwrap();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment