Sha256: ef41a460ad5fb447ce731cc32f71bf2fb3c8d7fb39af936d5d0faef47e3e74b3

Contents?: true

Size: 525 Bytes

Versions: 4

Compression:

Stored size: 525 Bytes

Contents

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

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

4 entries across 4 versions & 1 rubygems

Version Path
murky_waters-0.1.4 lib/murky.rb
murky_waters-0.1.3 lib/murky.rb
murky_waters-0.1.2 lib/murky.rb
murky_waters-0.1.1 lib/murky.rb