GithubHelp home page GithubHelp logo

cryptopals's Introduction

Cryptopals Crypto Challenges

Link: https://cryptopals.com/

Done: 66/66

Resources

References (see also 8/)

Using Python 3

Related modules

  • os: contains urandom()
  • secrets: secure (strongly non predictable and reproducible) alternative to the random module (Mersenne Twister-based pseudo-random number generator, reproducible)
  • hashlib: secure hash functions
  • hmac: keyed-hashing for authentication
  • base64: common binary-to-text encodings

Conversions

bytes   -> int             int.from_bytes(b, 'big')
int     -> bytes           i.to_bytes(length, 'big')
                           i.to_bytes((i.bit_length()+7)//8, 'big')
bytes   -> hex str         b.hex()
hex str -> bytes           bytes.fromhex(h)
int -> hex repr (0x..)     hex(i)
int -> bin repr (0b..)     bin(i)

Personal favorites

Most valuable

  • 3.17 (CBC padding oracle): A simple padding oracle leak allows easy decryption.
  • 7.51 (CRIME): Analog to timing-leak attacks but taking advantage of compression. Not that surprising in theory, but performs amazingly well in practice.
  • 8.62 (ECDSA biased nonces): A minor bias of a few bits in the DSA temporary keys reveals the private key after only capturing a handful of signatures. Unbelievably powerful reduction to an LLL problem.
  • 8.64 (GCM short tags): When GCM is used with short truncated MACs, a single captured message + an available auth. oracle spectacularly snowball to revealing the auth. key.

Honorable mentions

  • 4.29 (Merkle–Damgård secret-prefix MAC): On why one should not consider a hash function as an inviolable black box when building a MAC (and use HMAC instead).
  • 7.50 (CBC-MAC hashing): On why (conversely) a MAC with a fixed key does not make a proper hash function (it is only true for HMAC by design).
  • 8.61 (RSA sig. dup.): On using discrete log techniques to build RSA keys to validate a given signature (or decrypt a given message to a target plaintext).
  • 8.63 (GCM repeated nonce): Repeating a GCM nonce once already (almost) reveals the auth. key. Interesting for the maths it involves, not that surprising though.

cryptopals's People

Contributors

blegloannec avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.