|
6048 | 6048 |
|
6049 | 6049 | <title>BWTC32Key encode/decode a file</title> |
6050 | 6050 |
|
6051 | | -<script> |
| 6051 | + |
| 6052 | + |
| 6053 | +</head> |
| 6054 | + |
| 6055 | +<body> |
| 6056 | + <div> |
| 6057 | + <div> |
| 6058 | + <label for="filePicker">Choose or drag a (tar) file to encode:</label> |
| 6059 | + <br> |
| 6060 | + </div> |
| 6061 | + <input id="filePicker" type="file"><textarea id="ascii85password" name="ascii85password" oninput="">Enter a password here before uploading.</textarea> |
| 6062 | + <br> |
| 6063 | +<p>Compression Level (1-9): <input type="number" min="1" max="9" value="9"id="complevel"></input></p> |
| 6064 | + <div> |
| 6065 | + <h1>BWTC32Key-encoded version</h1> |
| 6066 | + <textarea id="base64textarea" placeholder="Base32768 will appear here" cols="50" rows="15"></textarea><br> |
| 6067 | + <p>B3K filename:</p> |
| 6068 | + |
| 6069 | + <textarea id="B3Kfilename">myFile.B3K</textarea> |
| 6070 | + <button id="download">Download .B3K of above textbox</button> |
| 6071 | + </div> |
| 6072 | +</div> |
| 6073 | +<h3>Decoding:</h3> |
| 6074 | +<p>Upload a B3K file here:</p> |
| 6075 | +<input type="file" id="fileToRead"> |
| 6076 | +<br> |
| 6077 | +<textarea id="textbox" cols="25" >Type BWTC32Key-encoded text here to decode</textarea><button id="create">Click to decode file</button><br /> |
| 6078 | +<p>Output's Filename & MIMEtype</p> |
| 6079 | +<textarea id="filename">output.bin</textarea> |
| 6080 | +<textarea id="filetype">application/octet-stream</textarea><br /> |
| 6081 | + <a download="output.bin" id="downloadlink" style="display: none">Download decoded file</a> |
6052 | 6082 |
|
| 6083 | + <script> |
| 6084 | + // tell the embed parent frame the height of the content |
| 6085 | + if (window.parent && window.parent.parent){ |
| 6086 | + window.parent.parent.postMessage(["resultsFrame", { |
| 6087 | + height: document.body.getBoundingClientRect().height, |
| 6088 | + slug: "None" |
| 6089 | + }], "*") |
| 6090 | + } |
| 6091 | + |
| 6092 | +</script> |
| 6093 | + |
| 6094 | +<script> |
| 6095 | + var compLevel = document.getElementById("complevel").value; |
6053 | 6096 | /** |
6054 | 6097 | * [js-sha256]{@link https://github.com/emn178/js-sha256} |
6055 | 6098 | * |
|
9074 | 9117 | var encoder = new RangeCoder(output); |
9075 | 9118 | encoder.encodeStart(finalByte, 1); |
9076 | 9119 |
|
9077 | | - var blockSize = 9; |
| 9120 | + var blockSize = document.getElementById("complevel").value; |
9078 | 9121 | if (typeof(props) === 'number' && props >= 1 && props <= 9) { |
9079 | 9122 | blockSize = props; |
9080 | 9123 | } |
|
9482 | 9525 | var suf = "\u4d01"; |
9483 | 9526 | var re = new RegExp(endianMark+pre+"(.+?)"+suf); |
9484 | 9527 | var re2 = new RegExp(pre+"(.+?)"+suf); |
9485 | | - |
9486 | | -var compLevel = document.getElementById("complevel").value; |
| 9528 | +var compLevel = document.getElementById("complevel").value; |
9487 | 9529 |
|
9488 | 9530 | var handleFileSelect = function(evt) { |
9489 | 9531 | var files = evt.target.files; |
|
9498 | 9540 | array = new Uint8Array(arrayBuffer), |
9499 | 9541 | //var binaryString = readerEvt.target.result; |
9500 | 9542 |
|
| 9543 | +compLevel = document.getElementById("complevel").value, |
9501 | 9544 | document.getElementById("base64textarea").value = endianMark+pre+base32768enc(new aesjs.ModeOfOperation.ctr(sha256.array(document.getElementById("ascii85password").value), new aesjs.Counter(1)).encrypt(BWTC.compressFile(array, undefined, compLevel)))+suf; |
9502 | 9545 | }; |
9503 | 9546 |
|
|
9663 | 9706 |
|
9664 | 9707 | </script> |
9665 | 9708 |
|
9666 | | - |
9667 | | -</head> |
9668 | | - |
9669 | | -<body> |
9670 | | - <div> |
9671 | | - <div> |
9672 | | - <label for="filePicker">Choose or drag a (tar) file to encode:</label> |
9673 | | - <br> |
9674 | | - </div> |
9675 | | - <input id="filePicker" type="file"><textarea id="ascii85password" name="ascii85password" oninput="">Enter a password here before uploading.</textarea> |
9676 | | - <br> |
9677 | | -<p>Compression Level (1-9): <input type="text" cols="1" placeholder="9" id="complevel"></input></p> |
9678 | | - <div> |
9679 | | - <h1>BWTC32Key-encoded version</h1> |
9680 | | - <textarea id="base64textarea" placeholder="Base32768 will appear here" cols="50" rows="15"></textarea><br> |
9681 | | - <p>B3K filename:</p> |
9682 | | - |
9683 | | - <textarea id="B3Kfilename">myFile.B3K</textarea> |
9684 | | - <button id="download">Download .B3K of above textbox</button> |
9685 | | - </div> |
9686 | | -</div> |
9687 | | -<h3>Decoding:</h3> |
9688 | | -<p>Upload a B3K file here:</p> |
9689 | | -<input type="file" id="fileToRead"> |
9690 | | -<br> |
9691 | | -<textarea id="textbox" cols="25" >Type BWTC32Key-encoded text here to decode</textarea><button id="create">Click to decode file</button><br /> |
9692 | | -<p>Output's Filename & MIMEtype</p> |
9693 | | -<textarea id="filename">output.bin</textarea> |
9694 | | -<textarea id="filetype">application/octet-stream</textarea><br /> |
9695 | | - <a download="output.bin" id="downloadlink" style="display: none">Download decoded file</a> |
9696 | | - |
9697 | | - <script> |
9698 | | - // tell the embed parent frame the height of the content |
9699 | | - if (window.parent && window.parent.parent){ |
9700 | | - window.parent.parent.postMessage(["resultsFrame", { |
9701 | | - height: document.body.getBoundingClientRect().height, |
9702 | | - slug: "None" |
9703 | | - }], "*") |
9704 | | - } |
9705 | | - |
9706 | | -</script> |
9707 | | - |
9708 | | - |
9709 | 9709 |
|
9710 | 9710 |
|
9711 | 9711 |
|
|
0 commit comments