Honestly way too much went into this single commit. I am so sorry future me
This commit is contained in:
23
lib/gsEncryption/index.ts
Normal file
23
lib/gsEncryption/index.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import {Aes} from "https://deno.land/x/crypto@v0.10.0/aes.ts";
|
||||
import {Cbc, Padding} from "https://deno.land/x/crypto@v0.10.0/block-modes.ts";
|
||||
|
||||
const te = new TextEncoder();
|
||||
|
||||
const key = te.encode("EmmaHasHugeTitts");
|
||||
const data = te.encode("DataToBeEncrypted");
|
||||
const iv = new Uint8Array(16);
|
||||
|
||||
const cipher = new Cbc(Aes, key, iv, Padding.PKCS7)
|
||||
const decipher = new Cbc(Aes, key, iv, Padding.PKCS7)
|
||||
|
||||
const encrypted = cipher.encrypt(data);
|
||||
const decrypted = decipher.decrypt(encrypted);
|
||||
|
||||
console.decode = function (encoded: Uint8Array) {
|
||||
const td = new TextDecoder();
|
||||
this.log(td.decode(encoded));
|
||||
}
|
||||
|
||||
console.decode(data);
|
||||
console.decode(encrypted);
|
||||
console.decode(decrypted);
|
Reference in New Issue
Block a user