@nogsantos/hash
v0.2.1
Published
Sha1 and Md5 hash encoder for javascript
Downloads
5
Maintainers
Readme
@nogsantos/hash
Sha1 and Md5 hash encoder for javascript.
Install
npm i -P @nogsantos/hash
Example of usage
Web
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<script src="./node_modules/@nogsantos/hash/dist/hash.umd.min.js"></script>
<script>
var md5 = new Hash.Md5();
var md5Results = [
{
lorem: md5.encode('Lorem ipsum dolor sit, amet consectetur adipisicing elit. Perferendis, officia. Maxime, eveniet similique modi quia illo inventore nemo numquam ipsum quod amet veniam, ullam facere. Ullam esse odit laboriosam consectetur!'),
test: md5.encode('test')
}
];
console.table(md5Results);
var sha1 = new Hash.Sha1();
var sha1Results = [
{
lorem: sha1.encode('Lorem ipsum dolor sit, amet consectetur adipisicing elit. Perferendis, officia. Maxime, eveniet similique modi quia illo inventore nemo numquam ipsum quod amet veniam, ullam facere. Ullam esse odit laboriosam consectetur!'),
test: sha1.encode('test')
}
];
console.table(sha1Results);
</script>
</body>
</html>
Output
Node
const Md5 = require('@nogsantos/hash').Md5;
const Sha1 = require('@nogsantos/hash').Sha1;
// or just
// const { Md5, Sha1} = require('@nogsantos/hash');
const md5 = new Md5();
console.log('md5: ', md5.encode('Lorem ipsum dolor sit, amet consectetur adipisicing elit.'));
console.log('md5: ', md5.encode('test'));
const sha1 = new Sha1();
console.log('sha1: ', sha1.encode('Lorem ipsum dolor sit, amet consectetur adipisicing elit.'));
console.log('sha1: ', sha1.encode('test'));
License
MIT © Fabricio Nogueira