Class: Noise::Functions::DH::ED448

Inherits:
Object
  • Object
show all
Defined in:
lib/noise/functions/dh/ed448.rb

Constant Summary collapse

DHLEN =

Ed448::X448::X448_PRIVATE_BYTES, spelled out so this file loads without the gem.

56

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeED448

Returns a new instance of ED448.



12
13
14
# File 'lib/noise/functions/dh/ed448.rb', line 12

def initialize
  Noise.optional_dependency!('ed448')
end

Class Method Details

.from_private(private_key) ⇒ Object



30
31
32
33
# File 'lib/noise/functions/dh/ed448.rb', line 30

def self.from_private(private_key)
  public_key = Ed448::X448.derive_public_key(private_key)
  Noise::Key.new(private_key, public_key)
end

Instance Method Details

#dh(private_key, public_key) ⇒ Object



22
23
24
# File 'lib/noise/functions/dh/ed448.rb', line 22

def dh(private_key, public_key)
  Ed448::X448.dh(public_key, private_key)
end

#dhlenObject



26
27
28
# File 'lib/noise/functions/dh/ed448.rb', line 26

def dhlen
  DHLEN
end

#generate_keypairObject



16
17
18
19
20
# File 'lib/noise/functions/dh/ed448.rb', line 16

def generate_keypair
  private_key = SecureRandom.random_bytes(DHLEN)
  public_key = Ed448::X448.derive_public_key(private_key)
  Noise::Key.new(private_key, public_key)
end