@logismika/crypto
Version:
Crypto algorithms library
23 lines (22 loc) • 562 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.GOST_Kuz_GF_mul = void 0;
const utils_1 = require("./utils");
const GOST_Kuz_GF_mul = (in_a, in_b) => {
let a = in_a;
let b = in_b;
let c = 0;
for (let i = 0; i < 8; i += 1) {
if ((b & 1) != 0) {
c = (c ^ a) % 0x100;
}
const hi_bit = a & 0x80;
a <<= 1;
if (hi_bit != 0) {
a ^= 0xc3;
}
b >>= 1;
}
return (0, utils_1.toByte)(c);
};
exports.GOST_Kuz_GF_mul = GOST_Kuz_GF_mul;