Sha256: ad2970a7fece435e78e9680d5f92a3cf09243ce32fe9b1148a28d0069dbba622

Contents?: true

Size: 507 Bytes

Versions: 1

Compression:

Stored size: 507 Bytes

Contents

require 'murky/version'
require 'murky/dict'
require 'murky/proof'
require 'base64'

module Murky
  module_function
    def verify(root, siblings, value, digest: Digest::SHA256.new)
      Proof.new(
        root: root,
        siblings: siblings,
        signature: digest.digest(value.to_s),
        digest: digest
      ).valid?
    end

    def xor(s1, s2)
      s2, s1 = [s1, s2].sort_by(&:bytesize)
      s1.bytes.zip(s2.bytes).map do |x,y|
        ((x || 0) ^ (y || 0)).chr
      end.join
    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
murky_waters-0.1.0 lib/murky.rb