Created
June 14, 2019 05:01
-
-
Save pmatsinopoulos/0ce7e205eec8777d0688189fc5da4f3f to your computer and use it in GitHub Desktop.
2d4b773e721dea3425da25823f3d7691.ruby
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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