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

ecrypt

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ecrypt - npm Package Compare versions

Comparing version 1.0.0 to 2.0.0

asciiReferenceReverse.json

55

index.js

@@ -1,8 +0,5 @@

var fs = require("fs");
const fs = require("fs");
const reference = JSON.parse(fs.readFileSync('./asciiReferenceReverse.json'));
const asciiReference = JSON.parse(fs.readFileSync('./asciiReference.json'));
function sleep(time) {
return new Promise((resolve) => setTimeout(resolve, time));
}
function getKeyByValue(object, value) {

@@ -50,5 +47,2 @@ return Object.keys(object).find(key => object[key] === value);

const { hash, maxAttempt, attempt } = this
if (attempt > maxAttempt) {
await sleep(1000 * attempt);
}
const tokenArray = [...token];

@@ -79,3 +73,46 @@ let compareHash = this.createHash(word, tokenArray);

}
const ecrypt = (token, target) => {
module.exports = Ecrypt;
const rotateAscii = (...charKeys) => {
const min = 33, max = 126;
const keys = [...charKeys];
const total = keys.reduce((accumulator, currentValue) => accumulator + parseInt(currentValue), 0)
if (total <= max) {
return asciiReference[total];
} else {
let percentage = (parseInt(total) % parseInt(max)) + min
while (percentage > max) {
percentage = (parseInt(total) % percentage) + min;
}
return asciiReference[percentage]
}
}
const compareTokenAndTarget = (token, word) => {
if (token.length < word.length)
return { array: [...word], merge: [...token], length: token.length };
return { array: [...token], merge: [...word], length: token.length };
}
const merge = (response) => {
const { array, merge, length } = response;
let counter = 0;
const keys = [];
array.forEach(item => {
if (counter === length)
counter = 0;
console.log(counter)
if (!keys[counter])
keys.push(rotateAscii(reference[item], reference[merge[counter]]));
else
keys[counter] = (rotateAscii(reference[item], reference[merge[counter]], reference[keys[counter]]));
counter++;
})
return keys.join('')
}
const response = compareTokenAndTarget(token, target)
return merge(response)
}
module.exports = { Ecrypt, ecrypt };

4

package.json
{
"name": "ecrypt",
"version": "1.0.0",
"version": "2.0.0",
"description": "",

@@ -14,2 +14,2 @@ "main": "index.js",

}
}
}
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