@li0ard/kuznyechik
Version:
Kuznyechik cipher implementation in pure TypeScript
13 lines (12 loc) • 389 B
JavaScript
import { BLOCK_SIZE, Kuznyechik } from "../";
import { mac as mac_ } from "@li0ard/gost3413";
/**
* Compute MAC (CMAC/OMAC) with Kuznyechik cipher
* @param key Encryption key
* @param data Input data
*/
export const mac = (key, data) => {
const cipher = new Kuznyechik(key);
const encrypter = (buf) => cipher.encryptBlock(buf);
return mac_(encrypter, BLOCK_SIZE, data);
};