Documentation ¶
Index ¶
- func BreakRepeatingKeyXor(data []byte, numCandidates int) ([][]byte, error)
- func BreakSingleByteXor(data []byte) []byte
- func DecryptAesEcbMode(data, key []byte) ([]byte, error)
- func DetectAesEcbMode(data []byte, blockSize int) bool
- func DetectSingleByteXor(data [][]byte) []byte
- func EncryptRepeatingKeyXor(plaintext, key []byte) []byte
- func FixedXor(data1, data2 []byte) ([]byte, error)
- func HammingDistance(b1, b2 []byte) (int, error)
- func HexToBase64(data string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BreakRepeatingKeyXor ¶
BreakRepeatingKeyXor decrypts a cipher encrypted with repeating-key XOR.
Given that we don't know the key size, it returns the N (numCandidates) buffers that are most likely to be the decrypted plaintext, ordered by decreasing likelihood with respect to the scoring function.
func BreakSingleByteXor ¶
BreakSingleByteXor decrypts a cipher encrypted with single-byte XOR.
func DecryptAesEcbMode ¶
DecryptAesEcbMode decrypts a cipher encrypted with AES-128 in ECB mode.
The Advanced Encryption Standard (AES) is a symmetric block cipher.
A block cipher mode of operation is an algorithm for applying a cipher's single-block operation repeatedly, which is necessary when the size of the data is greater than a single block.
The Electronic Codebook (ECB) is a block cipher mode of operation where the data is divided into blocks and each block is encrypted separately.
Why ECB should not be used anymore: https://crypto.stackexchange.com/questions/20941/why-shouldnt-i-use-ecb-encryption/20946#20946
func DetectAesEcbMode ¶
DetectAesEcbMode detects if a buffer is encrypted with AES-128 in ECB mode.
The detection algorithm is very naive: a buffer is considered to have been encrypted with ECB iff it contains at least one duplicate block.
func DetectSingleByteXor ¶
DetectSingleByteXor returns the input buffer that is most likely to have been encrypted with single-byte XOR.
func EncryptRepeatingKeyXor ¶
EncryptRepeatingKeyXor encrypts plaintext with repeating-key XOR.
func HammingDistance ¶
HammingDistance computes the Hamming distance between two buffers.
func HexToBase64 ¶
HexToBase64 converts a hex string to a base64 encoded string.
Types ¶
This section is empty.