Skip to content

Instantly share code, notes, and snippets.

@artiya4u
Created July 17, 2020 19:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save artiya4u/668e856dff1b1ef021fade83d496e8a7 to your computer and use it in GitHub Desktop.
Save artiya4u/668e856dff1b1ef021fade83d496e8a7 to your computer and use it in GitHub Desktop.
CREATE TEMPORARY FUNCTION decrypt(_text STRING) RETURNS STRING LANGUAGE js AS
"""
let key = CryptoJS.enc.Utf8.parse("KEY");
let options = { iv: CryptoJS.enc.Utf8.parse("IV"), mode: CryptoJS.mode.CBC };
let _decrypt = CryptoJS.AES.decrypt(_text, key, options).toString(CryptoJS.enc.Utf8);
return _decrypt;
""" OPTIONS (library="gs://crypto-lib/crypto-js.min.js");
SELECT decrypt('ENCRYPTED');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment