Skip to content

Instantly share code, notes, and snippets.

View bosswissam's full-sized avatar

Wissam Jarjoui bosswissam

View GitHub Profile
@tarcieri
tarcieri / ecb_is_bad.rb
Created July 12, 2012 01:56
An chosen plaintext attack on ECB mode allowing recovery of encrypted messages
require 'openssl'
# Don't use this
module Encryption
def self.cipher(mode)
cipher = OpenSSL::Cipher::Cipher.new("aes-256-ecb")
cipher.send mode
cipher.key = "ABANDON ALL HOPE YE WHO USE ECB!"
cipher.padding = 0
cipher
@craSH
craSH / aes_ctr-chosen_plaintext.py
Created June 22, 2012 01:18
Simple chosen-plaintext attack on AES-CTR given NONCE and IV re-use for multiple ciphertexts. Basically just a OTP chosen-plaintext attack implementation.
#!/usr/bin/env python
"""
Simple chosen-plaintext attack on AES-CTR given NONCE and IV re-use for
multiple ciphertexts
Copyleft 2011 Ian Gallagher <crash@neg9.org>
"""
import sys
def decrypt(keystream, ciphertext):