前提:electron ffi环境以及搭建好及文件加载成功
const refArray = require('ref-array')
//buffer数组 如:tc_load_key_hex 验证密码
function buff(val,nub){ //val 十进制密码 nub 位数 512
if(!refArray) return;
let IntArray = refArray(ref.types.char,nub);
let writeV = new IntArray();
let bufferValue = Buffer.from((val+''))
for(let i=0;i<bufferValue.length;i++){
writeV[i]=bufferValue[i];
}
let strArray = [...bufferValue];
let pCall = ref.alloc(IntArray,strArray);
return pCall
}
//16进制buffer 如: tc_load_key
Buffer.from(val,'hex')