V0 #1
2 changed files with 7 additions and 4 deletions
fix signature
commit
420c689644
|
|
@ -1,6 +1,7 @@
|
|||
use std::rc::Rc;
|
||||
use std::{io::Write, rc::Rc};
|
||||
|
||||
use hmac::Mac;
|
||||
use md5::{Digest, Md5};
|
||||
use rc4::{KeyInit, Rc4, StreamCipher};
|
||||
use rnex_core::prudp::{
|
||||
encryption::{DEFAULT_KEY, EncryptionPair},
|
||||
|
|
@ -35,7 +36,9 @@ impl CryptoInstance for InsecureInstance {
|
|||
if data.len() == 0 {
|
||||
[0x78, 0x56, 0x34, 0x12]
|
||||
} else {
|
||||
let mut hmac = <HmacMd5 as Mac>::new_from_slice(ACCESS_KEY.as_bytes())
|
||||
let mut hash = Md5::new();
|
||||
hash.write(ACCESS_KEY.as_bytes()).unwrap();
|
||||
let mut hmac = <HmacMd5 as Mac>::new_from_slice(&hash.finalize().as_slice())
|
||||
.expect("unable to create hmac md5");
|
||||
hmac.update(data);
|
||||
hmac.finalize().into_bytes()[0..4].try_into().unwrap()
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ impl<C: Crypto> Server<C> {
|
|||
let mut inner = conn.inner.lock().await;
|
||||
let seq = inner.server_packet_counter;
|
||||
let packet = new_data_packet(
|
||||
HAS_SIZE | NEED_ACK | RELIABLE,
|
||||
NEED_ACK | RELIABLE,
|
||||
self.param.virtual_port,
|
||||
conn.addr.virtual_port,
|
||||
data,
|
||||
|
|
@ -268,7 +268,7 @@ impl<C: Crypto> Server<C> {
|
|||
});
|
||||
|
||||
let packet = new_connect_packet(
|
||||
ACK | HAS_SIZE,
|
||||
ACK,
|
||||
header.destination,
|
||||
header.source,
|
||||
self_signat,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue