Sha256: 4e812630ebe07f591390bc66aff7c5d9d79d5bbc28dd376e8e9e7956276b738a
Contents?: true
Size: 713 Bytes
Versions: 3
Compression:
Stored size: 713 Bytes
Contents
# frozen_string_literal: true module MSSMT # Node within a MS-SMT that has already had its node_hash and sum computed, i.e., its preimage is not available. class ComputedNode attr_reader :node_hash, :sum # Constructor # @param [String] node_hash node hash with binary format. # @param [Integer] sum # @raise [MSSMT::OverflowError] def initialize(node_hash, sum) @node_hash = node_hash if sum > Tree::MAX_SUM_VALUE raise OverflowError, "sum: #{sum} is overflow" end @sum = sum end def ==(other) return false unless [BranchNode, ComputedNode].include?(other.class) node_hash == other.node_hash && sum == other.sum end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mssmt-0.4.2 | lib/mssmt/computed_node.rb |
mssmt-0.4.1 | lib/mssmt/computed_node.rb |
mssmt-0.4.0 | lib/mssmt/computed_node.rb |