encrypt decrypt php javascript

function encrypt_decrypt($string, $action = 'encrypt')
{
    $encrypt_method = "AES-256-CBC";
    $secret_key = 'AA74CDCC2BBRT935136HH7B63C27'; // user define private key
    $secret_iv = '5fgf5HJ5g27'; // user define secret key
    $key = hash('sha256', $secret_key);
    $iv = substr(hash('sha256', $secret_iv), 0, 16); // sha256 is hash_hmac_algo
    if ($action == 'encrypt') {
        $output = openssl_encrypt($string, $encrypt_method, $key, 0, $iv);
        $output = base64_encode($output);
    } else if ($action == 'decrypt') {
        $output = openssl_decrypt(base64_decode($string), $encrypt_method, $key, 0, $iv);
    }
    return $output;
}
 
echo "Your Encrypted password is = ". $pwd = encrypt_decrypt('spaceo', 'encrypt');
echo "Your Decrypted password is = ". encrypt_decrypt($pwd, 'decrypt');

3.75
8
Awgiedawgie 440215 points

                                    Betiel

3.75 (8 Votes)
0
3.56
9
Awgiedawgie 440215 points

                                    const Cryptr = require('cryptr');
const cryptr = new Cryptr('ReallySecretKey');

const encryptedString = cryptr.encrypt('Popcorn');
const decryptedString = cryptr.decrypt(encryptedString);

console.log(encryptedString);

