Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8978179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:32:51+00:00 2026-06-15T19:32:51+00:00

I’m working on uploading file encrypted on the client side using Node.js, and I

  • 0

I’m working on uploading file encrypted on the client side using Node.js, and I use SJCL (Stanford Javascript Crypto Library) to encrypt the file with Javascript.

But i noticed that the output or the result of the encryption is always different even with the same PassPhrase.

After few research i found that it’s because the salt is random each time and i need to do a ‘nosalt’ (sorry I’m new to everything here cryptographie, Node.js)

How can I change my code (or SJCL code) to generate the exact encrypt output each time when the password is the same.

My app is based on “Cryptloader” project, you can find it here: https://github.com/Kryil/Cryptloader

Encrypt:

var part = file_queue[data["id"]].slice(start, end)

var reader = new FileReader()
reader.onload = function(e)
{
var passwd = document.getElementById("password").value

console.log("Uploading arraybuffer of size " + e.target.result.byteLength)
var i32a = new Int32Array(e.target.result)

var out = i32a.toJSONArray()

console.log("crypting: " + out)

var crypted = sjcl.encrypt(passwd, out)

ws.send(JSON.stringify({
      "type": "fileslice",
      "data": {"id": data["id"], "slice": slice, "data": crypted}
}))
}
reader.readAsArrayBuffer(part)

Decrypt:

var decrypted = sjcl.decrypt(passwd, data["data"])

file_contents[file]["data"].push(new Int32Array(JSON.parse(decrypted)))

This is irrelevant question, but not all files upload correctly, some of them produce an error, but when i Change Int32Array to either Int16Array or Int8Array, it works for them but produce error for other files, what causes that and how to fix it.
The error:

Uncaught RangeError: ArrayBuffer length minus the byteOffset is not a multiple of the element size.
(Chrome Latest version, Win 7)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T19:32:52+00:00Added an answer on June 15, 2026 at 7:32 pm

    It’s not just the salt that makes the cipher text different each time it’s the iv too. But these are both security features that provide semantic security that you really should not disable and also shouldn’t need to disable, because the salt and iv can be included with the cipher text there isn’t anything keeping you from decryption at a later time by using a random salt or iv.

    That said the encrypt function you are using lets you pass your own filled out parameters for the crypto including salt and iv, but to hard-code those to a fixed value (I would like to strongly point out) is not the api intention and an abuse of the api.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am reading a book about Javascript and jQuery and using one of the
I want use html5's new tag to play a wav file (currently only supported
I am trying to render a haml file in a javascript response like so:
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I am trying to understand how to use SyndicationItem to display feed which is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.