Class: Ed25519Keccak::Ed25519Base

Inherits:
Object
  • Object
show all
Defined in:
lib/ed25519_keccak/ed25519base.rb

Overview

base class of Ed25519

Direct Known Subclasses

Keccak512, SHA3_512

Instance Method Summary collapse

Constructor Details

#initialize(hash_function) ⇒ Ed25519Base

Returns a new instance of Ed25519Base.



7
8
9
# File 'lib/ed25519_keccak/ed25519base.rb', line 7

def initialize( hash_function )
  @hash_function = hash_function
end

Instance Method Details

#secret_to_public(secret, form = :byte) ⇒ Object

calculate public key from secret



22
23
24
25
# File 'lib/ed25519_keccak/ed25519base.rb', line 22

def secret_to_public(secret, form=:byte)
  publickey = p_secret_to_public( change_argument_format(secret, form) )
  return change_result_format( publickey, form )
end

#sign(secret, message, form = :byte) ⇒ Object



11
12
13
14
# File 'lib/ed25519_keccak/ed25519base.rb', line 11

def sign(secret, message, form=:byte)
  arguments = change_arguments_format( [secret,message], form )
  return change_result_format( p_sign(*arguments), form)
end

#verify(public_key, message, signature, form = :byte) ⇒ Object



16
17
18
19
# File 'lib/ed25519_keccak/ed25519base.rb', line 16

def verify(public_key, message, signature, form=:byte)
  arguments = change_arguments_format( [public_key,message,signature], form )
  return p_verify(*arguments)
end