Class: Ed25519Keccak::Ed25519Base
- Inherits:
-
Object
- Object
- Ed25519Keccak::Ed25519Base
- Defined in:
- lib/ed25519_keccak/ed25519base.rb
Overview
base class of Ed25519
Instance Method Summary collapse
-
#initialize(hash_function) ⇒ Ed25519Base
constructor
A new instance of Ed25519Base.
-
#secret_to_public(secret, form = :byte) ⇒ Object
calculate public key from secret.
- #sign(secret, message, form = :byte) ⇒ Object
- #verify(public_key, message, signature, form = :byte) ⇒ Object
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, , form=:byte) arguments = change_arguments_format( [secret,], 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, , signature, form=:byte) arguments = change_arguments_format( [public_key,,signature], form ) return p_verify(*arguments) end |