File size: 399 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
import sha256 from 'hash.js/lib/hash/sha/256';

/**
 * Hashes users' Personally Identifiable Information using SHA256
 * @param data Data to be hashed
 * @returns SHA256 in hex string format
 */
export default function hashPii( data: string | number ): string {
	// eslint-disable-next-line @typescript-eslint/no-explicit-any
	return ( sha256() as any ).update( data.toString() ).digest( 'hex' );
}