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
|
//
// ShadowsocksCipher.swift
// MullvadVPN
//
// Created by pronebird on 13/11/2023.
// Copyright © 2023 Mullvad VPN AB. All rights reserved.
//
import Foundation
/// Type representing a shadowsocks cipher.
struct ShadowsocksCipher: RawRepresentable, CustomStringConvertible, Equatable, Hashable, Codable {
let rawValue: String
var description: String {
rawValue
}
/// Default cipher.
static let `default` = ShadowsocksCipher(rawValue: "chacha20")
/// All supported ciphers.
static let supportedCiphers = supportedCipherIdentifiers.map { ShadowsocksCipher(rawValue: $0) }
}
private let supportedCipherIdentifiers = [
// Stream ciphers.
"aes-128-cfb",
"aes-128-cfb1",
"aes-128-cfb8",
"aes-128-cfb128",
"aes-256-cfb",
"aes-256-cfb1",
"aes-256-cfb8",
"aes-256-cfb128",
"rc4",
"rc4-md5",
"chacha20",
"salsa20",
"chacha20-ietf",
// AEAD ciphers.
"aes-128-gcm",
"aes-256-gcm",
"chacha20-ietf-poly1305",
"xchacha20-ietf-poly1305",
"aes-128-pmac-siv",
"aes-256-pmac-siv",
]
|