3.56 (9 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
decode and encode messages decrypt and encrypt php php decrypt and encrypt string decrypt crypt function in php decrypt crypt function php php crypt function decrypt php decrypt aes crypt::decrypt php decrypt and encypt in php jsencrypt php decrypt php ecrypt and decrypt php encrypt decrypt text encrypt decrypt php 7 decrypt() php encrypt in php and decrypt in php php function to encrypt and decrypt message encrypt and decrypt in php decrypt data php str encrypt php how to encrypt and decrypt in php how encrypt and decrypt password in php php response encrypted payload how to decrypt encrypting and decrypting php php encrypt decrypt integer php encrypt decrypt int salt based encrypt and decrypt using php encrypted decrypt in php make an encryption and decryption in php php encryption decryption php mcrypt_decrypt php code encrypt to decrypt online Decrypt PHP code how to decrypt an encrypted code php password encryption and decryption in php php string encryption and decryption php string encryption and decryption? how to encrypt password and then decrypt password in php encrypt decrypt id in php decrypt php password how to encrypt string and decrypt string in php how to decrypt php password make custom encrypt decrypt in php php encrypt and decrypt text encrypt a string using decrypt key in php php decrypt string encrypted in codeinger 4 php encrypt decrypt id how to do encryotion and decryption in php php encrypt and decrypt with public key php encrypt decrypt files php encrypt decrypt vs rce encrypt in jquery and decrypt in php php encrypt message encrypt() decrypt php encrypt message crypt() decrypt decrypt in php php encrypt and decrypt an object php encrypt and decrypt data encrypt in php and decrypt in c# how to make a php encryption and decryption code how to encrypt and decrypt password in php using hash password encrypt decrypt php how to encryot decrypt php with key core php password encryption and decryption code core php password encryption and decryption php password encryption and decryption php simple 10 encrypt and decrypt encryption and decryption algorithm in php encryption in javascript and decryption in php php openssl encrypt and decrypt example php simple encrypt and decrypt algorithm secure way of encrypt/decrypt password in php how to encrypt decrypt in php decrypt function in php encrypt and decrypt php 7 php file decrypt how to encrypt data php and automatically decrypts them encryption and decryption password in php php encrypt and decrypt password decrypt crypt() in php Encrypt and decrypt text messages in pure PHP code encrypt and decrypt password in php mysql encryption and decryption php android php encrypt decrypt encryption and decryption in php class php encryption and decryption in php php openssl encrypt decrypt example crypt decrypt string php openssl encrypt and decrypt string php php encrypt decrypt string simple how to securely encrypt and decrypt in php decrypt password com encrypt php mcrypt_decrypt php hash decrypt php function encrypt decrypt password php php hash encrypt and decrypt php how to encrypt and decrypt a password in php ohow to encrypt and decrypt string in php encrypt decrypt function in php encrypt and decrypt number in php crypto encrypt and decrypt in php php crypt decrypt php encrypt_decrypt encrpt decrypt php mcrypt_encrypt php 7 how to encrypt and decrypt id in php php password encrypt and decrypt encryption and decryption php project how to decrypt encrypted php code php crypt encrypt decrypt what other methods can i use to encrypt and decrypt a string using php PHP decrypt string with key decrypt crypt password php android encrypt decrypt in php encrypted data encrypt and decrypt data in php how to encrypt and decrypt password php password decrypt php php mcrypt_decrypt example how to encrypt and decrypt password in php mysql php text encrypt decrypt decrypt php function simple decrypt php function php encrypt decrypt string pass decryptor in php encrypt decrypt file php encrypt decrypt text php encrypt and decrypt file php library encrypt and decrypt file php js encrypt php decrypt php encrypt and decrypt functions openssl encrypt and decrypt php php encrypt decrypt example sah1 decrypt in php decrypt with php php ecrypt and decrypt passwords php mysql encrypt decrypt data php simple password encrypt decrypt encrypting and decrypting in php php code for aes encryption and decryption openssl encrypt decrypt php encrypt decrypt php class php encrypt decrypt for url simple php encrypt decrypt php code to encrypt and decrypt password encrypt and decrypt string in php php how to encrypt and decrypt data php mcrypt_encrypt php 7 decrypt encrypted file php encrypting and decrypting data in php how to decrypt A STRING IN PHP Encryption php encryption and decryption code php password decrypt decrypt php encrypt and decrypt a string in php encryption and decryption in php example simple encryption and decryption in php easy php encryption decryption encrypt in js and decrypt in php encrypt and decrypt password php encrypt_decrypt php encryption decryption in php php how to decrypt password encrypt in php and decrypt in js how to decrypt php How to encrypt and decrypt password in PHP replace php encrypt decrypt encrypt and decrypt password in core php encrypt and decrypt password in php Encrypt with JAVA and Decrypt with PHP 5.php decrypt php rijndael encrypt/decrypt php encrypt and decrypt array php encrypt and decrypt function password encrypt and decrypt in php how to decrypt php hash php encrypt decrypt password php encrypt decrypt online encrypt in c# and decrypt in php encrypt password in windows form , decrypt in php encrypt decrypt password php encrypt password php how to incrypt decrypt in php php encrypter how to encrypt decrypt data in php crypt and decrypt url to 32 characters php make encrypted of length 32 php aes encryption php fast random encryption in php how to hash and unhash a string in php simple encrypt decrypt php function encrypt decrypt php php simple encrypt and decrypt php simple encrypt decrypt $ciphertext = base64_encode($ciphertext); add Salted hash with this in php when i decrypt php it gives me something else php encrypted php how to encrypt text with a salt how to encrypt in php encrypt in javascript and decrypt in php encrypt text like php word encrypter and decrypter php crypt encrypt php AES decryption in php encrypt and decrypt php encrypt decrypt php javascript openssl encrypt php rijndael encryption php 128 by 16 php strong encryptions for strings encryptIt php ssl encryption php example How to Encrypt and Decrypt a PHP String ? best encrypt decrypt php decrypt to encrypt php online php in encript by text not working encripted to text in php php encrypt decrypt with key hash encrypt decrypt php java encrypt decrypt in php bcrypt encrypt and decrypt php encrypted to plain text in not working php simple encrypt decrypt hash protect php openssl decrypt php php encrypt and decrypt how does php deal with incorect cipher keys PHP encrypt decrypt function encrypt decrypt in php encrypt and decrypt in php php encrypt/decrypt php encode with key how to re encrypt php Encrypt.php crypt and decrypt php how to make encryption in php string and decrypt how to encrypt and decrypt a string in php php encryption php encrypt decrypt length encrypy messages php ciphertext in function doesn't work but out of function does php ciphertext in fucntion doesnt work but out fo fucmtion does php aes ciphertext decryption information in php with iv and salt length tools to perform aes 256 encryption php php hash encrypt decrypt php script to encrypt an input encryption in php php encrypt and decrypt back to text php decrypt encrypt and decrypt using php encrypt php encryption php dcrypt and encrypt in php php encrypt decrypt php crypt to string decrypt encrypt php encrypt value in php aes-256 php save encryption key as text php encrypt string php encrypt how to decrypt in php rijndael_256 cbc 7 padding AES encrypt decrypt in php with salt aes encryption and decryption in php encrypt decrypt php
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source