Encryption

Overview


Types





function getKey(str){
    let list = [];
    for(let c of str){
        list.push(c.charCodeAt(0))
    }
    return list;
}
					


The follo


const rawKey = window.crypto.getRandomValues(new Uint8Array(16));
let key = getKey('password');


const enc5 = new TextEncoder();
let iv   = new Uint8Array(key);
let enc  = new TextEncoder();
let message = 'hello world';
let data = enc.encode(message);
let encryptedData = await encrypt.encrypt(data, keys, iv);
let decryptedData = await encrypt.decrypt(encryptedData, keys, iv)
let enc2 = new TextDecoder("utf-8");
let text = enc2.decode(decryptedData);
					
Try it!


Contents