Documentation ¶
Index ¶
- Constants
- Variables
- func B58Decode(b string) []byte
- func B58Encode(b []byte) string
- func BytesToUint32(b []byte) uint32
- func GunzipBuf(data []byte) []byte
- func GzipBuf(data []byte) ([]byte, error)
- func GzipBufBestCompression(data []byte) []byte
- func RemoveTrafficEncoder(name string) error
- func SaveTrafficEncoder(name string, wasmBin []byte) error
- func SetEnglishDictionary(dictionary []string)
- func SumWord(word string) int
- func UUID() string
- func Uint32ToBytes(n uint32) []byte
- type Base32
- type Base58
- type Base64
- type Encoder
- type EncoderFS
- type English
- type Gzip
- type Hex
- type NoEncoder
- type PNGEncoder
- type PassthroughEncoderFS
Constants ¶
const ( // EncoderModulus - The modulus used to calculate the encoder ID from a C2 request nonce // *** IMPORTANT *** ENCODER IDs MUST BE LESS THAN THE MODULUS EncoderModulus = uint64(65537) MaxN = uint64(9999999) // These were chosen at random other than the "No Encoder" ID (0) Base32EncoderID = uint64(65) Base58EncoderID = uint64(43) Base64EncoderID = uint64(131) EnglishEncoderID = uint64(31) GzipEncoderID = uint64(49) HexEncoderID = uint64(92) PNGEncoderID = uint64(22) NoEncoderID = uint64(0) )
Variables ¶
var ( TrafficEncoderFS = PassthroughEncoderFS{} PNG = PNGEncoder{} Nop = NoEncoder{} )
var EncoderMap = map[uint64]Encoder{ Base64EncoderID: Base64{}, Base58EncoderID: Base58{}, Base32EncoderID: Base32{}, HexEncoderID: Hex{}, EnglishEncoderID: English{}, GzipEncoderID: Gzip{}, PNGEncoderID: PNG, }
EncoderMap - A map of all available encoders (native and traffic/wasm)
var FastEncoderMap = map[uint64]Encoder{ Base64EncoderID: Base64{}, Base58EncoderID: Base58{}, Base32EncoderID: Base32{}, HexEncoderID: Hex{}, GzipEncoderID: Gzip{}, }
FastEncoderMap - Keeps track of fast native encoders that can be used for large messages
var TrafficEncoderMap = map[uint64]*traffic.TrafficEncoder{}
TrafficEncoderMap - Keeps track of the loaded traffic encoders (i.e., wasm-based encoder functions)
Functions ¶
func BytesToUint32 ¶ added in v0.0.3
func GzipBufBestCompression ¶
GzipBufBestCompression - Gzip a buffer using the best compression setting
func RemoveTrafficEncoder ¶
RemoveTrafficEncoder - Save a traffic encoder to the filesystem
func SaveTrafficEncoder ¶
SaveTrafficEncoder - Save a traffic encoder to the filesystem
func SetEnglishDictionary ¶
func SetEnglishDictionary(dictionary []string)
func Uint32ToBytes ¶ added in v0.0.3
Types ¶
type Encoder ¶
Encoder - Can losslessly encode arbitrary binary data
func EncoderFromNonce ¶
EncoderFromNonce - Convert a nonce into an encoder
func RandomEncoder ¶
RandomEncoder - Get a random nonce identifier and a matching encoder
type EncoderFS ¶
type EncoderFS interface { Open(name string) (fs.File, error) ReadDir(name string) ([]fs.DirEntry, error) ReadFile(name string) ([]byte, error) }
EncoderFS - Generic interface to read wasm encoders from a filesystem
type English ¶
type English struct{}
English Encoder - An ASCIIEncoder for binary to english text
type Gzip ¶
type Gzip struct{}
Gzip - Gzip compression encoder
type NoEncoder ¶
type NoEncoder struct{}
NoEncoder - A NOP encoder
type PNGEncoder ¶
type PNGEncoder struct{}
PNGEncoder - PNG image object
type PassthroughEncoderFS ¶
type PassthroughEncoderFS struct {
// contains filtered or unexported fields
}
PassthroughEncoderFS - Creates an encoder.EncoderFS object from a single local directory