All files / src/util sha256.js

100% Statements 13/13
100% Branches 0/0
100% Functions 2/2
100% Lines 13/13

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 15 16 17 18 19 20    15x 419x 419x 419x 419x 419x   15x 1x 1x 1x 1x 1x   15x      
import { Sha256 } from '@aws-crypto/sha256-js';
 
const sha256 = value => {
  const hexStr = value;
  const hash = new Sha256();
  hash.update(hexStr);
  const hashUint8Array = hash.digestSync();
  return Buffer.from(hashUint8Array).toString('hex');
};
sha256.digest = value => {
  const hexStr = value;
  const hash = new Sha256();
  hash.update(hexStr);
  const hashUint8Array = hash.digestSync();
  return hashUint8Array;
};
sha256.array = sha256.digest;
 
export default sha256;