function encode(){ var str = $('#content').val(); str = window.btoa(pako.gzip(str, {to: "string"})) $('#ciphertext').text(str);}function decode(){ var encodedData = $('#content').val(); var decodedData = window.atob(encodedData); var charData = decodedData.split('').map(function(x){return x.charCodeAt(0);}); var binData = new Uint8Array(charData); var data = pako.inflate(binData); decodedData = String.fromCharCode.apply(null, new Uint16Array(data)); $('#ciphertext').text(decodedData);}