DEV Community

Dhruv Sharma
Dhruv Sharma

Posted on

Can I achieve this encryption with javascript ..?

$cnum =trim($_POST['cnum']);
$ciphering = "AES-128-CTR";
$iv_length = openssl_cipher_iv_length($ciphering);
$options = 0;
$encryption_iv = '1234467892211121';
$encryption_key = "SECRET";
$en = openssl_encrypt($cnum, $ciphering, $encryption_key, $options, $encryption_iv);
can i do same encryption with javascript

Top comments (3)

Collapse
 
crimsonmed profile image
Médéric Burlet

This really depends on what you are trying to do and what environment you are running in (nodejs, electron, web)
There is a crypto library and a cryptoJs one that are very popular

How to implement encryption and decryption using AES (Advanced Encryption Standard) in JavaScript.

Why AES (Advanced Encryption Standard) ?

Security: Competing algorithms were to be judged on their ability to resist attack, as compared to other submitted ciphers, though security strength was to be considered the most important factor in…

Collapse
 
dhruvsharma001 profile image
Dhruv Sharma

with cryptojs this doesn't seem possible .. I tried with few others but nothing got me this exact encryption ..

Some comments may only be visible to logged-in visitors. Sign in to view all comments.