Documentation ¶
Index ¶
- func Base64Decode(text []byte) ([]byte, error)
- func Base64Encode(text []byte) []byte
- func DecryptAESECB(text, key []byte) ([]byte, error)
- func DetectECB(text []byte) bool
- func FixedKeyXOR(text, key []byte) ([]byte, error)
- func GuessXORKeySize(text []byte) ([]int, error)
- func HammingDistance(one, two []byte) (int, error)
- func HexDecode(text []byte) ([]byte, error)
- func HexEncode(text []byte) []byte
- func HexToBase64(text []byte) ([]byte, error)
- func PKCS7Padding(text []byte, blockSize int) []byte
- func PKCS7PaddingStrip(text []byte, blockSize int) []byte
- func RepeatingKeyXOR(text, key []byte) ([]byte, error)
- func ScoreEnglish(text []byte) int
- func StripBytes(s []byte, c byte) []byte
- func TransposeBlocks(in []byte, size int) [][]byte
- type KeyScore
- type KeySize
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Base64Decode ¶
Base64Decode decodes a base64 byte slice into an byte slice
func Base64Encode ¶
Base64Encode encodes a byte slice into a base64 byte slice
func DecryptAESECB ¶
DecryptAESECB decrypts some text that has been encrypted with AES in ECB mode.
func DetectECB ¶
DetectECB detects whether a byte slice has been encrypted in ECB mode by seeing if it has repeating blocks of data.
func FixedKeyXOR ¶
FixedKeyXOR encrypts some text against a key of the same size.
func GuessXORKeySize ¶
GuessXORKeySize guesses the most likely key size for some XORed text. The results are sorted in order of probability.
func HammingDistance ¶
HammingDistance returns the number of differences between two byte slices: https://en.wikipedia.org/wiki/Hamming_distance
func HexToBase64 ¶
HexToBase64 converts hexadecimal encoded text to base64.
func PKCS7Padding ¶
PKCS7Padding adds PKCS#7 padding to a byte slice. https://en.wikipedia.org/wiki/Padding_(cryptography)#PKCS7
func PKCS7PaddingStrip ¶
PKCS7PaddingStrip strips PKCS#7 padding from a byte slice. https://en.wikipedia.org/wiki/Padding_(cryptography)#PKCS7
func RepeatingKeyXOR ¶
RepeatingKeyXOR encrypts some text against a repeating key of a smaller size.
func ScoreEnglish ¶
ScoreEnglish returns a score indicating the likelihood that a string is comprised of English words by counting the most commonly occurring letters in the English language.
func StripBytes ¶
StripBytes removes all occurrences of a byte from a byte slice.
func TransposeBlocks ¶
TransposeBlocks divides the input into blocks of size and returns a slice of byte slices, the first containining the first byte from each block, the second containing the second byte for each block, etc.
Types ¶
type KeyScore ¶
KeyScore can be used to keep track of the most likely key.
func BruteForceMultiByteXOR ¶
BruteForceMultiByteXOR finds the multi byte key that some text has been XORed against.
func BruteForceSingleByteXOR ¶
BruteForceSingleByteXOR finds the single byte key that some text has been XORed against.