function 未来之窗_道_签名(私钥,内容) {
if (!私钥.startsWith('-----BEGIN PRIVATE KEY-----')) {
私钥 = '-----BEGIN PRIVATE KEY-----' + 私钥 + '-----END PRIVATE KEY-----';
}
const sha256withrsa = new pmlib.rs.KJUR.crypto.Signature({"alg": "SHA256withRSA"});
sha256withrsa.init(私钥);
sha256withrsa.updateString(内容);
const signature = pmlib.rs.hextob64(sha256withrsa.sign());
return signature;
}
function 未来之窗_道_随机(位数) {
let result = '';
const 天机卷 = 'ABCDEFGHIJ02KLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
const 天机卷长 = 天机卷.length;
for (let i = 0; i < 位数; i++) {
result += 天机卷.charAt(Math.floor(Math.random() * 天机卷长));
}
return result;
}