aboutsummaryrefslogtreecommitdiff
path: root/azalea-crypto/src
diff options
context:
space:
mode:
authormat <27899617+mat-1@users.noreply.github.com>2022-06-08 23:37:54 +0000
committerGitHub <noreply@github.com>2022-06-08 23:37:54 +0000
commit601637bd48fcba826da01725430268f706181449 (patch)
tree5b58723b931450d358d7e4387d87cc8e8b9166b2 /azalea-crypto/src
parentea7249fb77a8e07d232600081c9c3df5f698d70f (diff)
parentfb1d419a3d4207a293a1ad6001253192f1b4d12f (diff)
downloadazalea-drasl-601637bd48fcba826da01725430268f706181449.tar.xz
Merge pull request #7 from mat-1/1.19
1.19
Diffstat (limited to 'azalea-crypto/src')
-rw-r--r--azalea-crypto/src/lib.rs4
-rw-r--r--azalea-crypto/src/signing.rs5
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>,
+}