set1

package
v0.0.0-...-dc0442f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 30, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BreakRepeatingKeyXor

func BreakRepeatingKeyXor(data []byte, numCandidates int) ([][]byte, error)

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

func BreakSingleByteXor(data []byte) []byte

BreakSingleByteXor decrypts a cipher encrypted with single-byte XOR.

func DecryptAesEcbMode

func DecryptAesEcbMode(data, key []byte) ([]byte, error)

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

func DetectAesEcbMode(data []byte, blockSize int) bool

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

func DetectSingleByteXor(data [][]byte) []byte

DetectSingleByteXor returns the input buffer that is most likely to have been encrypted with single-byte XOR.

func EncryptRepeatingKeyXor

func EncryptRepeatingKeyXor(plaintext, key []byte) []byte

EncryptRepeatingKeyXor encrypts plaintext with repeating-key XOR.

func FixedXor

func FixedXor(data1, data2 []byte) ([]byte, error)

FixedXor returns the result of XOR-ing every byte of two input buffers.

func HammingDistance

func HammingDistance(b1, b2 []byte) (int, error)

HammingDistance computes the Hamming distance between two buffers.

func HexToBase64

func HexToBase64(data string) (string, error)

HexToBase64 converts a hex string to a base64 encoded string.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL