0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Simple gem that uses ruby's OpenSSL package to simplify normal cipher use.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 1.8
~> 10.0
 Project Readme

I no longer intend to maintain this project. At the very least, this means that you should verify its security yourself before using it. If anyone would like to maintain it, drop me a line.

EasyCipher

A simple gem that uses ruby's OpenSSL package to simplify normal cipher use. It does not rely on any external libraries.

Installation

Add this line to your application's Gemfile:

gem 'easy_cipher'

And then execute:

$ bundle

Or install it yourself as:

$ gem install easy_cipher

Usage

To create an entirely new cipher

cipher = EasyCipher::Cipher.new
encrypted_data = cipher.encrypt "my data"
decrypted_data = cipher.decrypt encrypted_data
=> "my data"

cipher.key
=> "ZE\xD9\xE2B\n2J1\xDF\x10$\x03A\xB95\xE9P\xDF\xD5\xF6\xAA<\x06C\x82~\x06]\xBB\xE1G"

cipher.iv
=> "QHB\xE6\xEDpE\xDCha\x80\x02\xDB\xA5A\xAB"

To create a cipher from a known key, iv

known_cipher = EasyCipher::Cipher.new(known_key, known_iv)

# then use it as normal.

You can also create from base64 encoded values

key64 = my_first_cipher.key64
iv64 = my_first_cipher.iv64
new_cipher = EasyCipher::Cipher.new64(key64,iv64)

# then use it as normal.
# Base64 encodings work with SQL string fields.

Contributing

  1. Fork it ( https://github.com/malakai97/easy_cipher/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request