Skip to content

Instantly share code, notes, and snippets.

@adamTrz
Created November 4, 2019 15:16
Show Gist options
  • Select an option

  • Save adamTrz/e6a67ab997a6f779967f1e92671df657 to your computer and use it in GitHub Desktop.

Select an option

Save adamTrz/e6a67ab997a6f779967f1e92671df657 to your computer and use it in GitHub Desktop.
const decrypt = (encryptedHex: string) => {
const encryptedBytes = aes.utils.hex.toBytes(encryptedHex);
const aesCtr = new aes.ModeOfOperation.ctr(aes256key);
const decryptedBytes = aesCtr.decrypt(encryptedBytes);
const decryptedText = aes.utils.utf8.fromBytes(decryptedBytes);
return decryptedText;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment