unsafeaes

package
v0.0.0-...-2bbf1a2 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package unsafeaes contains helper functions used in solving the Matasano Cryptopals challenges and is in no way an actual usable set of cryptographic tools

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecryptCBC

func DecryptCBC(ciphertext []byte, key []byte) (plaintext []byte, err error)

DecryptCBC decrypts a provided ciphertext encrypted with AES-CBC mode using the provided key.

func DetectBlockSize

func DetectBlockSize(oracle Oracle) (blockSize int, err error)

DetectBlockSize auto detects the block size (up to 1024 bytes) of the ciphertext returned by an oracle

func DetectMode

func DetectMode(oracle Oracle) (mode string, err error)

DetectMode looks for repeating blocks in the output text to try to determine if a provided encryption oracle is using EBC mode or not

since we fed a series of 0's to it, ECB will result in at least 2 consecutive duplicate blocks existing, while CBC will not.

func EncryptCBC

func EncryptCBC(plaintext []byte, key []byte) (ciphertext []byte, err error)

EncryptCBC encrypts the provided plaintext using AES in CBC mode using the provided key

func EncryptECB

func EncryptECB(plaintext, key []byte) (ciphertext []byte, err error)

EncryptECB encrypts the provided plaintext using AES in EBC mode

Types

type Oracle

type Oracle interface {
	Encrypt(plaintext []byte) (ciphertext []byte, err error)
}

Oracle will take an input plaintext, possibly prepend and/or append unknown text to the plaintext and then encrypt or otherwise prform an unknown cryptographic operation on the resulting input and return the result

Jump to

Keyboard shortcuts

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