Source File
rsa_fingerprint.go
Belonging Package
github.com/gotd/td/internal/crypto
package crypto
import (
// #nosec
)
// RSAFingerprint returns fingerprint of RSA public key as defined in MTProto.
func ( *rsa.PublicKey) int64 {
:= big.NewInt(int64(.E))
// See "Creating an Authorization Key" for reference:
// * https://core.telegram.org/mtproto/auth_key#dh-exchange-initiation
// rsa_public_key n:string e:string = RSAPublicKey
:= new(bin.Buffer)
.PutBytes(.N.Bytes())
.PutBytes(.Bytes())
:= sha1.New() // #nosec
_, _ = .Write(.Buf)
:= .Sum(nil)[12:sha1.Size]
return int64(binary.LittleEndian.Uint64())
}
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. |