mirror of
https://github.com/shadowsocks/shadowsocks-rust.git
synced 2026-02-09 01:59:16 +08:00
Uses Table cipher and aes-128-gcm for test
This commit is contained in:
@@ -804,13 +804,12 @@ impl Display for CipherType {
|
||||
mod test_cipher {
|
||||
use crate::crypto::{new_stream, CipherType, CryptoMode};
|
||||
|
||||
#[cfg(feature = "aes-cfb")]
|
||||
#[test]
|
||||
fn test_get_cipher() {
|
||||
let key = CipherType::Aes128Cfb.bytes_to_key(b"PassWORD");
|
||||
let iv = CipherType::Aes128Cfb.gen_init_vec();
|
||||
let mut encryptor = new_stream(CipherType::Aes128Cfb, &key[0..], &iv[0..], CryptoMode::Encrypt);
|
||||
let mut decryptor = new_stream(CipherType::Aes128Cfb, &key[0..], &iv[0..], CryptoMode::Decrypt);
|
||||
let key = CipherType::Table.bytes_to_key(b"PassWORD");
|
||||
let iv = CipherType::Table.gen_init_vec();
|
||||
let mut encryptor = new_stream(CipherType::Table, &key[0..], &iv[0..], CryptoMode::Encrypt);
|
||||
let mut decryptor = new_stream(CipherType::Table, &key[0..], &iv[0..], CryptoMode::Decrypt);
|
||||
let message = "HELLO WORLD";
|
||||
|
||||
let mut encrypted_msg = Vec::new();
|
||||
|
||||
@@ -70,7 +70,7 @@ fn socks5_relay_stream() {
|
||||
const LOCAL_ADDR: &str = "127.0.0.1:8200";
|
||||
|
||||
const PASSWORD: &str = "test-password";
|
||||
const METHOD: CipherType = CipherType::Aes256Cfb;
|
||||
const METHOD: CipherType = CipherType::Aes128Gcm;
|
||||
|
||||
let mut rt = Builder::new().basic_scheduler().enable_all().build().unwrap();
|
||||
let rt_handle = rt.handle().clone();
|
||||
|
||||
@@ -31,7 +31,7 @@ const UDP_ECHO_SERVER_ADDR: &str = "127.0.0.1:50403";
|
||||
const UDP_LOCAL_ADDR: &str = "127.0.0.1:9011";
|
||||
|
||||
const PASSWORD: &str = "test-password";
|
||||
const METHOD: CipherType = CipherType::Aes128Cfb;
|
||||
const METHOD: CipherType = CipherType::Aes128Gcm;
|
||||
|
||||
fn get_svr_config() -> Config {
|
||||
let mut cfg = Config::new(ConfigType::Server);
|
||||
|
||||
Reference in New Issue
Block a user