(* 利用 mma 改写的 mma12_0_keygen.cpp, 不知道是不是有用*)
(* (* numbers for 11.2 *)
magicNumbers = \
{10690,10744,12251,17649,27280,42041,42635,53798,56180,58535,61041} *)
\
(* numbers for 12.0 *)
magicNumbers = {10690, 12251, 17649, 24816, 33360, 35944, 36412,
42041, 42635, 44011, 53799, 56181, 58536, 59222, 61041};
f1[n_Integer, byte_Integer, c_Integer] :=
Block[{nn = n, bitIndex, bit},
For[bitIndex = 0, bitIndex <= 7, bitIndex++,
bit = (byte~BitShiftRight~bitIndex)~BitAnd~ 1;
nn = If [bit + ((nn - bit) ~BitAnd~ BitNot@1) == nn,
(nn - bit) ~BitShiftRight~ 1,
((c - bit) ~BitXor~ nn) ~BitShiftRight~ 1]
];
nn];
f1[n_Integer, byte_String, c_Integer] :=
f1[n, ToCharacterCode[byte][[1]], c];
genPassword[str_String, h_Integer] := Block[
{hash , byteIndex},
hash = h;
For[byteIndex = StringLength@str, byteIndex >= 1, byteIndex--,
hash = f1[hash, str~StringTake~{byteIndex}, 16^^105C3]];
n1 = 0;
While[f1[f1[hash, n1~BitAnd~16^^FF, 16^^105C3], n1~BitShiftRight~8,
16^^105C3] != 16^^A5B6,
If[++n1 >= 16^^FFFF, Sow["Failed to find a Key!"]; Return[""]]];
n1 = Floor[((n1 + 16^^72FA)~BitAnd~16^^FFFF) * 99999 / 16^^FFFF];
n1str = IntegerString[n1, 10, 5];
temp =
FromDigits[(n1str~StringTake~{1, 2}) <> (n1str~
StringTake~{4, 5}) <> (n1str~StringTake~{3})];
temp = Floor[(temp / 99999)*16^^FFFF] + 1;
temp =
f1[f1[0, temp~BitAnd~16^^FF, 16^^1064B], temp~BitShiftRight~8,
16^^1064B];
For[byteIndex = StringLength@str, byteIndex >= 1, byteIndex--,
temp = f1[temp, str~StringTake~{byteIndex}, 16^^1064B]];
n2 = 0;
While[f1[f1[temp, n2~BitAnd~16^^FF, 16^^1064B], n2~BitShiftRight~8,
16^^1064B] != 16^^A5B6,
If[++n2 >= 16^^FFFF, Sow["Failed to find a Key"]; Return[""]]];
n2 = Floor[(n2~BitAnd~16^^FFFF)*99999/16^^FFFF];
n2str = IntegerString[n2, 10, 5];
pass = {
n2str~StringTake~{4},
n1str~StringTake~{4},
n1str~StringTake~{2},
n1str~StringTake~{1},
"-",
n2str~StringTake~{5},
n1str~StringTake~{3},
n2str~StringTake~{1},
"-",
n2str~StringTake~{3},
n1str~StringTake~{5},
n2str~StringTake~{2}};
password = (StringJoin[pass]~StringTake~12) <> "::1";
password];
mathID = "a";
activationKey = "1234-4321-123456";
genPassword[mathID <> "$1&" <> activationKey,
magicNumbers[[1]]] // Reap
2019年05月17日 04点05分
3
前排说一下,本帖会不定期清理一些已经“过时”的回复,清理时可能不会一一通知,望理解。
2022年03月05日 02点03分