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
8
votes
1 answer

Decode(Base64) and Decrypt(AES/CBC/PKCS5PADDING) with CryptoJS - React

I am working on the web application using react as front-end and spring mvc as back-end. I need to store some user information in local storage of the browser. I do not want to store that info in local storage as a plain text. So I thought to go for…
samkit shah
  • 657
  • 7
  • 18
8
votes
0 answers

Encrypt / decrypt file (CryptoJS)

When working on the task "Encrypt / decrypt file (CryptoJS.AES)" I encountered a problem: the official documentation is not described the process of encrypting and decrypting files. The problem was that after decryption the file was corrupted. This…
Кирилл
  • 89
  • 1
  • 2
8
votes
1 answer

Cipher a string using crypto-js with hex encoding to make it url friendly

I am using crypto-js by brix. I have this function below that handles the encryption of a plain text. import CryptoJS from 'crypto-js' import AES from 'crypto-js/aes' const SECRET = 'I am batman' const plainText = 'This is Sparta!' export function…
jofftiquez
  • 7,548
  • 10
  • 67
  • 121
8
votes
6 answers

C# SHA256 ComputeHash result different with CryptoJS SHA256 function

I have a C# function as below: string stringvalue = "530500480530490480530480480520570480520510500490"; var encodedvalue= Encoding.Unicode.GetBytes(stringvalue); using (HashAlgorithm ssp =…
Koo SengSeng
  • 933
  • 3
  • 12
  • 31
8
votes
3 answers

Crypto.js decrypt with key and iv (vector) in byte arrays

I have to decrypt some strings which are AES encrypted. Example encrypted string: 129212143036071008133136215105140171136216244116 I have a key, and a vector (iv) supplied to me in a byte-array format: Key: [ 123, 217, 20, 11, 24, 26, 85, 45,…
Mbmahs
  • 111
  • 1
  • 1
  • 5
8
votes
1 answer

Nodejs crypto.pbkdf2 result is different from CryptoJS.PBKDF2

I'm working with PBKDF2 on frontend (CryptoJS) and backend (Node.js), both the derived key must be equal so, I use the same salt, same algo, same number of iteration, same password, but the derived key is different. This is the Browser/cryptoJS…
TheZero
  • 105
  • 1
  • 5
8
votes
1 answer

Difference between CryptoJS.enc.Base64.stringify() and normal Base64 encryption

I'm trying to encrypt the following hash to base64: 6bb984727b8c8c8017207e54b63976dc42ea9d24ad33bd5feeaa66869b650096 It's needed to access the API of a website. The website shows an example script in JavaScript using the…
Bobface
  • 2,782
  • 4
  • 24
  • 61
8
votes
3 answers

Encrypt in python - decrypt in Javascript

I have need to simply encrypt some text in python and being able to decrypt in JavaScrypt. So far I have in python: from Crypto import Random from Crypto.Cipher import AES import base64 BLOCK_SIZE = 16 key = "1234567890123456" # want to be 16…
bensiu
  • 24,660
  • 56
  • 77
  • 117
8
votes
1 answer

Java to JS and JS to Java encryption using cryptojs

I got on this post a couple of weeks ago and worked perfectly: Compatible AES algorithm for Java and Javascript Now, I need to do the reverse operation, but once in java, I am getting this exception: javax.crypto.BadPaddingException: Given final…
P. Lalonde
  • 694
  • 1
  • 7
  • 17
8
votes
1 answer

AES 256 on the client side (JS) and in the server (PHP)

I'm trying to encrypt and decrypt data on the server side and the client using the same type of operation, which is AES-256. On the server I use PHP and client I use CryptoJS so far I could only encrypt and decrypt the client on the server, see the…
thebestclass
  • 169
  • 1
  • 3
  • 9
8
votes
2 answers

cryptojs: How to generate AES passphrase

I want to generate a 256bit password for my AES encryption. When I check the password after the encryption it is different from my initial password. What am I doing wrong? Or is there some security mechanism I am not aware of? My…
Ron
  • 133
  • 1
  • 1
  • 8
8
votes
2 answers

How to get correct SHA1 hash of BLOB using CryptoJS?

CryptoJS v3.1.2, sha1.js rollup In JS I want to calculate the SHA1 of a blob before sending it to the server. On the server I want to calculate the SHA1 of the resulting file and compare it to the SHA1 received from JS. The problem is that the hash…
Val Kornea
  • 4,469
  • 3
  • 40
  • 41
7
votes
1 answer

Using NodeJS Crypto module in browser with webpack

I am writing a javascript REPL that is intended to run in the browser and execute nodejs crypto functions. My project is in ReactJS and I am using webpack to bundle all the modules and dependencies together. I am trying to include the builtin node…
gilsho
  • 81
  • 1
  • 3
7
votes
1 answer

"TypeError: Cannot read property 'sigBytes' of undefined" error in pre-request CryptoJS script

I'm getting "TypeError: Cannot read property 'sigBytes' of undefined" error when running a postman collection with a cryptojs pre-request script. The pre-request script computes a hmac-sha256 signature which is also part of parameters of the main…
7
votes
4 answers

AES encryption in Node JS and C# gives different results

I have a use case where the text has to be encoded and sent using the AES 256 algorithm. The client-side code is in C# which would be decrypting the code. Encryption code in JS: const crypto = require('crypto'); algorithm = 'aes-256-cbc', secret…
Suchetha B
  • 105
  • 1
  • 7