Documentation ¶
Index ¶
- func AddPadding(bytes []byte, keysize int) []byte
- func AppendRandomBytesInFrontAndBack(input []byte) (output []byte)
- func CheckIfMinDistanceIsEqual3Times(decodedBytesFromFile []byte, keysize int) bool
- func ComputeHammingDistance(by1 []byte, by2 []byte) (result int)
- func CreateTableOfAllRepeatingKeyXORsWithInput(input string) []string
- func DiscoverBlockSize(sillyOracle Oracle) (estimatedKeyLength int, addedPseudoPadding int, doubleBytePosition int)
- func EnglishCount(input string) (count int)
- func FindMostEnglishString(decodedString []string) (letter int, bestString string)
- func FindThreeEqualDistances(slice [][]byte) (ThreeEqual bool)
- func GetByteListFromClonedString(size int, letter string) []byte
- func GetCypherMap(sillyOracle Oracle, keysize int, oneByteShortByteList []byte) map[string]string
- func GetMinDistanceInKeysizeMultiComparison(decodedBytesFromFile []byte, keysize int, nSlices int) (minDistanceFound int, positionofDoubleByte int)
- func GetRandomBytes(numberOfBytes int) (randomBytes []byte)
- func GetRandomInt(maxValue int) (int, error)
- func HexStringToBase64(msg string) (output string, err error)
- func HexStringToBytes(msg string) (output []byte, err error)
- func MinOfDistances(slice [][]byte, currentMin int, tempSliceNumber int, ...) (sum int)
- func PaddingOracleAttack(attackedOracle Oracle) string
- func RemovePaddingAndFlatten2DArray(bytesToFlatten [][]byte) (flatBytes []byte)
- func XOROnBytes(by1 []byte, by2 []byte) []byte
- type Oracle
- type PrefixInputPostfixCBCOracle
- type PrefixInputPostfixECBOracle
- type RandomPrefixInputPostfixECBOOrCBCOracle
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendRandomBytesInFrontAndBack ¶
AppendRandomBytesInFrontAndBack abc
func CheckIfMinDistanceIsEqual3Times ¶
CheckIfMinDistanceIsEqual3Times UNTESTED, DO NOT USE
func ComputeHammingDistance ¶
ComputeHammingDistance abc
func CreateTableOfAllRepeatingKeyXORsWithInput ¶
CreateTableOfAllRepeatingKeyXORsWithInput Creates a table with 128 ASCII chars repeated len(input) times, then XORs it with the input.
func DiscoverBlockSize ¶
func DiscoverBlockSize(sillyOracle Oracle) (estimatedKeyLength int, addedPseudoPadding int, doubleBytePosition int)
DiscoverBlockSize abc
func EnglishCount ¶
EnglishCount Counts all the instances of letters in "etaoin shrdlu"
func FindMostEnglishString ¶
FindMostEnglishString To find highest probability of an English text, applies a counter on letters in "etaoin shrdlu" on a set of strings, returning the one that has the most.
func FindThreeEqualDistances ¶
FindThreeEqualDistances UNTESTED, DO NOT USE
func GetByteListFromClonedString ¶
GetByteListFromClonedString abc
func GetCypherMap ¶
GetCypherMap abc
func GetMinDistanceInKeysizeMultiComparison ¶
func GetMinDistanceInKeysizeMultiComparison(decodedBytesFromFile []byte, keysize int, nSlices int) (minDistanceFound int, positionofDoubleByte int)
GetMinDistanceInKeysizeMultiComparison Function to find the minimal Hamming distance for multiple ciphered blocks and if the distance is equal to 0, the position of the first doubled element
func GetRandomBytes ¶
GetRandomBytes abc
func HexStringToBase64 ¶
HexStringToBase64 abc
func HexStringToBytes ¶
HexStringToBytes abc
func MinOfDistances ¶
func MinOfDistances(slice [][]byte, currentMin int, tempSliceNumber int, outsideValueForDoubleBytesPosition *int) (sum int)
MinOfDistances Recursive function to go through a 2D slice of bytes to calculate a minimal distance and if
func PaddingOracleAttack ¶
PaddingOracleAttack abc
func RemovePaddingAndFlatten2DArray ¶
RemovePaddingAndFlatten2DArray Flattens and removes padding from a 2D array that it is provided
Types ¶
type Oracle ¶
type Oracle interface { PrepareInputString(input string) (output string) Encrypt([]byte) []byte Decrypt([]byte) []byte }
Oracle interface type for all encryption functions
type PrefixInputPostfixCBCOracle ¶
type PrefixInputPostfixCBCOracle struct {
// contains filtered or unexported fields
}
PrefixInputPostfixCBCOracle aaa
func (*PrefixInputPostfixCBCOracle) Decrypt ¶
func (myOracle *PrefixInputPostfixCBCOracle) Decrypt(bytesToDecrypt []byte) []byte
Decrypt abc
func (*PrefixInputPostfixCBCOracle) Encrypt ¶
func (myOracle *PrefixInputPostfixCBCOracle) Encrypt(unpaddedBytesToEncrypt []byte, iv []byte) []byte
Encrypt abc
func (*PrefixInputPostfixCBCOracle) PrepareInputString ¶
func (myOracle *PrefixInputPostfixCBCOracle) PrepareInputString(input string) (output string)
PrepareInputString abc
type PrefixInputPostfixECBOracle ¶
type PrefixInputPostfixECBOracle struct {
// contains filtered or unexported fields
}
PrefixInputPostfixECBOracle aaa
func (*PrefixInputPostfixECBOracle) Decrypt ¶
func (myOracle *PrefixInputPostfixECBOracle) Decrypt(bytesToDecrypt []byte) []byte
Decrypt abc
func (*PrefixInputPostfixECBOracle) Encrypt ¶
func (myOracle *PrefixInputPostfixECBOracle) Encrypt(unpaddedBytesToEncrypt []byte) []byte
Encrypt abc
func (*PrefixInputPostfixECBOracle) PrepareInputString ¶
func (myOracle *PrefixInputPostfixECBOracle) PrepareInputString(input string) (output string)
PrepareInputString abc
type RandomPrefixInputPostfixECBOOrCBCOracle ¶
type RandomPrefixInputPostfixECBOOrCBCOracle struct { CBCOracle Oracle EBCOracle Oracle // contains filtered or unexported fields }
RandomPrefixInputPostfixECBOOrCBCOracle abc