module Dolla::EncryptionTools

Public Instance Methods

build_digest(*ary) click to toggle source
# File lib/dolla/encryption_tools.rb, line 6
def build_digest *ary
  sha1  = HMAC::SHA1.new Dolla.configuration.hmac_key
  sha1 << ary.join

  sha1.to_s
end
decimal_format(value) click to toggle source
# File lib/dolla/encryption_tools.rb, line 25
def decimal_format value
  sprintf "%0.2f", value
end
padding(key) click to toggle source
# File lib/dolla/encryption_tools.rb, line 13
def padding(key)
  final_key = "\0" * 16
  key.length.times { |i| final_key[i%16] ^= key[i] }

  final_key
end
rijndael_encrypt( value ) click to toggle source
# File lib/dolla/encryption_tools.rb, line 20
def rijndael_encrypt( value )
  rijndael = Crypt::Rijndael.new Base64.decode64(Dolla.configuration.rijndael_key), 128
  Base64.encode64( rijndael.encrypt_block( padding value ) ).strip
end