Socket
Socket
Sign inDemoInstall

rjutils-collection

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rjutils-collection - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

2

package.json
{
"name": "rjutils-collection",
"version": "1.0.4",
"version": "1.0.5",
"description": "Easy and Lightweight Utilities",

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

@@ -24,2 +24,8 @@ <h1 align="center">Welcome to rjutils-collection 👋</h1>

or
```sh
yarn add rjutils-collection
```
## Usage

@@ -64,2 +70,37 @@

Encrypting a String
```js
const utils = require('rjutils-collection')
const result = utils.encryptString({
text: 'Hello, World!',
algorithm: 'sha256',
key: '123456789',
output: 'hex'
})
```
Decrypting a String
```js
const utils = require('rjutils-collection')
const result = utils.decryptString({
text: 'cf5ca2c244e71e33e30d07d5c13a4502!',
algorithm: 'sha256',
key: '123456789',
output: 'utf8'
})
```
Hashing a String
```js
const utils = require('rjutils-collection')
const result = utils.hashString({
text: 'Hello World again!',
algorithm: 'sha256',
digest: 'hex'
})
```
## Author

@@ -66,0 +107,0 @@

@@ -127,3 +127,3 @@ const path = require('path')

* @prop {String} [algorithm] The Algorithm to use
* @prop {String} [digest] The Text Output (base64, base64url, binary, hex)
* @prop {String} [digest] The Text Output (base64, base64url, binary, hex, bytes)
* @prop {String} text The Text to Hash

@@ -130,0 +130,0 @@ *

@@ -34,5 +34,7 @@ const crypto = require('crypto')

const hash = crypto.createHash(algorithm).update(String(options.text)).digest(digest).substring(0, 32)
let hash
if (digest === 'bytes') hash = crypto.createHash(algorithm).update(String(options.text))
else hash = crypto.createHash(algorithm).update(String(options.text)).digest(digest)
return hash
}
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