RangeError: Input buffers must have the same byte length
Explosion-Scratch opened this issue Β· comments
--Explosion-- commented
I am getting this error:
RangeError: Input buffers must have the same byte length
at decrypt (/home/runner/encryptstuff/node_modules/stegcloak/components/encrypt.js:41:10)
at StegCloak.reveal (/home/runner/encryptstuff/node_modules/stegcloak/stegcloak.js:94:7)
at /home/runner/encryptstuff/index.js:24:22
at Layer.handle [as handle_request] (/home/runner/encryptstuff/node_modules/express/lib/router/layer.js:95:5)
at next (/home/runner/encryptstuff/node_modules/express/lib/router/route.js:137:13)
at next (/home/runner/encryptstuff/node_modules/express/lib/router/route.js:131:14)
at next (/home/runner/encryptstuff/node_modules/express/lib/router/route.js:131:14)
at next (/home/runner/encryptstuff/node_modules/express/lib/router/route.js:131:14)
at next (/home/runner/encryptstuff/node_modules/express/lib/router/route.js:131:14)
at next (/home/runner/encryptstuff/node_modules/express/lib/router/route.js:131:14)
Using this code to decrypt:
// Use an express route, suitable for either GET or POST
app.all("/decrypt", (req, res) => {
// Conbining req.query and req.body
var body = {...req.query, ...req.body}
// Enc is a 'new Stegcloak(true, false)'
let decrypted = enc.reveal(body.data || body.text, body.password || body.pass);
// Log
console.log(decrypted)
// Send to client
res.json(decrypted);
})
With this form body:
// POST /decrypt
{
"text": "Here's β’ββ’β£β’β’βββ’ββββ’ββ‘βββ‘ββ’β’ββ‘β’β‘βββ‘ββ‘β’βββ’βββ‘βββ’ββββ’β€ββ’β£ββ’ββ’β’βββ’ββ‘β’β’β’β‘ββ’β’β€βββββ’β’ββββ’ββ’β’β‘β£ββ’β£βββ‘β’β£β’ββ‘ββ’β£βββ€ββ’βββ€ββ’ββ£β‘β’β‘β£β’β’β‘β’β‘ββ€ββ’βββ£β’β ββ‘ββ’β’β’β‘βββ‘ββ’β’β’ββ‘βββ€ββ’β‘ββ€ββββ’β’β‘ββ’β‘βββ€βββ’β‘β’ββ’β‘β’ββ’β’β‘βββββ’β‘ββ’β’β’β‘β’βββ’β‘ββ‘βββ’βββ‘ββββ’β‘ββββ€ββ‘ββββ‘ββ’β‘ββ‘β’ββ’ββ€β€β’β‘β’βββ’β£β‘β’β‘β’β‘β’ββ’β‘βββ‘ββ‘ββββ‘β£ββ‘ββββ‘β’ βββ‘β’ββ’β’ββ€βββ‘ββ’β’ββ’ββ’β’ββ’ββββ‘β’βββ€β’β€ββ‘ββ’βββ’β’βββ‘ββ‘β’βββ£ββ€β’βββββββ‘β’βββ’βββ€β‘βββ‘β£β£β€β’β‘βββ€β’β£β’ββ€βββ’ββ’ββ‘β’β’β’β’β‘ββ‘β’β£β’β£ββ‘ββ’βββ’ββ‘ββ€β‘ββββ’β€β‘βββ‘ββ‘β’β£β£β‘ββββ β‘β’ββ’ββ’ββ€β’ββ’ββ‘β’β’β’ββ’ββ‘βββ€β£βββ’β‘βββ‘ββ’ββ’β’β£βββββ‘ββ€β’ββ’β’β£β€ββ‘ββ‘ββ‘β£β’β‘ββ’β’ββββ’ββ£β‘ββ‘ββ€ββ‘β’ββ‘β’β‘ββ’β£β’β’ββ‘β£β€ββ‘ββ‘β’β‘β’ββ’ββ’βββ’βββ€β’β‘β’ββ’β£ββ’ββ£β’β‘β’β‘ββββ‘ββ‘ββββββ‘ β’ββ’β’β‘ββ‘β’β‘β’ββββ’β‘βββ‘β£ββββ‘ββ’β’ββ‘β’ββββ‘ββ’β‘β£β‘β’β’ββ’ββ’ββ‘β£ββ’ββ‘β£ββ€ββββ‘β’ββ’β’β‘ββ’β‘β’β’β‘ββ‘ββ‘ββ€β£βββ’ββ€β’ββ‘β£ββ’β‘βββ‘β’β’β£β’β‘ββ’β’β’βββ’β’βββββ’β’ββ’ββ‘ββ‘ββ‘ββ’β’β’β’ββ‘β’β’ββββ£β’ β’β’β€ββ‘β’β‘β’β‘βββ£ββ’βββ‘βββ’ββ£β‘ββ’ββ‘β’ββ‘βββ€ββ’ββ€βββ‘β’ββββ‘βββ’β‘ββββ‘ββ‘βββ€β’β€ββββ‘βββ’β’β’ββ€β‘β£ββ’β‘β’β‘ββ£βββ’ββ’β’β’ββ’ββ’ββ€ββ‘ββ’ββ£β’ββββ’ββ‘β£β‘ββ’β’ββ€ββ’β‘ββ’ββ’β€β‘βββ€β€ββ‘β’β’β’β’ ββββ‘β’βββ’β’β‘β£β£β’ββ‘β’β’ββ£βββ‘βββ’β€ββ’β£ββββββ€β€ββ‘βββ’βββββββ’β’β£ββ’βββ’β‘βββ€ββββ€ββ’β£β’ββ€β’β£β’β‘β’ββββ‘β’βthe code!",
"pass": "42"
}
Encrypted this:
// POST /encrypt
{
"hide": "chrome.contextMenus.create({ id: `encrypt`, title: `Encrypt "%s"`, contexts: [\'selection\'], onclick: (info) => { const { menuItemId: id , selectionText: selected } = info; console.log(info); encrypt(selected).then((res) => { prompt(_gui.encrypt, res) }); } }, log("Created context menu"))",
"show": "Here's the code!",
"pass": "42"
}
Express code to encrypt:
app.all("/encrypt", (req, res) => {
var body = {...req.query, ...req.body}
let encrypted = enc.hide(body.secret || body.hide, body.password || body.pass, body.cover || body.show || body.text)
res.json(encrypted);
})
Mohana sundar commented
This happens if the exact stegcloake'd output is not fed into decrypt.
--Explosion-- commented
This happens if the exact stegcloake'd output is not fed into decrypt.
Thank you!