class CryptoToolchain::SRP::SimpleClient
Attributes
u[R]
Public Class Methods
new(**kargs)
click to toggle source
Calls superclass method
CryptoToolchain::SRP::Framework::new
# File lib/crypto_toolchain/srp/simple_client.rb, line 8 def initialize(**kargs) provided_pubkey = kargs.delete(:pubkey) super(**kargs) @pubkey = provided_pubkey || g.modpow(privkey, n) end
Public Instance Methods
calculate_secret()
click to toggle source
# File lib/crypto_toolchain/srp/simple_client.rb, line 24 def calculate_secret xH = Digest::SHA256.hexdigest("#{salt}#{password}") x = xH.to_i(16) # S = B**(a + ux) % n server_pubkey.modpow(privkey + (u * x), n) end
hello_received(_salt, _server_pubkey, _u)
click to toggle source
# File lib/crypto_toolchain/srp/simple_client.rb, line 14 def hello_received(_salt, _server_pubkey, _u) @salt = _salt.to_i @server_pubkey = _server_pubkey.to_i @u = _u.to_i secret = calculate_secret puts "SimpleClient generated secret #{secret}" if DEBUG @key = Digest::SHA256.hexdigest(secret.to_s) send_verify end