Class: RSA::ACC::MembershipProof

Inherits:
Object
  • Object
show all
Includes:
Functions
Defined in:
lib/rsa/acc/proof.rb

Overview

Proof of membership of the element’s inclusion in the accumulator.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Functions

#blake2_hash, #compute_challenge, #egcd, #elements_to_prime, #hash_to_prime, #shamir_trick

Constructor Details

#initialize(element, witness, acc_value, proof) ⇒ MembershipProof

Returns a new instance of MembershipProof.



15
16
17
18
19
20
# File 'lib/rsa/acc/proof.rb', line 15

def initialize(element, witness, acc_value, proof)
  @element = element
  @witness = witness
  @acc_value = acc_value
  @proof = proof
end

Instance Attribute Details

#acc_valueObject (readonly)

Returns the value of attribute acc_value.



12
13
14
# File 'lib/rsa/acc/proof.rb', line 12

def acc_value
  @acc_value
end

#elementObject (readonly)

witness^H(element) == acc



10
11
12
# File 'lib/rsa/acc/proof.rb', line 10

def element
  @element
end

#proofObject (readonly)

prof calculated by PoE



13
14
15
# File 'lib/rsa/acc/proof.rb', line 13

def proof
  @proof
end

#witnessObject (readonly)

Returns the value of attribute witness.



11
12
13
# File 'lib/rsa/acc/proof.rb', line 11

def witness
  @witness
end

Instance Method Details

#element_primeInteger

Convert element to prime number.

Returns:

  • (Integer)

    prime number of element.



24
25
26
27
# File 'lib/rsa/acc/proof.rb', line 24

def element_prime
  return nil if element.nil?
  element.is_a?(Array) ? elements_to_prime(element) : hash_to_prime(element)
end