Skip to content

Instantly share code, notes, and snippets.

(function() {
let alg = {name: "AES-GCM", length: 256}
let keyUsages = ["encrypt", "decrypt"]
function base64ToBuffer(base64) {
let binary_string = window.atob(base64)
let len = binary_string.length
let bytes = new Uint8Array(len)
for (var i = 0; i < len; i++) {
bytes[i] = binary_string.charCodeAt(i)
@llopv
llopv / nacl.html
Created July 8, 2017 10:17
Generating simmetric key, encrypt and decript "hello" with webcrypto and tweetnacl-js.
<script src="nacl-fast.js"></script>
<script>
function bytesToBase64(bytes) {
let binary = "";
let len = bytes.byteLength;
for (let i = 0; i < len; i++) {
binary += String.fromCharCode(bytes[i]);
}
return window.btoa(binary);
@llopv
llopv / keybase.md
Created November 20, 2016 19:41
keybase.md

Keybase proof

I hereby claim:

  • I am llopv on github.
  • I am llop (https://keybase.io/llop) on keybase.
  • I have a public key ASCUYdVdfFyj7nforRrtm6A2Y7jhhb3tmjNrU6c2uaV2hAo

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am llopv on github.
  • I am llop (https://keybase.io/llop) on keybase.
  • I have a public key ASDd3KxmuvZamfaQ3807a_ILwzb4fLi1wtcWmFqYX_vDhAo

To claim this, I am signing this object: