let indices = [6, 2, 8, 3]; // 索引跳跃值
function convertASEToChar(str) {
let base64 = $FunLib.encodeBase64(str).string();
let charArray = base64.split('');
// 计算数组长度的一半(向下取整)
const length = Math.floor(charArray.length / 2);
for (let i of indices) {
for (let i2 = 0; i2 < length; i2 += i) {
const temp = charArray[i2];
const i3 = length + i2;
charArray[i2] = charArray[i3];
charArray[i3] = temp;
}
}
return charArray.join('');
}
// // 示例用法:
// const charArray = ['a', 'b', 'c', 'd', 'e', 'f']; // 注意:在JavaScript中,这是一个字符串数组
// const indices = [6, 2, 8, 3]; // 索引跳跃值
// const result = convertASEToChar(charArray, ...indices);
// console.log(result); // 输出交换后的数组
let str = 'eyJtZXRob2QiOiJHRVQiLCJ0aW1lc3RhbXAiOjE3MTU3NTc5ODA1NTgsInVybCI6Imh0dHBzOi8vaW50ZXJhY3RpdmUuaG4wNzQ2LmNvbS9hY3Rpdml0aWVzL2FwcENvbHVtbkNvbmZpZy9nZXRDb2x1bW5zT2ZBdmFpbGFibGVNb2RlbD9hcHBJbmZvSWRcdTAwM2Q1OTZcdTAwMjZhcHBNb2RlbElkXHUwMDNkMjk4In0=';
let result = convertASEToChar(str);
console.log(result); // 输出交换后的数组
console