14 lines
409 B
TypeScript
14 lines
409 B
TypeScript
// Credits:
|
|
// https://mojoauth.com/hashing/sha-512-in-typescript/
|
|
import { createHash } from 'crypto';
|
|
/**
|
|
* Generates a SHA-512 hash for the given input string.
|
|
* @param input - The input string to hash.
|
|
* @returns The SHA-512 hash as a hexadecimal string.
|
|
*/
|
|
export function generateSha512(input: string): string {
|
|
const hash = createHash('sha512');
|
|
hash.update(input);
|
|
return hash.digest('hex');
|
|
}
|