Sha256: 5eab79a5f9b89142f2fece01b8b2bd5351a88b8c764cd26f14b6fe62628941df
Contents?: true
Size: 761 Bytes
Versions: 3
Compression:
Stored size: 761 Bytes
Contents
module SRP class Client include SRP::Util attr_reader :salt, :verifier, :username def initialize(username, password, salt = nil) @username = username @password = password @salt = salt || bigrand(4).hex calculate_verifier end def authenticate(server) @session = SRP::Session.new(self) @session.handshake(server) @session.validate(server) end def private_key @private_key ||= calculate_private_key end protected def calculate_verifier @verifier ||= modpow(GENERATOR, private_key) end def calculate_private_key shex = '%x' % [@salt] inner = sha256_str([@username, @password].join(':')) sha256_hex(shex, inner).hex end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ruby-srp-0.1.4 | lib/srp/client.rb |
ruby-srp-0.1.3 | lib/srp/client.rb |
ruby-srp-0.1.2 | lib/srp/client.rb |