Object
# File lib/cinch/sasl/diffie_hellman.rb, line 6 def initialize(p, g, q) @p = p @g = g @q = q end
# File lib/cinch/sasl/diffie_hellman.rb, line 12 def generate(tries = 16) tries.times do @x = rand(@q) @e = mod_exp(@g, @x, @p) return @e if valid? end raise ArgumentError, "can't generate valid e" end
compute the shared secret, given the public key
# File lib/cinch/sasl/diffie_hellman.rb, line 22 def secret(f) mod_exp(f, @x, @p) end
[Validate]
Generated with the Darkfish Rdoc Generator 2.