Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hubot-hashme

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hubot-hashme - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

2

package.json
{
"name": "hubot-hashme",
"version": "0.2.0",
"version": "0.3.0",
"author": "tgfjt",

@@ -5,0 +5,0 @@ "description": "to create hash with crypto for hubot",

@@ -11,5 +11,5 @@ // Description:

robot.respond(/hashme (.*) (.*)/i, function(msg) {
robot.respond(/hashme (.*?) (.*)$/i, function(msg) {
return msg.send(hashMe(msg.match[1], msg.match[2]));
});
};

@@ -6,22 +6,64 @@ var test = require('tape');

test('hashme regexp', function (t) {
t.plan(6);
var re = /hashme (.*?) (.*)$/i;
var sample1 = 'hubot hashme sha1 This is some text'.match(re);
var sample2 = 'hubot hashme sha512 http://example.com:5000'.match(re);
var sample3 = 'hubot hashme FOO BAR BAZ'.match(re);
t.equal(
sample1[1],
'sha1',
'to get hash algorithm');
t.equal(
sample1[2],
'This is some text',
'to get message text');
t.equal(
sample2[1],
'sha512',
'to get hash algorithm');
t.equal(
sample2[2],
'http://example.com:5000',
'to get message text');
t.equal(
sample3[1],
'FOO',
'to get hash algorithm');
t.equal(
sample3[2],
'BAR BAZ',
'to get message text');
});
test('hashme wrong algorithm', function (t) {
t.plan(1);
var wrong = hashMe('hoge', '123');
t.equal(wrong, 'algorithm should to be... sha1, md5, sha256, sha512', 'to get Error message');
t.end();
});
test('hashme sha1 123', function (t) {
var sha1 = hashMe('sha1', '123');
t.plan(1);
t.equal(sha1, '40bd001563085fc35165329ea1ff5c5ecbdbbeef', 'to create sha1');
t.end();
t.equal(
hashMe('sha1', '123'),
'40bd001563085fc35165329ea1ff5c5ecbdbbeef', 'to create sha1');
});
test('hashme sha256 123', function (t) {
var sha256 = hashMe('sha256', '123');
t.plan(1);
t.equal(sha256, 'a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3', 'to create sha256');
t.equal(
hashMe('sha256', '123'),
'a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3', 'to create sha256');

@@ -32,15 +74,15 @@ t.end();

test('hashme sha512 123', function (t) {
var sha512 = hashMe('sha512', '123');
t.plan(1);
t.equal(sha512, '3c9909afec25354d551dae21590bb26e38d53f2173b8d3dc3eee4c047e7ab1c1eb8b85103e3be7ba613b31bb5c9c36214dc9f14a42fd7a2fdb84856bca5c44c2', 'to create sha512');
t.end();
t.equal(
hashMe('sha512', '123'),
'3c9909afec25354d551dae21590bb26e38d53f2173b8d3dc3eee4c047e7ab1c1eb8b85103e3be7ba613b31bb5c9c36214dc9f14a42fd7a2fdb84856bca5c44c2', 'to create sha512');
});
test('hashme md5 123', function (t) {
var md5 = hashMe('md5', '123');
t.plan(1);
t.equal(md5, '202cb962ac59075b964b07152d234b70', 'to create md5');
t.equal(hashMe('md5', '123'), '202cb962ac59075b964b07152d234b70', 'to create md5');
t.end();
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc