package cryptoimport (// #nosec)// sha1BigInt returns SHA1(a + b).func (, *big.Int) []byte {var []byte = append(, .Bytes()...) = append(, .Bytes()...) := sha1.Sum() // #nosecreturn [:]}// TempAESKeys returns tmp_aes_key and tmp_aes_iv based on new_nonce and// server_nonce as defined in "Creating an Authorization Key".func (, *big.Int) (, []byte) {// See https://core.telegram.org/mtproto/auth_key#presenting-proof-of-work-server-authentication // 5. Server responds in one of two ways: [...]// tmp_aes_key := SHA1(new_nonce + server_nonce) + substr (SHA1(server_nonce + new_nonce), 0, 12); // SHA1(new_nonce + server_nonce) = append(, sha1BigInt(, )...)// substr (SHA1(server_nonce + new_nonce), 0, 12); = append(, sha1BigInt(, )[:12]...)// tmp_aes_iv := substr (SHA1(server_nonce + new_nonce), 12, 8) + SHA1(new_nonce + new_nonce) + substr (new_nonce, 0, 4); = append(, sha1BigInt(, )[12:12+8]...) = append(, sha1BigInt(, )...) = append(, .Bytes()[:4]...)return , }
The pages are generated with Goldsv0.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.