lib/rack/auth/digest/nonce.rb in rack-0.2.0 vs lib/rack/auth/digest/nonce.rb in rack-0.3.0
- old
+ new
@@ -1,6 +1,5 @@
-require 'base64'
require 'digest/md5'
module Rack
module Auth
module Digest
@@ -17,18 +16,18 @@
class << self
attr_accessor :private_key, :time_limit
end
def self.parse(string)
- new(*Base64.decode64(string).split(' ', 2))
+ new(*string.unpack("m*").first.split(' ', 2))
end
def initialize(timestamp = Time.now, given_digest = nil)
@timestamp, @given_digest = timestamp.to_i, given_digest
end
def to_s
- Base64.encode64([ @timestamp, digest ] * ' ').strip
+ [([ @timestamp, digest ] * ' ')].pack("m*").strip
end
def digest
::Digest::MD5.hexdigest([ @timestamp, self.class.private_key ] * ':')
end