Sha256: e262dc7cb82e094c10e43d497fb57619daa527bd7f543ffb31a642b0267b68e7

Contents?: true

Size: 528 Bytes

Versions: 2

Compression:

Stored size: 528 Bytes

Contents

require 'digest'
require "digest/simple"

module Digest
  class SipHash < Simple
    VERSION = "1.0.0"
    DEFAULT_SEED = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00".encode('ASCII-8BIT')

    def initialize
      @seed = DEFAULT_SEED
      super
    end

    def seed
      @seed
    end

    def seed=(s)
      fail ArgumentError, "seed string should 128 bit chars" if s.bytesize != 16
      @seed = s
    end

    def to_i
      finish.unpack("Q")[0]
    end
  end
end

require "digest/siphash/siphash"

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
digest-siphash-1.0.1 lib/digest/siphash.rb
digest-siphash-1.0.0 lib/digest/siphash.rb