module

SecureRemotePassword::Helpers

Instance methods

calculate_A(a : BigInt) : BigInt

Calculate the client's public value A = g^a % N where param 'a' is a random number at least 256 bits in length

Source
calculate_B(b : BigInt, v : BigInt) : BigInt

Calculate the server's public value B B = g^b + k v (mod N)

Source
calculate_client_S(arg_B : BigInt, salt : String, uu : BigInt, a : BigInt) : BigInt

Client secret S = (B - (k * g^x)) ^ (a + (u * x)) % N

Source
calculate_h_amk(xaa, xmm, xkk)

H(A, M, K) for final client validation

Source
calculate_k

Calculate k = H(N || g), which is used throughout various SRP calculations.

Source
calculate_M(username : String, salt : String, xaa, xbb, xkk) : BigInt

M = H(H(N) xor H(g), H(I), s, A, B, K) NOTE:: overwrite what is hashed here if your implementation differs

Source
calculate_server_S(arg_A : BigInt, v : BigInt, u : BigInt, arg_b : BigInt) : BigInt

Server secret S = (A * v^u) ^ b % N

Source
calculate_u(arg_A, arg_B) : BigInt

Calculate u = SHA1(PAD(A) | PAD(B)), which serves to prevent an attacker who learns a user's verifier from being able to authenticate as that user.

Source
calculate_v(username : String, password : String, salt : String) : BigInt

verifier version

Source
calculate_v(salt : String) : BigInt

Calculate v = g^x % N

Source
calculate_x(salt : String, username : String = @username, password : String = @password)

Calculate x = SHA1(s | SHA1(I | ":" | P))

Source
hash(h : Bytes | String) : BigInt
Source
hash_hex(bytes : Bytes) : String
Source
hash_hex(h : String) : String
Source
hash_string(string : String) : String
Source
initialization_value(group : Int) : Tuple(BigInt, BigInt)
Source
modpow(a : BigInt, n : BigInt, m : BigInt) : BigInt

a^n (mod m)

Source
no_padding_hash(*a) : BigInt
Source
padded_hash(*parts) : BigInt
Source
random_big_int(bytes : Int) : BigInt
Source
random_hex(bytes : Int) : String
Source