summaryrefslogtreecommitdiff
path: root/lib/srp/client.rb
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2012-06-28 19:43:40 +0200
committerAzul <azul@leap.se>2012-06-29 14:55:10 +0200
commit20bf14939fbd75e3ee0206c2bf14737e2c7ac2c2 (patch)
treee035c91c65e8e48d6a6af317e900a8fb9897a739 /lib/srp/client.rb
parente55ff681bcc5a6c479530d1411a3da75912d78e5 (diff)
adopted srp algo to srp-js way of doing things.
all large integers are now send as hex strings. Using sha256_str all over the place. This finally gives me successful logins. Needs a log of cleanup never the less.
Diffstat (limited to 'lib/srp/client.rb')
-rw-r--r--lib/srp/client.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/srp/client.rb b/lib/srp/client.rb
index 9a27174..24d0c70 100644
--- a/lib/srp/client.rb
+++ b/lib/srp/client.rb
@@ -10,7 +10,8 @@ module SRP
def initialize(username, password)
@username = username
@password = password
- @salt = bigrand(10).hex
+ @salt = "5d3055e0acd3ddcfc15".hex # bigrand(10).hex
+ puts "salt = %i" %@salt
@multiplier = multiplier # let's cache it
calculate_verifier
end
@@ -27,13 +28,16 @@ module SRP
protected
def calculate_verifier
x = calculate_x(@username, @password, @salt)
+ puts "x = %i" % x
@verifier = modpow(GENERATOR, x, PRIME_N)
+ puts "verifier = %i" % @verifier
+ @verifier
end
def calculate_x(username, password, salt)
shex = '%x' % [salt]
- spad = if shex.length.odd? then '0' else '' end
- sha256_hex(spad + shex + sha256_str([username, password].join(':'))).hex
+ spad = "" # if shex.length.odd? then '0' else '' end
+ sha256_str(spad + shex + sha256_str([username, password].join(':'))).hex
end
def calculate_client_s(x, a, bb, u)