Source File
srp.go
Belonging Package
github.com/gotd/td/internal/crypto/srp
// Package srp contains implementation of Secure Remote Password protocol.package srpimport ()// SRP is client implementation of Secure Remote Password protocol.//// See https://core.telegram.org/api/srp.type SRP struct {random io.Reader}// NewSRP creates new SRP instance.func ( io.Reader) SRP {return SRP{random: }}// Input is hashing algorithm parameters from server.//// Copy of tg.PasswordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPowtype Input struct {// One of two salts used by the derivation function (see SRP 2FA login)Salt1 []byte// One of two salts used by the derivation function (see SRP 2FA login)Salt2 []byte// Base (see SRP 2FA login)G int// 2048-bit modulus (see SRP 2FA login)P []byte}// Answer is result of SRP algorithm.type Answer struct {// A parameter (see SRP)A []byte// M1 parameter (see SRP)M1 []byte}func (, [sha256.Size]byte) ( [sha256.Size]byte) {xor.Bytes([:], [:], [:])return}func ( SRP) ( []byte) *big.Int {return new(big.Int).SetBytes()}func ( SRP) (, , *big.Int) *big.Int {return new(big.Int).Exp(, , )}func ( int, *big.Int) error {return crypto.CheckDH(, )}
![]() |
The pages are generated with Golds v0.6.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |