10 lines
204 B
JavaScript
10 lines
204 B
JavaScript
|
"use strict";
|
||
|
|
||
|
import crypto from 'crypto';
|
||
|
|
||
|
export default function hash(algorithm, encoding, data) {
|
||
|
let hasher = crypto.createHash(algorithm);
|
||
|
hasher.update(data);
|
||
|
return hasher.digest(encoding);
|
||
|
}
|