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
11
votes
4 answers

Encrypt with CryptoJS and decrypt with PHP

On the client side (mobile device) I encrypt a users password with CryptoJS: var lib_crypt = require('aes'); $.loginButton.addEventListener('click', function(e){ var key =…
Papauha
  • 169
  • 1
  • 1
  • 8
11
votes
3 answers

How to decrypt a cryptojs AES encrypted message at the java server side?

I have the following cryptojs based javascript encryption/decryption functions which works perfectly fine. I use a random salt, random iv value and a specific password while encrypting the message using cryptpjs. I reuse the same salt, iv and the…
user1455719
  • 1,045
  • 4
  • 15
  • 35
10
votes
1 answer

What is the shortest hash with Nodejs crypto

What is the shortest string hash algo in the nodejs crypto module? Is there anything similar to crc32, which produces 8-character string , but unfortunately is not natively supported by crypto (I know that there are external modules, but I'm…
user2531657
  • 339
  • 2
  • 9
10
votes
5 answers

Import crypto-js in an angular 2 project (created with angular-cli)

I'm trying to import crypto-js in my angular2 project. I followed several SO questions and also angular-cli guide, but at the end I still have the error Cannot find module 'crypto-js' What I tried : npm install crypto-js --save and typings install…
Greg
  • 792
  • 2
  • 9
  • 24
10
votes
2 answers

How to get digest representation of CryptoJS.HmacSHA256 in JS

I have to generate string representation of CryptoJS.HmacSHA256 in digest (bytes representation). I need it because i have to duplicate python code which generate such digest in javascript: print hmac.new("secret", "test",…
Andriy Ivaneyko
  • 20,639
  • 6
  • 60
  • 82
10
votes
2 answers

How to decrypt an ArrayBuffer?

I've been trying to decrypt an ArrayBuffer object using CryptoJS, but so far it always returns a blank WordArray. The files (images) are encrypted in an iOS and Android app, sent to a server, and downloaded in this web app to be decrypted and…
jjv360
  • 4,120
  • 3
  • 23
  • 37
10
votes
4 answers

nodejs crypto module vs crypto-js

I'm quite new to NodeJs and trying to figure out how to use the "crypto" module. While playing around with it I notice the difference between the "crypto" module in NodeJs and crypto-js: With crypto-js, I have: function SHA256Hash(password, salt,…
Mono
  • 101
  • 1
  • 1
  • 5
9
votes
3 answers

C - tiny-aes-c and Javascript CryptoJS interoperability

Using tiny-aes-c. Consider the following C code: int main(int argc, char const *argv[]) { uint8_t key[6] = { 's','e','c','r','e','t' }; uint8_t iv[16] = { 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd,…
Shlomi Schwartz
  • 8,693
  • 29
  • 109
  • 186
9
votes
1 answer

In Angular2 the SHA256 hash of a file generated does not match with SHA256 from other sites

I'm trying to generate SHA-256 hash for files. I have used https://www.npmjs.com/package/crypto-js library for that. please see below code for that. import { Component, OnInit } from '@angular/core'; var SHA256 =…
comeback4you
  • 716
  • 1
  • 8
  • 24
9
votes
1 answer

How does CryptoJS get an IV when none is specified?

When using CryptoJS.AES.encrypt how does it come up with an Initialization Vector if the third argument is not passed to the function? Is there a way to get it out of the encrypted string? The reason I need this is I need to decrypt something…
warspyking
  • 3,045
  • 4
  • 20
  • 37
9
votes
4 answers

AES decryption with password using CryptoJS returns a blank value

Scenario I've got the following code:
Please wait...
Insert new note:
Stubborn
  • 995
  • 4
  • 17
  • 30
9
votes
2 answers

Output is different every time when the same text is encrypted with CryptoJS

I'm extremely frustrated about a lot of time wasted trying to encrypt something with CryptoJS, after some time, I have realized that every time I encrypt the result is different with the same input! How can this be possible? This is my code and you…
Jose Ignacio Hita
  • 874
  • 1
  • 10
  • 17
9
votes
4 answers

JavaScript: How to generate Rfc2898DeriveBytes like C#?

EDIT: Per discussion in the comments, let me clarify that this will be happening server side, behind SSL. I do not intend to expose the hashed password or the hashing scheme to the client. Assume we have an existing asp.net identity database with…
Gojira
  • 2,941
  • 2
  • 21
  • 30
9
votes
1 answer

How to convert to string and back again with CryptoJs

var encrypted = CryptoJS.AES.encrypt(jsonStr, 'youngunicornsrunfree', { format: JsonFormatter }); //convert encrypted to a string for transfer //convert string back to Crypto object so it can be decrypted. var decrypted =…
williamsandonz
  • 15,864
  • 23
  • 100
  • 186
8
votes
1 answer

How to Encrypt Data in Javascript with RSA public key?

Server generates RSA public and private keys and store them in the session. Over a server call the client html page recieves the public key. Now I want to encrypt data using it. I have tried using jsencrypt but it doesn't recognize the public key my…