Sha256: 2d84ea5c066eb5ab8a079d8f960bbae6536b4e2fcf200ecf012ee3d27da1fe1a
Contents?: true
Size: 763 Bytes
Versions: 1
Compression:
Stored size: 763 Bytes
Contents
require 'openssl' module TwitterAuth module Cryptify class Error < StandardError; end mattr_accessor :crypt_password @@crypt_password = '--TwitterAuth-!##@--2ef' def self.encrypt(data, salt) cipher = OpenSSL::Cipher::Cipher.new('aes-256-cbc') cipher.encrypt cipher.pkcs5_keyivgen(crypt_password, salt) encrypted_data = cipher.update(data) encrypted_data << cipher.final end def self.decrypt(encrypted_data, salt) cipher = OpenSSL::Cipher::Cipher.new('aes-256-cbc') cipher.decrypt cipher.pkcs5_keyivgen(crypt_password, salt) data = cipher.update(encrypted_data) data << cipher.final end def self.generate_salt [rand(2**64 - 1)].pack("Q") end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mbleigh-twitter-auth-0.0.1 | lib/twitter_auth/cryptify.rb |