shadowsocks_crypto/v1/
dummy.rs

1use crate::kind::{CipherCategory, CipherKind};
2
3/// Dummy cipher
4#[derive(Clone)]
5pub struct DummyCipher;
6
7impl core::fmt::Debug for DummyCipher {
8    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
9        f.debug_struct("DummyCipher").finish()
10    }
11}
12
13impl DummyCipher {
14    pub fn new() -> Self {
15        Self
16    }
17
18    pub fn kind(&self) -> CipherKind {
19        CipherKind::NONE
20    }
21
22    pub fn category(&self) -> CipherCategory {
23        CipherCategory::None
24    }
25
26    pub fn tag_len(&self) -> usize {
27        0
28    }
29
30    pub fn encrypt(&mut self, _plaintext_in_ciphertext_out: &mut [u8]) {}
31
32    pub fn decrypt(&mut self, _ciphertext_in_plaintext_out: &mut [u8]) -> bool {
33        true
34    }
35}
36
37impl Default for DummyCipher {
38    fn default() -> Self {
39        Self::new()
40    }
41}