“Criptografar descriptografar JavaScript” Respostas de código

Criptografar descriptografar JavaScript

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

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

console.log(encryptedString);
Undefined

Criptografar descriptografar em JavaScript de baunilha

 var encrypted = CryptoJS.AES.encrypt("Message", "Secret Passphrase");
//U2FsdGVkX18ZUVvShFSES21qHsQEqZXMxQ9zgHy+bu0=

var decrypted = CryptoJS.AES.decrypt(encrypted, "Secret Passphrase");
//4d657373616765


document.getElementById("demo1").innerHTML = encrypted;
document.getElementById("demo2").innerHTML = decrypted;
document.getElementById("demo3").innerHTML = decrypted.toString(CryptoJS.enc.Utf8);
Poor Porcupine

Decriptografia de criptografia JavaScript

const baseString = 'konrad';
const encodedString = window.btoa( baseString ); // "a29ucmFk"
const decodedString = window.atob( encodedString ); //konrad
KadzielawaKonrad

criptografar e descriptografar em nodejs

const Cryptr = require('cryptr');const cryptr = new Cryptr('myTotalySecretKey'); const encryptedString = cryptr.encrypt('bacon');const decryptedString = cryptr.decrypt(encryptedString); console.log(encryptedString); // e7b75a472b65bc4a42e7b3f78833a4d00040beba796062bf7c13d9533b149e5ec3784813dc20348fdf248d28a2982df85b83d1109623bce45f08238f6ea9bd9bb5f406427b2a40f969802635b8907a0a57944f2c12f334bd081d5143a357c173a611e1b64aconsole.log(decryptedString); // bacon
dev-RP

Encrypt JS

function getMessageEncoding() {
  const messageBox = document.querySelector(".rsa-oaep #message");
  let message = messageBox.value;
  let enc = new TextEncoder();
  return enc.encode(message);
}

function encryptMessage(publicKey) {
  let encoded = getMessageEncoding();
  return window.crypto.subtle.encrypt(
    {
      name: "RSA-OAEP"
    },
    publicKey,
    encoded
  );
}
Blue-eyed Booby

Javascript String Criptografia e descriptografia

var encrypted = CryptoJS.AES.encrypt("Message", "Secret Passphrase");
//U2FsdGVkX18ZUVvShFSES21qHsQEqZXMxQ9zgHy+bu0=

var decrypted = CryptoJS.AES.decrypt(encrypted, "Secret Passphrase");
//4d657373616765


document.getElementById("demo1").innerHTML = encrypted;
document.getElementById("demo2").innerHTML = decrypted;
document.getElementById("demo3").innerHTML = decrypted.toString(CryptoJS.enc.Utf8);
Selfish Snail

Respostas semelhantes a “Criptografar descriptografar JavaScript”

Perguntas semelhantes a “Criptografar descriptografar JavaScript”

Procure respostas de código populares por idioma

Procurar outros idiomas de código