Skip to content

Instantly share code, notes, and snippets.

View ismailisimba's full-sized avatar
🤓
Learning, always!

Ismaili Simba ismailisimba

🤓
Learning, always!
View GitHub Profile
@dudepare
dudepare / sample_crypto_aes.js
Created August 10, 2016 06:51
This is a sample of AES encryption + decryption using CryptoJS. This is a bit different from the examples out there because this one uses a COMPANY header + payload. There's a little bit more processing going on. I also used a CDN for CryptoJS. I hope someone finds this useful.
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/components/core-min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/components/sha256.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/components/enc-base64.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/aes.js"></script>
<script>
function toWordArray(str){
return CryptoJS.enc.Utf8.parse(str);
}
function toString(words){
// Imports the Google Cloud client library
const { BigQuery } = require('@google-cloud/bigquery');
// Defines the location of the dataset and tables
const location = 'US';
// Creates a BigQuery client
const bigquery = new BigQuery({
// The relative file path to your Service Account key file
keyFilename: 'bigquery-sa.json',