cryptopals

package module
v0.0.0-...-6fab2fb Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2023 License: MIT Imports: 3 Imported by: 0

README

cryptopals

Answers to the Matasano Cryptopals challenges.

Run go test ./solutions to check all solutions.

This code is extremely unsuited for production use — don't copy from it.

Documentation

Overview

Package cryptopals contains utility functions for the Cryptopals challenges.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Blocks

func Blocks(b []byte, n int) [][]byte

Blocks returns consecutive subslices of b of length n, except for the final block which may be shorter than n.

func HammingDistance

func HammingDistance(a, b []byte) int

HammingDistance returns the Hamming distance between a and b. If len(a) != len(b), it panics.

func ProbabilityIsEnglish

func ProbabilityIsEnglish(b []byte) float64

ProbabilityIsEnglish returns the probability that b is English text.

func XOR

func XOR(x, y []byte) []byte

XOR returns x ^ y. If len(x) != len(y), it panics.

func XORByte

func XORByte(x []byte, y byte) []byte

XORByte returns the result of xor'ing each byte of x with y.

func XORRepeat

func XORRepeat(x, y []byte) []byte

XORRepeat returns x ^ y, repeating y if it's too short. The result has length len(x).

Types

This section is empty.

Directories

Path Synopsis
Package alias implements memory aliasing tests.
Package alias implements memory aliasing tests.
Package ecb implements the electronic codebook (ECB) block cipher mode.
Package ecb implements the electronic codebook (ECB) block cipher mode.

Jump to

Keyboard shortcuts

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