1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
use crate::packet::Data;

pub fn init() -> Vec<u8> {
    let mut data = Data::new();
    for x in ALGORITHMS {
        data.put_str(x);
    }
    data.to_vec()
}

pub const ALGORITHMS: [&str; 8] = [
    KEY_EXCHANGE_ALGORITHMS,
    PUBLIC_KEY_ALGORITHMS,
    ENCRYPTION_ALGORITHMS,
    ENCRYPTION_ALGORITHMS,
    MAC_ALGORITHMS,
    MAC_ALGORITHMS,
    COMPRESSION_ALGORITHMS,
    COMPRESSION_ALGORITHMS,
];


// 密钥交换算法
#[allow(dead_code)]
pub const KEY_EXCHANGE_CURVE25519_SHA256: &str = "curve25519-sha256";
#[allow(dead_code)]
pub const KEY_EXCHANGE_ECDH_SHA2_NISTP256: &str = "ecdh-sha2-nistp256";
#[allow(dead_code)]
pub const KEY_EXCHANGE_ALGORITHMS: &str = "curve25519-sha256,ecdh-sha2-nistp256";


// 公钥算法
#[allow(dead_code)]
pub const PUBLIC_KEY_ED25519: &str = "ssh-ed25519";
#[allow(dead_code)]
pub const PUBLIC_KEY_RSA: &str = "ssh-rsa";
#[allow(dead_code)]
pub const PUBLIC_KEY_ALGORITHMS: &str = "ssh-rsa,ssh-ed25519";

// 对称加密算法
#[allow(dead_code)]
pub const ENCRYPTION_CHACHA20_POLY1305_OPENSSH: &str = "chacha20-poly1305@openssh.com";
#[allow(dead_code)]
pub const ENCRYPTION_ALGORITHMS: &str = "chacha20-poly1305@openssh.com";


// 哈希散列算法
#[allow(dead_code)]
pub const MAC_ALGORITHMS: &str = "none";

// 压缩算法
#[allow(dead_code)]
pub const COMPRESSION_ALGORITHMS: &str = "none";