Skip to content

Instantly share code, notes, and snippets.

View siddsarkar's full-sized avatar
💡
Exploring ideas

Siddhartha Sarkar siddsarkar

💡
Exploring ideas
View GitHub Profile
@siddsarkar
siddsarkar / webCryptoImplementation.js
Created February 9, 2022 07:59
A WebCrypto class that can be used to encrypt/decrypt data with password.
function WebCrypto() {
const buffToBase64 = (buff) => btoa(String.fromCharCode.apply(null, buff));
const base64ToBuff = (b64) =>
Uint8Array.from(atob(b64), (c) => c.charCodeAt(null));
const enc = new TextEncoder();
const dec = new TextDecoder();
const bytes = { salt: 16, iv: 12 };
/**
@siddsarkar
siddsarkar / draw.js
Last active July 12, 2022 17:09
HTML5 Canvas Whiteboard
window.onload = function () {
var myCanvas = document.getElementById("myCanvas");
var ctx = myCanvas.getContext("2d");
// Fill Window Width and Height
myCanvas.width = window.innerWidth;
myCanvas.height = window.innerHeight;
// Set Background Color
ctx.fillStyle = "#292a2d";