add h_.dart

This commit is contained in:
shenjack 2024-03-17 13:47:07 +08:00
parent 3323d46188
commit 0cf2bfb76a
Signed by: shenjack
GPG Key ID: 7B1134A979775551

31
dart-js/h_.dart Normal file
View File

@ -0,0 +1,31 @@
String h_(String str) {
int a = 1;
int b = 3;
int c = 5;
int d = 7;
for (int n in str.codeUnits) {
a = (a + n + d) * 17 % 52;
b = (b + n * a) * 23 % 52;
c = (c + n + b) * 47 % 52;
d = (d + n * c) * 41 % 52;
}
if (a < 26) a += 65;
else a += 71;
if (b < 26) b += 65;
else b += 71;
if (c < 26) c += 65;
else c += 71;
if (d < 26) d += 65;
else d += 71;
return new String.fromCharCodes([a, b, c, d]);
}
void main(List<String> args) {
//
for (String arg in args) {
print(arg + " -> " + h_(arg));
}
}