wok-next view zerobin/stuff/zerobin.u @ rev 13069
Up: tiff to 4.0.2.
author | Christopher Rogers <slaxemulator@gmail.com> |
---|---|
date | Mon Jun 25 07:39:28 2012 +0000 (2012-06-25) |
parents | 1edf8ba1ba4e |
children | a6697022a666 |
line source
1 --- lib/zerobin.js
2 +++ lib/zerobin.js
3 @@ -180,7 +180,12 @@
4 {
5 if ($('textarea#message').val().length==0) return; // Do not send if no data.
6 showStatus('Sending paste...',spin=true);
7 - var randomkey = sjcl.codec.base64.fromBits(sjcl.random.randomWords(8,0),0);
8 + var randomkey = (window.location.hash.length > 2) ?
9 + // force key
10 + window.location.hash.substring(1) :
11 + // Generate a random 256 bits key, encoded in base64:
12 + sjcl.codec.base64.fromBits(sjcl.random.randomWords(8,0),0);
13 + if (randomkey.charAt(randomkey.length-1)!=='=') randomkey+='='; // Add trailing = if missing.
14 var cipherdata = zeroCipher(randomkey,$('textarea#message').val());
15 var data_to_send = { data:cipherdata,
16 expire:$('select#pasteExpiration').val(),