Questions tagged [cryptojs]

CryptoJS is a growing collection of standard and secure cryptographic algorithms implemented in JavaScript using best practices and patterns. They are fast, and they have a consistent and simple interface.

CryptoJS is a growing collection of standard and secure cryptographic algorithms implemented in JavaScript using best practices and patterns. They are fast, and they have a consistent and simple interface.


Resources :

1614 questions
15
votes
1 answer

My CryptoJS encryption/decryption is not working

I have an array of JSON arrays whose values I am trying to encrypt with CryptoJS and then print for use in another file, where these values should be decrypted using a user-given passphrase. But I am doing something wrong and I am getting "Uncaught…
Viktor
  • 487
  • 2
  • 8
  • 26
14
votes
1 answer

What is a WordArray?

I've been looking at crypto-js and its encoder converts to and from a WordArray. I looked up the documentation and couldn't find any explanation of what a WordArray might be. To the best of my knowledge, there isn't even a typed array in JavaScript…
Water Cooler v2
  • 32,724
  • 54
  • 166
  • 336
14
votes
1 answer

CryptoJS : key.clamp is not a function

TypeError: key.clamp is not a function at Object.init (path/node_modules/crypto-js/hmac.js:58:18) The error above occurs when I try to create JWT in Javascript with the relevant code below. const CryptoJS = require('crypto-js'); var hash =…
Midori
  • 471
  • 1
  • 7
  • 11
14
votes
3 answers

How can I encrypt/decrypt arbitrary binary files using Javascript in the browser?

I need to let users load files from their system, encrypt them on-the-fly and upload to the server and do the opposite thing (download files from the server, decrypt on the fly and let the user save them locally). The exact crypto method is not very…
Alex
  • 2,469
  • 3
  • 28
  • 61
13
votes
2 answers

CryptoJS encrypt in aes-256-cbc returns an unexpected value

I am encrypting some data using CryptoJS and comparing it to an online tool and I am not getting the same result. In fact the result from CryptoJS in not decryptable with the tool. I am trying to encrypt in AES-256-CBC with the following…
Alex Blais
  • 145
  • 1
  • 2
  • 6
13
votes
3 answers

Trying to add data in unsupported state at Cipher.update

Below code is working var crypto = require('crypto'); var cipher = crypto.createCipher('aes-128-cbc','abcdefghijklmnop') var http = require('http') var userStr = 'a134aad'; var crypted = cipher.update(userStr, 'utf8', 'hex'); crypted +=…
jiajianrong
  • 868
  • 8
  • 24
13
votes
2 answers

Generating unique tokens in a NodeJS, Crypto Token authentication environment

Using nodejs and crypto, right now, when a user logs in, I generate a random auth token: var token = crypto.randomBytes(16).toString('hex'); I know it's unlikely, but there is a tiny chance for two tokens to be of the same value. This means a user…
Dany D
  • 1,189
  • 2
  • 18
  • 44
13
votes
3 answers

Crypto-js returns different values every time it's run when using AES

I'm trying to encrypt something using crypto-js and using the AES type of encryption. The problem i'm having is that my encrypted value is different every time I encrypt it. With this simple example, I run the same encryption 5 different times and I…
Catfish
  • 18,876
  • 54
  • 209
  • 353
13
votes
3 answers

AES encryption using Java and decryption using Javascript

I am making an application which needs Java based AES Encryption and JavaScript based decryption. I am using the following code for encryption as a basic form. public class AESencrp { private static final String ALGO = "AES"; private static…
rkj
  • 793
  • 1
  • 6
  • 10
13
votes
2 answers

Can't decrypt string with CryptoJS

I'm trying to encode/decode data using CryptoJS, as a preliminar test for the code I want to develop. This is the code I'm using for encrypting: