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 11 12 13 14 | 41x 41x 35x 35x | import { hashSha512 } from 'micro-stacks/crypto-sha';
export function sharedSecretToKeys(sharedSecret: Uint8Array): {
encryptionKey: Uint8Array;
hmacKey: Uint8Array;
} {
// generate mac and encryption key from shared secret
const hashedSecret = hashSha512(sharedSecret);
return {
encryptionKey: hashedSecret.slice(0, 32),
hmacKey: hashedSecret.slice(32),
};
}
|