hmac.rb

Path: lib/digest/hmac.rb
Last Update: Fri May 18 18:45:49 +0000 2012

digest/hmac.rb

An implementation of HMAC keyed-hashing algorithm

Overview

This library adds a method named hmac() to Digest classes, which creates a Digest class for calculating HMAC digests.

Examples

  require 'digest/hmac'

  # one-liner example
  puts Digest::HMAC.hexdigest("data", "hash key", Digest::SHA1)

  # rather longer one
  hmac = Digest::HMAC.new("foo", Digest::RMD160)

  buf = ""
  while stream.read(16384, buf)
    hmac.update(buf)
  end

  puts hmac.bubblebabble

License

Copyright (c) 2006 Akinori MUSHA <knu@iDaemons.org>

Documentation by Akinori MUSHA

All rights reserved. You can redistribute and/or modify it under the same terms as Ruby.

  $Id: hmac.rb 14881 2008-01-04 07:26:14Z akr $

Required files

digest  

[Validate]