Sha256: a595498f8c8e9c719467f61dd5021c603e9397621cd7d07c46f610e12ad9414f

Contents?: true

Size: 348 Bytes

Versions: 2

Compression:

Stored size: 348 Bytes

Contents

require 'celluloid'

module Celluloid
  module Extras
    class Rehasher
      include Celluloid

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
celluloid-extras-0.1.1 lib/celluloid/extras/rehasher.rb
celluloid-extras-0.1.0 lib/celluloid/extras/rehasher.rb