ArchiSteamFarm.MobileAuthenticator.GenerateConfirmationKey C# (CSharp) Метод

GenerateConfirmationKey() приватный Метод

private GenerateConfirmationKey ( uint time, string tag = null ) : string
time uint
tag string
Результат string
		private string GenerateConfirmationKey(uint time, string tag = null) {
			if (time == 0) {
				Bot.ArchiLogger.LogNullError(nameof(time));
				return null;
			}

			byte[] identitySecret = Convert.FromBase64String(IdentitySecret);

			byte bufferSize = 8;
			if (!string.IsNullOrEmpty(tag)) {
				bufferSize += (byte) Math.Min(32, tag.Length);
			}

			byte[] timeArray = BitConverter.GetBytes((long) time);
			if (BitConverter.IsLittleEndian) {
				Array.Reverse(timeArray);
			}

			byte[] buffer = new byte[bufferSize];

			Array.Copy(timeArray, buffer, 8);
			if (!string.IsNullOrEmpty(tag)) {
				Array.Copy(Encoding.UTF8.GetBytes(tag), 0, buffer, 8, bufferSize - 8);
			}

			byte[] hash;
			using (HMACSHA1 hmac = new HMACSHA1(identitySecret)) {
				hash = hmac.ComputeHash(buffer);
			}

			return Convert.ToBase64String(hash);
		}