Encrypt-Decrypt Data

cryptData(data, password)

This method uses the AES-256 algorithm to encrypt an information string, and returns the hexadecimal representation of itself.

let string = 'Some super secret'
let password = 'AReallyStrongPassword!!'
const scrypta = window.ScryptaCore
let encrypted = await scrypta.cryptData(string, password)
/*
Risposta:
befba636e2212846bf1c15ff4ef9e5a17ac3e6f1ce3935f4639849d44b8c9565
*/

decryptData(data, password)

This method decrypts a previously encrypted string and returns its original content. It will return false if the password is incorrect.

let hex = 'befba636e2212846bf1c15ff4ef9e5a17ac3e6f1ce3935f4639849d44b8c9565'
let password = 'AReallyStrongPassword!!'
const scrypta = window.ScryptaCore
let decrypted = await scrypta.decryptData(hex, password)
/*
Risposta:
Some super secret
*/