Socket
Socket
Sign inDemoInstall

cryptorjs

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cryptorjs - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

4

CHANGELOG.md

@@ -7,2 +7,6 @@ # Change Log

## [1.2.0] - 2017-06-10
### Added
- Static methods MD5 and SHA1
## [1.1.0] - 2017-06-07

@@ -9,0 +13,0 @@ ### Added

2

package.json
{
"name": "cryptorjs",
"version": "1.1.0",
"version": "1.2.0",
"description": "Encrypt and decrypt string, number and object using a key",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -69,2 +69,15 @@ # Cryptorjs

### MD5 and SHA1 helpers
```javascript
var cryptorjs = require('cryptorjs');
cryptorjs.md5('ciao');
/*=> '6e6bc4e49dd477ebc98ef4046c067b5f'*/
cryptorjs.sha1('ciao');
/*=> '1e4e888ac66f8dd41e00c5a7ac36a32a9950d271'*/
```
## License

@@ -71,0 +84,0 @@ Cryptorjs is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)

@@ -19,3 +19,2 @@ /**

constructor(key, algorithm = 'aes-256-ctr'){
if(typeof key === 'undefined')

@@ -61,2 +60,20 @@ throw new Error('required key');

}
/**
* MD5 hash
* @param str
* @returns {*}
*/
static md5(str){
return crypto.createHash('md5').update(str).digest('hex');
}
/**
* SHA1 hash
* @param str
* @returns {*}
*/
static sha1(str){
return crypto.createHash('sha1').update(str).digest('hex');
}
}

@@ -63,0 +80,0 @@

/**
* Created by Fabio on 07/06/2017.
*/
const crypto = require('crypto');

@@ -5,0 +6,0 @@ /**

@@ -152,2 +152,17 @@ /**

});
describe('hash helper', function () {
it('should be return md5 hash', function () {
let origin = 'ciao';
let result = cryptor.md5(origin);
console.log(origin, result);
assert.equal(result, '6e6bc4e49dd477ebc98ef4046c067b5f');
});
it('should be return sha1 hash', function () {
let origin = 'ciao';
let result = cryptor.sha1(origin);
console.log(origin, result);
assert.equal(result, '1e4e888ac66f8dd41e00c5a7ac36a32a9950d271');
});
});
});
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