Skip to content

Instantly share code, notes, and snippets.

View iagox86's full-sized avatar

Ron Bowes iagox86

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