summaryrefslogtreecommitdiff
path: root/ATRI/plugins/rich/data_source.py
diff options
context:
space:
mode:
authorKyomotoi <[email protected]>2021-02-07 22:17:31 +0800
committerKyomotoi <[email protected]>2021-02-07 22:17:31 +0800
commit9d052eeb7d9d7b6ae50a4fb6e07a38cd492fd9c1 (patch)
tree3004e25ea16340211e4c215c6fa8c53697108079 /ATRI/plugins/rich/data_source.py
parentf5ceb8927f2e7f2a9e29d62c8e4cef876f917249 (diff)
downloadATRI-9d052eeb7d9d7b6ae50a4fb6e07a38cd492fd9c1.tar.gz
ATRI-9d052eeb7d9d7b6ae50a4fb6e07a38cd492fd9c1.tar.bz2
ATRI-9d052eeb7d9d7b6ae50a4fb6e07a38cd492fd9c1.zip
✨ 新增插件:小程序检测
Diffstat (limited to 'ATRI/plugins/rich/data_source.py')
-rw-r--r--ATRI/plugins/rich/data_source.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/ATRI/plugins/rich/data_source.py b/ATRI/plugins/rich/data_source.py
new file mode 100644
index 0000000..32ac219
--- /dev/null
+++ b/ATRI/plugins/rich/data_source.py
@@ -0,0 +1,22 @@
+table = 'fZodR9XQDSUm21yCkr6zBqiveYah8bt4xsWpHnJE7jL5VG3guMTKNPAwcF'
+tr = {}
+for i in range(58):
+ tr[table[i]] = i
+s = [11, 10, 3, 8, 4, 6]
+xor = 177451812
+add = 8728348608
+
+
+def dec(x) -> int:
+ r = 0
+ for i in range(6):
+ r += tr[x[s[i]]] * 58**i
+ return (r - add) ^ xor
+
+
+def enc(x) -> str:
+ x = (x ^ xor) + add
+ r = list('BV1 4 1 7 ')
+ for i in range(6):
+ r[s[i]] = table[x // 58**i % 58]
+ return ''.join(r)