diff options
| author | mat <github@matdoes.dev> | 2022-05-26 13:45:48 -0500 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2022-05-26 13:45:48 -0500 |
| commit | 1e145a82b80fb0402e8a64624454d9bfee77bc72 (patch) | |
| tree | ffb016cd6369bf0fbbf3545408f6278d47509a86 /azalea-crypto/src | |
| parent | 3fbbb61c30f0833dd1e07802419ee91ef6cad8e3 (diff) | |
| download | azalea-drasl-1e145a82b80fb0402e8a64624454d9bfee77bc72.tar.xz | |
1.19
Diffstat (limited to 'azalea-crypto/src')
| -rw-r--r-- | azalea-crypto/src/lib.rs | 4 | ||||
| -rw-r--r-- | azalea-crypto/src/signing.rs | 5 |
2 files changed, 8 insertions, 1 deletions
diff --git a/azalea-crypto/src/lib.rs b/azalea-crypto/src/lib.rs index c233b231..a5e797e8 100644 --- a/azalea-crypto/src/lib.rs +++ b/azalea-crypto/src/lib.rs @@ -1,3 +1,5 @@ +mod signing; + use aes::cipher::inout::InOutBuf; use aes::{ cipher::{BlockDecryptMut, BlockEncryptMut, KeyIvInit}, @@ -5,6 +7,7 @@ use aes::{ }; use rand::{rngs::OsRng, RngCore}; use sha1::{Digest, Sha1}; +pub use signing::SaltSignaturePair; fn generate_secret_key() -> [u8; 16] { let mut key = [0u8; 16]; @@ -65,7 +68,6 @@ pub fn create_cipher(key: &[u8]) -> (Aes128CfbEnc, Aes128CfbDec) { ) } -// wow this is terrible pub fn encrypt_packet(cipher: &mut Aes128CfbEnc, packet: &mut [u8]) { let (chunks, rest) = InOutBuf::from(packet).into_chunks(); assert!(rest.is_empty()); diff --git a/azalea-crypto/src/signing.rs b/azalea-crypto/src/signing.rs new file mode 100644 index 00000000..21cd813a --- /dev/null +++ b/azalea-crypto/src/signing.rs @@ -0,0 +1,5 @@ +#[derive(Debug, Clone)] +pub struct SaltSignaturePair { + pub salt: u64, + pub signature: Vec<u8>, +} |
