0.0
No commit activity in last 3 years
No release in over 3 years
There's a lot of open issues
Provides simple wrappers around openssl crypto implementation.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 12.3
~> 3.0
~> 2.2.23
 Project Readme

EasyCrypto Build Status Gem Version

Provides simple wrappers around the openssl crypto implementation. The library provides two interfaces: simple and advanced. Simple mode is designed for ease-of-use and advanced mode provides some performance benefits in certain use-cases. See below for more details.

All the underlying crypto operations are the same.

Installation

Add this line to your application's Gemfile:

gem 'easy-crypto'

And then execute:

$ bundle

Or install it yourself as:

$ gem install easy-crypto

Simple usage (Recommended)

require 'easycrypto'

password = 'secret password'
plaintext = 'some data'

ecrypto = EasyCrypto::Crypto.new

encrypted = ecrypto.encrypt(password, plaintext)
decrypted = ecrypto.decrypt(password, encrypted)

decrypted == plaintext

Advanced usage (Use for performance)

Key derivation is a resource heavy process. The simple interface abstracts this away and forces you to recompute the key before each encryption/decryption process.

This interface allows you to cache the result of the key derivation. This is required if you need to encrypt/decrypt multiple times with the same derived key. Caching the key saves you the time to have to recompute it before every encryption/decryption.

require 'easycrypto'

password = 'secret password'
plaintext = 'data to encrypt ...'

ecrypto = EasyCrypto::Crypto.new

key = EasyCrypto::Key.generate(key_password)

encrypted = ecrypto.encrypt_with_key(key, plaintext)
decrypted = ecrypto.decrypt_with_key(key, encrypted)

decrypted == plaintext

License

The gem is available as open source under the terms of the MIT License.