分析的不错,思路和楼主差不多,顺便发个我写的屑注册机吧
关照一下401100,401080,401110,还有那个究极折磨的4011B0
C语言的,VS2019或者gcc都可以编译
[C] 纯文本查看 复制代码 #ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include <stdio.h>
int CalcMulNum(int UID)
{
int n, t, i, m;
n = 0;
// 401080
t = UID % 12;
if (t <= 5)
n = 2 * t + 1;
else
n = 2 * t + 3;
// 401110
int arr[36] = { 0 };
i = 0;
t = 26;
arr[4] = 1;
arr[7] = 1;
int *p = &arr[1];
do {
p += 4;
i++;
m = t % n;
p[3] = *p;
p[4] = *(p - 1) - t / n * (*p);
p[5] = p[2];
p[6] = p[1] - t / n * p[2];
t = n;
n = m;
} while (m);
i *= 4;
int result = arr[i + 3];
if (result < 0)
result += 26;
return result;
}
void GenerateMap(char *Upper, char *Lower, int SubNum, int MulNum)
{
char c;
int i;
for (i = 0; i < 26; i++) {
c = MulNum * (i - SubNum) % 26 + 65; // 4011B0
if (c < 65)
c += 26;
Upper[i] = c;
}
for (i = 0; i < 26; i++) {
c = MulNum * (i - SubNum) % 26 + 97; // 4011B0
if (c < 97)
c += 26;
Lower[i] = c;
}
}
int main()
{
const char TrueFlag[] = "flag{Happy_New_Year_52Pojie_2022}";
int UID, MulNum, SubNum;
char MapUpper[27] = { 0 };
char MapLower[27] = { 0 };
printf("Please Input your UID: ");
scanf("%d", &UID);
if (UID > 2000000 || UID < 0) {
printf("Invalid UID, Try again.\n");
return 0;
}
SubNum = UID % 25; // 401100
MulNum = CalcMulNum(UID);
printf("SubNum: %d\n", SubNum);
printf("MulNum: %d\n", MulNum);
GenerateMap(MapUpper, MapLower, SubNum, MulNum);
printf("MapUpper: %s\n", MapUpper);
printf("MapLower: %s\n", MapLower);
char flag[34] = { 0 };
for (int i = 0; i < 34; i++) {
char c = TrueFlag[i];
if (c <= 'Z' && c >= 'A') {
for (int j = 0; j < 26; j++)
if (MapUpper[j] == c) {
flag[i] = 65 + j;
break;
}
} else if (c <= 'z' && c >= 'a') {
for (int j = 0; j < 26; j++)
if (MapLower[j] == c) {
flag[i] = 97 + j;
break;
}
} else
flag[i] = c;
}
printf("YourFlag: %s\n", flag);
}
|