import React from 'react';
var crypto = require('crypto');

type Props = {
    password: string;
    salt: string;
    callback: (arg: any) => void;
  };

export function HashPassword({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'));
     });
}