Class: ElGamal::Ciphertext

Inherits:
Object
  • Object
show all
Defined in:
lib/elgamal/ciphertext.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ciphertext) ⇒ Ciphertext

Returns a new instance of Ciphertext.

Raises:

  • (ArgumentError)


5
6
7
8
# File 'lib/elgamal/ciphertext.rb', line 5

def initialize(ciphertext)
	raise ArgumentError.new("Required a tuple input, eg. [123,456]") unless ciphertext.class == Array and ciphertext.length == 2
	@ciphertext = ciphertext
end

Instance Attribute Details

#ciphertextObject

Returns the value of attribute ciphertext.



10
11
12
# File 'lib/elgamal/ciphertext.rb', line 10

def ciphertext
  @ciphertext
end

Instance Method Details

#[](pos) ⇒ Object



16
17
18
# File 'lib/elgamal/ciphertext.rb', line 16

def [](pos)
	return @ciphertext[pos]
end

#to_sObject



12
13
14
# File 'lib/elgamal/ciphertext.rb', line 12

def to_s
	@ciphertext.to_s
end