https://github.com/mdp/gibberish-aes-ruby
A fork of Alex Boussinet's Ruby AES library modified to support OpenSSL AES
https://github.com/mdp/gibberish-aes-ruby
Last synced: 8 months ago
JSON representation
A fork of Alex Boussinet's Ruby AES library modified to support OpenSSL AES
- Host: GitHub
- URL: https://github.com/mdp/gibberish-aes-ruby
- Owner: mdp
- License: mit
- Created: 2008-08-28T03:16:52.000Z (almost 18 years ago)
- Default Branch: master
- Last Pushed: 2008-09-01T00:20:13.000Z (almost 18 years ago)
- Last Synced: 2025-03-17T02:23:52.029Z (over 1 year ago)
- Language: Ruby
- Homepage: http://webchicanery.com
- Size: 563 KB
- Stars: 4
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.markdown
- License: COPYING
Awesome Lists containing this project
README
## gibberish-aes-ruby
---
Written by Alex Boussinet
Modified by Mark Percival
This ruby gem is simply a modification of Alex Boussinet's Ruby-AES(normal implemenation)
which can be found at
I've fixed 2 issues to make it compatible with OpenSSL:
- Correctly padding the blocks
- Generating a key and IV from a password and random salt
#
require 'rubygems'
require 'ruby-aes'
require 'base64'
enc = Aes.openssl_encrypt("pass", "test", :salt => "1831BD4EC8E35CC8", :size => 256, :mode => 'CBC')
p Base64.b64encode(enc[:salted])
dec = Aes.openssl_decrypt("pass", enc[:salted])
p dec
Valid modes are:
- ECB (Electronic Code Book)
- CBC (Cipher Block Chaining)
- OFB (Output Feedback)
- CFB (Cipher Feedback)
Valid key length:
- 128 bits
- 192 bits
- 256 bits
For a really good encryption, 256 bits CBC is recommanded.
For more information on AES-Rijndael, see: