cryptopals

package module
v0.0.0-...-89ecc63 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2018 License: MIT Imports: 27 Imported by: 0

README

Matasano Crypto Challenges Build Status Go Report Card license

Go solutions to the Matasano Crypto Challenges (http://cryptopals.com/). Solutions to the previous challenges are written in Erlang and can be found here.

Set 4: Stream crypto and randomness

  1. Break an MD4 keyed MAC using length extension (problem, solution, test)
  2. Implement and break HMAC-SHA1 with an artificial timing leak (problem, solution, test)
  3. Break HMAC-SHA1 with a slightly less artificial timing leak (problem, solution, test)

Set 5: Diffie-Hellman and friends

  1. Implement Diffie-Hellman (problem, solution, test)
  2. Implement a MITM key-fixing attack on Diffie-Hellman with parameter injection (problem, solution, test)
  3. Implement DH with negotiated groups, and break with malicious "g" parameters (problem, solution, test)
  4. Implement Secure Remote Password (SRP) (problem, solution, test)
  5. Break SRP with a zero key (problem, solution, test)
  6. Offline dictionary attack on simplified SRP (problem, solution, test)
  7. Implement RSA (problem, solution, test)
  8. Implement an E=3 RSA Broadcast attack (problem, solution, test)

Set 6: RSA and DSA

  1. Implement unpadded message recovery oracle (problem, solution, test)
  2. Bleichenbacher's e=3 RSA Attack (problem, solution, test)
  3. DSA key recovery from nonce (problem, solution, test)
  4. DSA nonce recovery from repeated nonce (problem, solution, test)
  5. DSA parameter tampering (problem, solution, test)
  6. RSA parity oracle (problem, solution, test)
  7. Bleichenbacher's PKCS 1.5 Padding Oracle (Simple Case) (problem, solution, test)
  8. Bleichenbacher's PKCS 1.5 Padding Oracle (Complete Case) (problem, solution, test)

Set 7: Hashes

  1. CBC-MAC Message Forgery (problem, solution, test)
  2. Hashing with CBC-MAC (problem, solution, test)
  3. Compression Ratio Side-Channel Attacks (problem, solution, test)

Set 8: Abstract Algebra

  1. Diffie-Hellman Revisited: Small Subgroup Confinement (problem)
  2. Pollard's Method for Catching Kangaroos (problem)
  3. Elliptic Curve Diffie-Hellman and Invalid-Curve Attacks (problem)
  4. Single-Coordinate Ladders and Insecure Twists (problem)
  5. Duplicate-Signature Key Selection in ECDSA (and RSA) (problem)
  6. Key-Recovery Attacks on ECDSA with Biased Nonces (problem)
  7. Key-Recovery Attacks on GCM with Repeated Nonces (problem)
  8. Key-Recovery Attacks on GCM with a Truncated MAC (problem)
  9. Truncated-MAC GCM Revisited: Improving the Key-Recovery Attack via Ciphertext Length Extension (problem)
  10. Exploiting Implementation Errors in Diffie-Hellman (problem)
  1. Bleichenbacher's RSA signature forgery based on implementation error (challenge 42)
  2. The Debian PGP disaster that almost was (challenge 43)
  3. DSA requirements for random k value (challenge 44)
  4. Chosen Ciphertext Attacks Against Protocols Based on the RSA Encryption Standard PKCS #1 (challenges 47 and 48)
  5. Why I hate CBC-MAC (challenge 49)
  6. The CRIME attack (challenge 51)

Documentation

Overview

Package cryptopals implements the MD4 hash algorithm as defined in RFC 1320.

Index

Constants

View Source
const BlockSize = 64

BlockSize represents the blocksize of MD4 in bytes.

View Source
const Size = 16

Size represents the size of an MD4 checksum in bytes.

Variables

This section is empty.

Functions

func AesCbcDecrypt

func AesCbcDecrypt(ciphertext, key []byte) []byte

AesCbcDecrypt decrypts the ciphertext using given key. It assumes that IV is prepended to the ciphertext.

func AesCbcEncrypt

func AesCbcEncrypt(message, key []byte) []byte

AesCbcEncrypt encrypts the message using given key and random IV. IV is prepended to the ciphertext.

func CbcMacHash

func CbcMacHash(message, key []byte) []byte

CbcMacHash calculates CBC-MAC hash for a given message using zero IV.

func CbcMacSign

func CbcMacSign(message, key []byte, iv []byte) []byte

CbcMacSign calculates CBC-MAC for a given message. IV and MAC are appended to the plaintext.

func CbcMacSignFixedIv

func CbcMacSignFixedIv(message, key []byte) []byte

CbcMacSignFixedIv calculates CBC-MAC for a given message using zero IV. MAC is appended to the plaintext.

func CbcMacVerify

func CbcMacVerify(msg, key []byte) bool

CbcMacVerify verifies CBC-MAC for a given message. It assumes that IV and MAC are appended to the plaintext.

func CbcMacVerifyFixedIv

func CbcMacVerifyFixedIv(msg, key []byte) bool

CbcMacVerifyFixedIv verifies CBC-MAC for a given message. It assumes that IV is zero and MAC is appended to the plaintext.

func New

func New() hash.Hash

New returns a new hash.Hash computing the MD4 checksum.

Types

type Network

type Network interface {
	Read() interface{}
	Write(interface{})
}

Network simulates reliable bidirectional network stream.

Jump to

Keyboard shortcuts

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