Sha256: 9303b86fee5c3d0947dcec05d654f6e280e6e6795f4bbea4d017b03cc674f346

Contents?: true

Size: 609 Bytes

Versions: 1

Compression:

Stored size: 609 Bytes

Contents

# frozen_string_literal: true

begin
  require 'blake3'
rescue LoadError
end

module Noise
  module Functions
    module Hash
      class Blake3
        HASHLEN = 64
        BLOCKLEN = 128
        def hash(data)
          ::Blake3.digest(data)
        end

        def hashlen
          HASHLEN
        end

        def blocklen
          BLOCKLEN
        end
      end

      class Blake3HMAC < HMAC::Base
        def initialize(key = nil)
          super(::Blake3::Hasher, Blake3::BLOCKLEN, Blake3::HASHLEN, key)
        end
        public_class_method :new, :digest, :hexdigest
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
noise-ruby-0.10.0 lib/noise/functions/hash/blake3.rb