UNPKG

koishi-plugin-kbot

Version:
16 lines (15 loc) 474 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.toAvid = void 0; const table = 'fZodR9XQDSUm21yCkr6zBqiveYah8bt4xsWpHnJE7jL5VG3guMTKNPAwcF'; const tr = table .split('') .reduce((acc, x, i) => ({ ...acc, [x]: i }), {}); const s = [11, 10, 3, 8, 4, 6]; function toAvid(bvid) { let r = 0; for (let i = 0; i < 6; i++) r += tr[bvid[s[i]]] * 58 ** i; return (r - 8728348608) ^ 177451812; } exports.toAvid = toAvid;