You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
pizza.krasnikov.pro/.history/components/admin/function/hashPassword_20220520144353.ts

15 lines
433 B

import React from 'react';
var crypto = require('crypto');
type Props = {
password: string;
salt: string;
callback: (arg: any) => void;
};
export const HashPassword: React.FC<Props> = ({password, salt, callback: (arg: any) => void}) => {
crypto.pbkdf2(password, salt, 100000, 64, 'sha512', (err: string, derivedKey: string) => {
if (err) throw err;
callback(derivedKey.toString('hex'));
});
}