Class: Celluloid::Extras::Rehasher

Inherits:
Object
  • Object
show all
Includes:
Celluloid
Defined in:
lib/celluloid/extras/rehasher.rb

Instance Method Summary collapse

Instance Method Details

#rehash(string, rounds) ⇒ Object



8
9
10
11
12
# File 'lib/celluloid/extras/rehasher.rb', line 8

def rehash(string, rounds)
  fail ArgumentError, "hurr" unless rounds > 1
  penultimate = (rounds - 1).times.inject(string) { |a, e| Digest::SHA512.digest(a) }
  Digest::SHA512.hexdigest(penultimate)
end