hash util function

This commit is contained in:
Daniel Odendahl Jr
2018-03-05 04:10:15 +00:00
parent 511154ef23
commit 6ee7cea56b
4 changed files with 13 additions and 8 deletions
+5
View File
@@ -1,3 +1,4 @@
const crypto = require('crypto');
const yes = ['yes', 'y', 'ye', 'yeah', 'yup', 'yea'];
const no = ['no', 'n', 'nah', 'nope'];
@@ -55,6 +56,10 @@ class Util {
return Buffer.from(text).toString('base64');
}
static hash(text, algorithm) {
return crypto.createHash(algorithm).update(text).digest('hex');
}
static cleanXML(text) {
return text
.replace(/<br \/>/g, '')