Last active
July 14, 2022 02:28
-
-
Save aimerneige/6ff800cb4eaa629dd49c0bead7c6b44a to your computer and use it in GitHub Desktop.
ddlcpad in rust
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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