shadowsocks_crypto/
lib.rs

1//! Shadowsocks Cipher implementation
2
3#![cfg_attr(docsrs, feature(doc_cfg))]
4
5#[cfg(feature = "v1")]
6#[cfg_attr(docsrs, doc(cfg(feature = "v1")))]
7pub mod v1;
8
9#[cfg(feature = "v2")]
10#[cfg_attr(docsrs, doc(cfg(feature = "v2")))]
11pub mod v2;
12
13pub mod kind;
14pub mod utils;
15
16pub use self::kind::{CipherCategory, CipherKind};
17
18/// Get available ciphers in string representation
19///
20/// Commonly used for checking users' configuration input
21pub const fn available_ciphers() -> &'static [&'static str] {
22    &[
23        "plain",
24        "none",
25        #[cfg(feature = "v1-stream")]
26        "table",
27        #[cfg(feature = "v1-stream")]
28        "rc4-md5",
29        // Stream Ciphers
30        #[cfg(feature = "v1-stream")]
31        "aes-128-ctr",
32        #[cfg(feature = "v1-stream")]
33        "aes-192-ctr",
34        #[cfg(feature = "v1-stream")]
35        "aes-256-ctr",
36        #[cfg(feature = "v1-stream")]
37        "aes-128-cfb",
38        #[cfg(feature = "v1-stream")]
39        "aes-128-cfb1",
40        #[cfg(feature = "v1-stream")]
41        "aes-128-cfb8",
42        #[cfg(feature = "v1-stream")]
43        "aes-128-cfb128",
44        #[cfg(feature = "v1-stream")]
45        "aes-192-cfb",
46        #[cfg(feature = "v1-stream")]
47        "aes-192-cfb1",
48        #[cfg(feature = "v1-stream")]
49        "aes-192-cfb8",
50        #[cfg(feature = "v1-stream")]
51        "aes-192-cfb128",
52        #[cfg(feature = "v1-stream")]
53        "aes-256-cfb",
54        #[cfg(feature = "v1-stream")]
55        "aes-256-cfb1",
56        #[cfg(feature = "v1-stream")]
57        "aes-256-cfb8",
58        #[cfg(feature = "v1-stream")]
59        "aes-256-cfb128",
60        #[cfg(feature = "v1-stream")]
61        "aes-128-ofb",
62        #[cfg(feature = "v1-stream")]
63        "aes-192-ofb",
64        #[cfg(feature = "v1-stream")]
65        "aes-256-ofb",
66        #[cfg(feature = "v1-stream")]
67        "camellia-128-ctr",
68        #[cfg(feature = "v1-stream")]
69        "camellia-192-ctr",
70        #[cfg(feature = "v1-stream")]
71        "camellia-256-ctr",
72        #[cfg(feature = "v1-stream")]
73        "camellia-128-cfb",
74        #[cfg(feature = "v1-stream")]
75        "camellia-128-cfb1",
76        #[cfg(feature = "v1-stream")]
77        "camellia-128-cfb8",
78        #[cfg(feature = "v1-stream")]
79        "camellia-128-cfb128",
80        #[cfg(feature = "v1-stream")]
81        "camellia-192-cfb",
82        #[cfg(feature = "v1-stream")]
83        "camellia-192-cfb1",
84        #[cfg(feature = "v1-stream")]
85        "camellia-192-cfb8",
86        #[cfg(feature = "v1-stream")]
87        "camellia-192-cfb128",
88        #[cfg(feature = "v1-stream")]
89        "camellia-256-cfb",
90        #[cfg(feature = "v1-stream")]
91        "camellia-256-cfb1",
92        #[cfg(feature = "v1-stream")]
93        "camellia-256-cfb8",
94        #[cfg(feature = "v1-stream")]
95        "camellia-256-cfb128",
96        #[cfg(feature = "v1-stream")]
97        "camellia-128-ofb",
98        #[cfg(feature = "v1-stream")]
99        "camellia-192-ofb",
100        #[cfg(feature = "v1-stream")]
101        "camellia-256-ofb",
102        #[cfg(feature = "v1-stream")]
103        "rc4",
104        #[cfg(feature = "v1-stream")]
105        "chacha20-ietf",
106        // AEAD Ciphers
107        #[cfg(feature = "v1-aead")]
108        "aes-128-gcm",
109        #[cfg(feature = "v1-aead")]
110        "aes-256-gcm",
111        #[cfg(feature = "v1-aead")]
112        "chacha20-ietf-poly1305",
113        #[cfg(feature = "v1-aead-extra")]
114        "aes-128-ccm",
115        #[cfg(feature = "v1-aead-extra")]
116        "aes-256-ccm",
117        #[cfg(feature = "v1-aead-extra")]
118        "aes-128-gcm-siv",
119        #[cfg(feature = "v1-aead-extra")]
120        "aes-256-gcm-siv",
121        #[cfg(feature = "v1-aead-extra")]
122        "xchacha20-ietf-poly1305",
123        // #[cfg(feature = "v1-aead-extra")]
124        // "sm4-gcm",
125        // #[cfg(feature = "v1-aead-extra")]
126        // "sm4-ccm",
127        // AEAD 2022 Ciphers
128        #[cfg(feature = "v2")]
129        "2022-blake3-aes-128-gcm",
130        #[cfg(feature = "v2")]
131        "2022-blake3-aes-256-gcm",
132        #[cfg(feature = "v2")]
133        "2022-blake3-chacha20-poly1305",
134        #[cfg(feature = "v2-extra")]
135        "2022-blake3-chacha8-poly1305",
136    ]
137}