JS to achieve FCS effectiveness

Time:2021-12-1
function fcs(str) {
    var len = str.length;
    var tmp = "";
    for(var i = 0;i<len;i++){
        tmp = tmp ^ str[i].charCodeAt();
    }
    var tmps = tmp.toString(16);
    if (tmps.Length == 1)
    {
        tmps = "0" + tmps;
    }
    return tmps;
}
var test = fcs("@00RD01000007");
//50
console.log(test);

This work adoptsCC agreement, reprint must indicate the author and the link to this article