1//Hash something.
2crypto = crypto || require('crypto');
3const createHash = crypto.createHash;
4function sha1(txt) {
5	return createHash('sha1') // <-- You can use other than sha1
6  		.update(txt) //set what to encode
7  		.digest('hex') //basically another way to encode. hex is base16 so for example doing .digest('base64') encodes 4x more effenciently
8}
9const hash = sha1('password');
10hash == sha1('password')?'yes':'no'; //yes