summaryrefslogtreecommitdiffstats
path: root/lib/srp.go
diff options
context:
space:
mode:
Diffstat (limited to 'lib/srp.go')
-rw-r--r--lib/srp.go17
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/srp.go b/lib/srp.go
index 21df3bb..37430b4 100644
--- a/lib/srp.go
+++ b/lib/srp.go
@@ -124,17 +124,22 @@ func NewSRPUser(n, g, k, ident, pass string) (*SRPUser, error) {
return nil, err
}
+ // Compute verifier.
+ user.ComputeVerifier(pass)
+
+ return user, nil
+}
+
+func (u *SRPUser) ComputeVerifier(pass string) {
// Generate private key `x` from salt+pass
m := make([]byte, 0)
- copy(m, user.salt)
+ copy(m, u.salt)
m = append(m, StrToBytes(pass)...)
- user.h.Message(m)
- user.x.SetBytes(user.h.Hash())
+ u.h.Message(m)
+ u.x.SetBytes(u.h.Hash())
// Generate password verifier `v`
- user.v.Exp(user.g, user.x, user.n)
-
- return user, nil
+ u.v.Exp(u.g, u.x, u.n)
}
func (u *SRPUser) EphemeralKeyGen() {