mirror of
https://git.oceanpay.cc/danial/kami_itunes_june.git
synced 2025-12-18 21:21:34 +00:00
96 lines
2.4 KiB
C#
96 lines
2.4 KiB
C#
using System;
|
|
using System.Diagnostics;
|
|
using System.Security.Cryptography;
|
|
|
|
namespace AppleBatch_June.Utils
|
|
{
|
|
public static class APPLEHCHelp
|
|
{
|
|
private static byte[] NumberBybeyes = new byte[10] { 48, 49, 50, 51, 52, 53, 54, 55, 56, 57 };
|
|
|
|
public static string getIframeId()
|
|
{
|
|
try
|
|
{
|
|
string text = "auth-" + new Random(Guid.NewGuid().GetHashCode()).NextDouble().DToAny(36).Substring(2, 8);
|
|
for (int i = 1; 3 >= i; i++)
|
|
{
|
|
text = text + "-" + new Random(Guid.NewGuid().GetHashCode()).NextDouble().DToAny(36).Substring(2, 4);
|
|
}
|
|
return text = text + "-" + new Random(Guid.NewGuid().GetHashCode()).NextDouble().DToAny(36).Substring(2, 8);
|
|
}
|
|
catch (Exception)
|
|
{
|
|
}
|
|
return "auth-kg8m7tma-vnev-mvm2-afu5-g7azyeu4";
|
|
}
|
|
|
|
public static int getHkCode(string palinData)
|
|
{
|
|
Console.WriteLine("开始运行。" + DateTime.Now.ToString());
|
|
Stopwatch stopwatch = Stopwatch.StartNew();
|
|
int num = int.Parse(palinData.Split(':')[1]);
|
|
int num2 = 0;
|
|
int[] array = new int[20];
|
|
byte[] array2 = new byte[palinData.Length + "1000000".Length];
|
|
for (int i = 0; i < palinData.Length; i++)
|
|
{
|
|
array2[i] = (byte)palinData[i];
|
|
}
|
|
int length = palinData.Length;
|
|
using (SHA1 sHA = SHA1.Create())
|
|
{
|
|
do
|
|
{
|
|
length = 54;
|
|
string text = num2.ToString();
|
|
foreach (int num3 in text)
|
|
{
|
|
array2[length] = (byte)num3;
|
|
length++;
|
|
}
|
|
byte[] array3 = sHA.ComputeHash(array2, 0, length);
|
|
int num4 = 0;
|
|
byte[] array4 = array3;
|
|
foreach (byte b in array4)
|
|
{
|
|
array[num4] = b;
|
|
num4++;
|
|
}
|
|
if (getDomaiHkJudge(array) < num)
|
|
{
|
|
num2++;
|
|
continue;
|
|
}
|
|
break;
|
|
}
|
|
while (num2 <= 1000000);
|
|
}
|
|
Array.Clear(array2, 0, array2.Length);
|
|
Array.Clear(array, 0, 20);
|
|
array2 = null;
|
|
array = null;
|
|
stopwatch.Stop();
|
|
Console.WriteLine(stopwatch.Elapsed.TotalSeconds);
|
|
Console.WriteLine("end运行。" + DateTime.Now.ToString() + ",data=" + palinData + ",cout=" + num2);
|
|
return num2;
|
|
}
|
|
|
|
public static int getDomaiHkJudge(int[] e)
|
|
{
|
|
int num = 0;
|
|
int num2 = 0;
|
|
for (int i = 0; i < e.Length; i++)
|
|
{
|
|
int num3;
|
|
num += (num2 = (((num3 = e[i]) >= 0) ? ((num3 < 1) ? 8 : ((num3 < 2) ? 7 : ((num3 < 4) ? 6 : ((num3 < 8) ? 5 : ((num3 < 16) ? 4 : ((num3 < 32) ? 3 : ((num3 < 64) ? 2 : ((num3 < 128) ? 1 : 0)))))))) : 0));
|
|
if (8 != num2)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
return num;
|
|
}
|
|
}
|
|
}
|