module SwiftStorage::Utils

Public Instance Methods

hmac(type, key, data) click to toggle source
# File lib/swift_storage/utils.rb, line 6
def hmac(type, key, data)
  digest = OpenSSL::Digest.new(type)
  OpenSSL::HMAC.digest(digest, key, data)
end
sig_to_hex(str) click to toggle source
# File lib/swift_storage/utils.rb, line 11
def sig_to_hex(str)
  Digest.hexencode(str)
end
struct(h) click to toggle source
# File lib/swift_storage/utils.rb, line 15
def struct(h)
  return if h.empty?
  Struct.new(*h.keys.map(&:to_sym)).new(*h.values)
end