Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 | 1x 1x 13x 13x 13x 13x 13x | import { BytesCoder, HMAC } from '@stevenkellner/typescript-common-functionality';
export function createMacTag(parameters: unknown, key: Uint8Array): string {
const messageAuthenticater = new HMAC(key);
const jsonString = parameters === undefined ? '' : JSON.stringify(parameters);
const encodedParameters = BytesCoder.fromUtf8(jsonString);
const tagBytes = messageAuthenticater.sign(encodedParameters);
return BytesCoder.toHex(tagBytes);
}
|