Sha256: 1d79d9a1ccd81604adaf9b184cadb83cdffed4e8264ad76d7e28b8e3eb6ed88e
Contents?: true
Size: 811 Bytes
Versions: 18
Compression:
Stored size: 811 Bytes
Contents
# -*- coding: utf-8 -*- require 'base64' require 'openssl' module Mushikago module Auth # 署名を作成するクラス class Signer # @return [String] シークレットキー attr_reader :secret_key # @param [String] secret_key シークレットキー def initialize secret_key @secret_key = secret_key end # @param [String] string_to_sign 署名の元になる文字列 # @param [String] digest_method 署名作成のアルゴリズム # @return [String] 署名 def sign(string_to_sign, digest_method='sha256') Base64.encode64( OpenSSL::HMAC.digest( OpenSSL::Digest::Digest.new(digest_method), secret_key, string_to_sign ) ).strip end end end end
Version data entries
18 entries across 18 versions & 1 rubygems