X-Git-Url: http://www.git.cypherpunks.ru/?p=govpn.git;a=blobdiff_plain;f=src%2Fcypherpunks.ru%2Fgovpn%2Fverifier.go;h=8be6ea7ac62c1f25e1d2222d4176c7465b7b1c71;hp=fbc0da14b8eb14ff80ee9043b26b3106369bdf87;hb=f47fff1e42f75b736e7067ec06c2e81394833d46;hpb=588499ac2eedea258c304fca647509c7b587d7e8 diff --git a/src/cypherpunks.ru/govpn/verifier.go b/src/cypherpunks.ru/govpn/verifier.go index fbc0da1..8be6ea7 100644 --- a/src/cypherpunks.ru/govpn/verifier.go +++ b/src/cypherpunks.ru/govpn/verifier.go @@ -45,14 +45,14 @@ type Verifier struct { S int T int P int - Id *PeerId + ID *PeerID Pub *[ed25519.PublicKeySize]byte } // Generate new verifier for given peer, with specified password and // hashing parameters. -func VerifierNew(s, t, p int, id *PeerId) *Verifier { - return &Verifier{S: s, T: t, P: p, Id: id} +func VerifierNew(s, t, p int, id *PeerID) *Verifier { + return &Verifier{S: s, T: t, P: p, ID: id} } func blake2bKeyless() hash.Hash { @@ -66,7 +66,7 @@ func blake2bKeyless() hash.Hash { // Apply the password: create Ed25519 keypair based on it, save public // key in verifier. func (v *Verifier) PasswordApply(password string) *[ed25519.PrivateKeySize]byte { - r := balloon.H(blake2bKeyless, []byte(password), v.Id[:], v.S, v.T, v.P) + r := balloon.H(blake2bKeyless, []byte(password), v.ID[:], v.S, v.T, v.P) defer SliceZero(r) src := bytes.NewBuffer(r) pub, prv, err := ed25519.GenerateKey(src) @@ -95,8 +95,8 @@ func VerifierFromString(input string) (*Verifier, error) { v := Verifier{S: s, T: t, P: p} id := new([IDSize]byte) copy(id[:], salt) - pid := PeerId(*id) - v.Id = &pid + pid := PeerID(*id) + v.ID = &pid if len(ss) == 5 { pub, err := base64.RawStdEncoding.DecodeString(ss[4]) if err != nil { @@ -113,7 +113,7 @@ func VerifierFromString(input string) (*Verifier, error) { func (v *Verifier) ShortForm() string { return fmt.Sprintf( "$balloon$s=%d,t=%d,p=%d$%s", - v.S, v.T, v.P, base64.RawStdEncoding.EncodeToString(v.Id[:]), + v.S, v.T, v.P, base64.RawStdEncoding.EncodeToString(v.ID[:]), ) }