Sha256: 6865fc971c69166f1b9357ea9b55581237a66768a6bc047922fb56ca93536be2

Contents?: true

Size: 659 Bytes

Versions: 34

Compression:

Stored size: 659 Bytes

Contents

# Haplo Plugin Tool             http://docs.haplo.org/dev/tool/plugin
# (c) Haplo Services Ltd 2006 - 2016    http://www.haplo-services.com
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.


module HMAC
  module SHA1
    def self.sign(key, message)
      mac = javax.crypto.Mac.getInstance("HmacSHA1")
      mac.init(javax.crypto.spec.SecretKeySpec.new(key.to_java_bytes, "HmacSHA1"))
      result = mac.doFinal(message.to_java_bytes)
      String.from_java_bytes(result).unpack('H*').join
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
haplo-2.5.9-java lib/hmac.rb
haplo-2.5.8-java lib/hmac.rb
haplo-2.5.7-java lib/hmac.rb
haplo-2.5.6-java lib/hmac.rb
haplo-2.5.5-java lib/hmac.rb
haplo-2.5.4-java lib/hmac.rb
haplo-2.5.3-java lib/hmac.rb
haplo-2.5.2-java lib/hmac.rb
haplo-2.5.1-java lib/hmac.rb
haplo-2.5.0-java lib/hmac.rb
haplo-2.4.4-java lib/hmac.rb
haplo-2.4.3-java lib/hmac.rb
haplo-2.4.2-java lib/hmac.rb
haplo-2.4.1-java lib/hmac.rb
haplo-2.4.0-java lib/hmac.rb
haplo-2.3.6-java lib/hmac.rb
haplo-2.3.5-java lib/hmac.rb
haplo-2.3.4-java lib/hmac.rb
haplo-2.3.3-java lib/hmac.rb
haplo-2.3.2-java lib/hmac.rb