Skip to content

Instantly share code, notes, and snippets.

View somehybrid's full-sized avatar

somehybrid somehybrid

View GitHub Profile
@somehybrid
somehybrid / typescript.bat
Last active November 8, 2021 04:35
Automatically runs and compiles a typescript file (requirements: node.js, typescript)
:: For Windows
tsc %1
node %1
del %1
@somehybrid
somehybrid / chacha20.rs
Last active July 18, 2023 13:01
A Rust implementation of the ChaCha20-Poly1305 algorithm in RFC 7539 https://www.rfc-editor.org/rfc/rfc7539
// A Rust implementation of the ChaCha20-Poly1305 algorithm in RFC 7539 https://www.rfc-editor.org/rfc/rfc7539
fn from_le_bytes(x: &[u8]) -> u32 {
u32::from_le_bytes([x[0], x[1], x[2], x[3]])
}
fn pad16(data: &[u8]) -> Vec<u8> {
return vec![0; 16 - (data.len() % 16)];
}