Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save pmatsinopoulos/0ce7e205eec8777d0688189fc5da4f3f to your computer and use it in GitHub Desktop.
Save pmatsinopoulos/0ce7e205eec8777d0688189fc5da4f3f to your computer and use it in GitHub Desktop.
2d4b773e721dea3425da25823f3d7691.ruby
# File: encryption-7.rb
#
require 'digest'
module Encryption
module InstanceMethods
def encrypt
Digest::SHA256.base64digest message_to_encrypt
end
end
module ClassMethods
def encrypt(clear_text)
Digest::SHA256.base64digest clear_text
end
end
def self.included(base)
base.include Encryption::InstanceMethods
end
def self.extended(base)
base.extend Encryption::ClassMethods
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment