package crypto

import (
	 // #nosec
	
)

// sha1BigInt returns SHA1(a + b).
func (,  *big.Int) []byte {
	var  []byte
	 = append(, .Bytes()...)
	 = append(, .Bytes()...)

	 := sha1.Sum() // #nosec
	return [:]
}

// 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 , 
}