60536053</ head >
60546054
60556055< body >
6056+
60566057 < div >
60576058 < div >
60586059 < label for ="filePicker "> Choose or drag a (tar) file to encode:</ label >
60636064< p > Compression Level (1-9): < input type ="number " min ="1 " max ="9 " value ="9 "id ="complevel "> </ input > </ p >
60646065 < div >
60656066 < h1 > BWTC32Key-encoded version</ h1 >
6066- < textarea id ="base64textarea " placeholder ="Base32768 will appear here " cols ="50 " rows ="15 "> </ textarea > < br >
6067+ < form name ="BWTC32Key " action ="">
6068+ < textarea id ="base64textarea " name ="base32768textarea " placeholder ="Base32768 will appear here " cols ="50 " rows ="15 "> </ textarea > < br >
6069+ < button id ="copy " type ="button " onclick ="copyOutputToClipboard(); "> Copy the above string.</ button >
6070+ </ form >
60676071 < p > B3K filename:</ p >
60686072
60696073 < textarea id ="B3Kfilename "> myFile.B3K</ textarea >
@@ -6079,7 +6083,6 @@ <h3>Decoding:</h3>
60796083< textarea id ="filename "> output.bin</ textarea >
60806084< textarea id ="filetype "> application/octet-stream</ textarea > < br />
60816085 < a download ="output.bin " id ="downloadlink " style ="display: none "> Download decoded file</ a >
6082-
60836086 < script >
60846087 // tell the embed parent frame the height of the content
60856088 if ( window . parent && window . parent . parent ) {
@@ -6283,34 +6286,34 @@ <h3>Decoding:</h3>
62836286 if ( this . hashed ) {
62846287 this . hashed = false ;
62856288 blocks [ 0 ] = this . block ;
6286- blocks [ 16 ] = blocks [ 1 ] = blocks [ 2 ] = blocks [ 3 ] =
6289+ this . block = blocks [ 16 ] = blocks [ 1 ] = blocks [ 2 ] = blocks [ 3 ] =
62876290 blocks [ 4 ] = blocks [ 5 ] = blocks [ 6 ] = blocks [ 7 ] =
62886291 blocks [ 8 ] = blocks [ 9 ] = blocks [ 10 ] = blocks [ 11 ] =
62896292 blocks [ 12 ] = blocks [ 13 ] = blocks [ 14 ] = blocks [ 15 ] = 0 ;
62906293 }
62916294
62926295 if ( notString ) {
62936296 for ( i = this . start ; index < length && i < 64 ; ++ index ) {
6294- blocks [ i >> 2 ] |= message [ index ] << SHIFT [ i ++ & 3 ] ;
6297+ blocks [ i >>> 2 ] |= message [ index ] << SHIFT [ i ++ & 3 ] ;
62956298 }
62966299 } else {
62976300 for ( i = this . start ; index < length && i < 64 ; ++ index ) {
62986301 code = message . charCodeAt ( index ) ;
62996302 if ( code < 0x80 ) {
6300- blocks [ i >> 2 ] |= code << SHIFT [ i ++ & 3 ] ;
6303+ blocks [ i >>> 2 ] |= code << SHIFT [ i ++ & 3 ] ;
63016304 } else if ( code < 0x800 ) {
6302- blocks [ i >> 2 ] |= ( 0xc0 | ( code >> 6 ) ) << SHIFT [ i ++ & 3 ] ;
6303- blocks [ i >> 2 ] |= ( 0x80 | ( code & 0x3f ) ) << SHIFT [ i ++ & 3 ] ;
6305+ blocks [ i >>> 2 ] |= ( 0xc0 | ( code > >> 6 ) ) << SHIFT [ i ++ & 3 ] ;
6306+ blocks [ i >>> 2 ] |= ( 0x80 | ( code & 0x3f ) ) << SHIFT [ i ++ & 3 ] ;
63046307 } else if ( code < 0xd800 || code >= 0xe000 ) {
6305- blocks [ i >> 2 ] |= ( 0xe0 | ( code >> 12 ) ) << SHIFT [ i ++ & 3 ] ;
6306- blocks [ i >> 2 ] |= ( 0x80 | ( ( code >> 6 ) & 0x3f ) ) << SHIFT [ i ++ & 3 ] ;
6307- blocks [ i >> 2 ] |= ( 0x80 | ( code & 0x3f ) ) << SHIFT [ i ++ & 3 ] ;
6308+ blocks [ i >>> 2 ] |= ( 0xe0 | ( code > >> 12 ) ) << SHIFT [ i ++ & 3 ] ;
6309+ blocks [ i >>> 2 ] |= ( 0x80 | ( ( code > >> 6 ) & 0x3f ) ) << SHIFT [ i ++ & 3 ] ;
6310+ blocks [ i >>> 2 ] |= ( 0x80 | ( code & 0x3f ) ) << SHIFT [ i ++ & 3 ] ;
63086311 } else {
63096312 code = 0x10000 + ( ( ( code & 0x3ff ) << 10 ) | ( message . charCodeAt ( ++ index ) & 0x3ff ) ) ;
6310- blocks [ i >> 2 ] |= ( 0xf0 | ( code >> 18 ) ) << SHIFT [ i ++ & 3 ] ;
6311- blocks [ i >> 2 ] |= ( 0x80 | ( ( code >> 12 ) & 0x3f ) ) << SHIFT [ i ++ & 3 ] ;
6312- blocks [ i >> 2 ] |= ( 0x80 | ( ( code >> 6 ) & 0x3f ) ) << SHIFT [ i ++ & 3 ] ;
6313- blocks [ i >> 2 ] |= ( 0x80 | ( code & 0x3f ) ) << SHIFT [ i ++ & 3 ] ;
6313+ blocks [ i >>> 2 ] |= ( 0xf0 | ( code > >> 18 ) ) << SHIFT [ i ++ & 3 ] ;
6314+ blocks [ i >>> 2 ] |= ( 0x80 | ( ( code > >> 12 ) & 0x3f ) ) << SHIFT [ i ++ & 3 ] ;
6315+ blocks [ i >>> 2 ] |= ( 0x80 | ( ( code > >> 6 ) & 0x3f ) ) << SHIFT [ i ++ & 3 ] ;
6316+ blocks [ i >>> 2 ] |= ( 0x80 | ( code & 0x3f ) ) << SHIFT [ i ++ & 3 ] ;
63146317 }
63156318 }
63166319 }
@@ -6340,7 +6343,7 @@ <h3>Decoding:</h3>
63406343 this . finalized = true ;
63416344 var blocks = this . blocks , i = this . lastByteIndex ;
63426345 blocks [ 16 ] = this . block ;
6343- blocks [ i >> 2 ] |= EXTRA [ i & 3 ] ;
6346+ blocks [ i >>> 2 ] |= EXTRA [ i & 3 ] ;
63446347 this . block = blocks [ 16 ] ;
63456348 if ( i >= 56 ) {
63466349 if ( ! this . hashed ) {
@@ -6441,39 +6444,39 @@ <h3>Decoding:</h3>
64416444 var h0 = this . h0 , h1 = this . h1 , h2 = this . h2 , h3 = this . h3 , h4 = this . h4 , h5 = this . h5 ,
64426445 h6 = this . h6 , h7 = this . h7 ;
64436446
6444- var hex = HEX_CHARS [ ( h0 >> 28 ) & 0x0F ] + HEX_CHARS [ ( h0 >> 24 ) & 0x0F ] +
6445- HEX_CHARS [ ( h0 >> 20 ) & 0x0F ] + HEX_CHARS [ ( h0 >> 16 ) & 0x0F ] +
6446- HEX_CHARS [ ( h0 >> 12 ) & 0x0F ] + HEX_CHARS [ ( h0 >> 8 ) & 0x0F ] +
6447- HEX_CHARS [ ( h0 >> 4 ) & 0x0F ] + HEX_CHARS [ h0 & 0x0F ] +
6448- HEX_CHARS [ ( h1 >> 28 ) & 0x0F ] + HEX_CHARS [ ( h1 >> 24 ) & 0x0F ] +
6449- HEX_CHARS [ ( h1 >> 20 ) & 0x0F ] + HEX_CHARS [ ( h1 >> 16 ) & 0x0F ] +
6450- HEX_CHARS [ ( h1 >> 12 ) & 0x0F ] + HEX_CHARS [ ( h1 >> 8 ) & 0x0F ] +
6451- HEX_CHARS [ ( h1 >> 4 ) & 0x0F ] + HEX_CHARS [ h1 & 0x0F ] +
6452- HEX_CHARS [ ( h2 >> 28 ) & 0x0F ] + HEX_CHARS [ ( h2 >> 24 ) & 0x0F ] +
6453- HEX_CHARS [ ( h2 >> 20 ) & 0x0F ] + HEX_CHARS [ ( h2 >> 16 ) & 0x0F ] +
6454- HEX_CHARS [ ( h2 >> 12 ) & 0x0F ] + HEX_CHARS [ ( h2 >> 8 ) & 0x0F ] +
6455- HEX_CHARS [ ( h2 >> 4 ) & 0x0F ] + HEX_CHARS [ h2 & 0x0F ] +
6456- HEX_CHARS [ ( h3 >> 28 ) & 0x0F ] + HEX_CHARS [ ( h3 >> 24 ) & 0x0F ] +
6457- HEX_CHARS [ ( h3 >> 20 ) & 0x0F ] + HEX_CHARS [ ( h3 >> 16 ) & 0x0F ] +
6458- HEX_CHARS [ ( h3 >> 12 ) & 0x0F ] + HEX_CHARS [ ( h3 >> 8 ) & 0x0F ] +
6459- HEX_CHARS [ ( h3 >> 4 ) & 0x0F ] + HEX_CHARS [ h3 & 0x0F ] +
6460- HEX_CHARS [ ( h4 >> 28 ) & 0x0F ] + HEX_CHARS [ ( h4 >> 24 ) & 0x0F ] +
6461- HEX_CHARS [ ( h4 >> 20 ) & 0x0F ] + HEX_CHARS [ ( h4 >> 16 ) & 0x0F ] +
6462- HEX_CHARS [ ( h4 >> 12 ) & 0x0F ] + HEX_CHARS [ ( h4 >> 8 ) & 0x0F ] +
6463- HEX_CHARS [ ( h4 >> 4 ) & 0x0F ] + HEX_CHARS [ h4 & 0x0F ] +
6464- HEX_CHARS [ ( h5 >> 28 ) & 0x0F ] + HEX_CHARS [ ( h5 >> 24 ) & 0x0F ] +
6465- HEX_CHARS [ ( h5 >> 20 ) & 0x0F ] + HEX_CHARS [ ( h5 >> 16 ) & 0x0F ] +
6466- HEX_CHARS [ ( h5 >> 12 ) & 0x0F ] + HEX_CHARS [ ( h5 >> 8 ) & 0x0F ] +
6467- HEX_CHARS [ ( h5 >> 4 ) & 0x0F ] + HEX_CHARS [ h5 & 0x0F ] +
6468- HEX_CHARS [ ( h6 >> 28 ) & 0x0F ] + HEX_CHARS [ ( h6 >> 24 ) & 0x0F ] +
6469- HEX_CHARS [ ( h6 >> 20 ) & 0x0F ] + HEX_CHARS [ ( h6 >> 16 ) & 0x0F ] +
6470- HEX_CHARS [ ( h6 >> 12 ) & 0x0F ] + HEX_CHARS [ ( h6 >> 8 ) & 0x0F ] +
6471- HEX_CHARS [ ( h6 >> 4 ) & 0x0F ] + HEX_CHARS [ h6 & 0x0F ] ;
6447+ var hex = HEX_CHARS [ ( h0 >>> 28 ) & 0x0F ] + HEX_CHARS [ ( h0 > >> 24 ) & 0x0F ] +
6448+ HEX_CHARS [ ( h0 >>> 20 ) & 0x0F ] + HEX_CHARS [ ( h0 > >> 16 ) & 0x0F ] +
6449+ HEX_CHARS [ ( h0 >>> 12 ) & 0x0F ] + HEX_CHARS [ ( h0 > >> 8 ) & 0x0F ] +
6450+ HEX_CHARS [ ( h0 >>> 4 ) & 0x0F ] + HEX_CHARS [ h0 & 0x0F ] +
6451+ HEX_CHARS [ ( h1 >>> 28 ) & 0x0F ] + HEX_CHARS [ ( h1 > >> 24 ) & 0x0F ] +
6452+ HEX_CHARS [ ( h1 >>> 20 ) & 0x0F ] + HEX_CHARS [ ( h1 > >> 16 ) & 0x0F ] +
6453+ HEX_CHARS [ ( h1 >>> 12 ) & 0x0F ] + HEX_CHARS [ ( h1 > >> 8 ) & 0x0F ] +
6454+ HEX_CHARS [ ( h1 >>> 4 ) & 0x0F ] + HEX_CHARS [ h1 & 0x0F ] +
6455+ HEX_CHARS [ ( h2 >>> 28 ) & 0x0F ] + HEX_CHARS [ ( h2 > >> 24 ) & 0x0F ] +
6456+ HEX_CHARS [ ( h2 >>> 20 ) & 0x0F ] + HEX_CHARS [ ( h2 > >> 16 ) & 0x0F ] +
6457+ HEX_CHARS [ ( h2 >>> 12 ) & 0x0F ] + HEX_CHARS [ ( h2 > >> 8 ) & 0x0F ] +
6458+ HEX_CHARS [ ( h2 >>> 4 ) & 0x0F ] + HEX_CHARS [ h2 & 0x0F ] +
6459+ HEX_CHARS [ ( h3 >>> 28 ) & 0x0F ] + HEX_CHARS [ ( h3 > >> 24 ) & 0x0F ] +
6460+ HEX_CHARS [ ( h3 >>> 20 ) & 0x0F ] + HEX_CHARS [ ( h3 > >> 16 ) & 0x0F ] +
6461+ HEX_CHARS [ ( h3 >>> 12 ) & 0x0F ] + HEX_CHARS [ ( h3 > >> 8 ) & 0x0F ] +
6462+ HEX_CHARS [ ( h3 >>> 4 ) & 0x0F ] + HEX_CHARS [ h3 & 0x0F ] +
6463+ HEX_CHARS [ ( h4 >>> 28 ) & 0x0F ] + HEX_CHARS [ ( h4 > >> 24 ) & 0x0F ] +
6464+ HEX_CHARS [ ( h4 >>> 20 ) & 0x0F ] + HEX_CHARS [ ( h4 > >> 16 ) & 0x0F ] +
6465+ HEX_CHARS [ ( h4 >>> 12 ) & 0x0F ] + HEX_CHARS [ ( h4 > >> 8 ) & 0x0F ] +
6466+ HEX_CHARS [ ( h4 >>> 4 ) & 0x0F ] + HEX_CHARS [ h4 & 0x0F ] +
6467+ HEX_CHARS [ ( h5 >>> 28 ) & 0x0F ] + HEX_CHARS [ ( h5 > >> 24 ) & 0x0F ] +
6468+ HEX_CHARS [ ( h5 >>> 20 ) & 0x0F ] + HEX_CHARS [ ( h5 > >> 16 ) & 0x0F ] +
6469+ HEX_CHARS [ ( h5 >>> 12 ) & 0x0F ] + HEX_CHARS [ ( h5 > >> 8 ) & 0x0F ] +
6470+ HEX_CHARS [ ( h5 >>> 4 ) & 0x0F ] + HEX_CHARS [ h5 & 0x0F ] +
6471+ HEX_CHARS [ ( h6 >>> 28 ) & 0x0F ] + HEX_CHARS [ ( h6 > >> 24 ) & 0x0F ] +
6472+ HEX_CHARS [ ( h6 >>> 20 ) & 0x0F ] + HEX_CHARS [ ( h6 > >> 16 ) & 0x0F ] +
6473+ HEX_CHARS [ ( h6 >>> 12 ) & 0x0F ] + HEX_CHARS [ ( h6 > >> 8 ) & 0x0F ] +
6474+ HEX_CHARS [ ( h6 >>> 4 ) & 0x0F ] + HEX_CHARS [ h6 & 0x0F ] ;
64726475 if ( ! this . is224 ) {
6473- hex += HEX_CHARS [ ( h7 >> 28 ) & 0x0F ] + HEX_CHARS [ ( h7 >> 24 ) & 0x0F ] +
6474- HEX_CHARS [ ( h7 >> 20 ) & 0x0F ] + HEX_CHARS [ ( h7 >> 16 ) & 0x0F ] +
6475- HEX_CHARS [ ( h7 >> 12 ) & 0x0F ] + HEX_CHARS [ ( h7 >> 8 ) & 0x0F ] +
6476- HEX_CHARS [ ( h7 >> 4 ) & 0x0F ] + HEX_CHARS [ h7 & 0x0F ] ;
6476+ hex += HEX_CHARS [ ( h7 >>> 28 ) & 0x0F ] + HEX_CHARS [ ( h7 > >> 24 ) & 0x0F ] +
6477+ HEX_CHARS [ ( h7 >>> 20 ) & 0x0F ] + HEX_CHARS [ ( h7 > >> 16 ) & 0x0F ] +
6478+ HEX_CHARS [ ( h7 >>> 12 ) & 0x0F ] + HEX_CHARS [ ( h7 > >> 8 ) & 0x0F ] +
6479+ HEX_CHARS [ ( h7 >>> 4 ) & 0x0F ] + HEX_CHARS [ h7 & 0x0F ] ;
64776480 }
64786481 return hex ;
64796482 } ;
@@ -6487,16 +6490,16 @@ <h3>Decoding:</h3>
64876490 h6 = this . h6 , h7 = this . h7 ;
64886491
64896492 var arr = [
6490- ( h0 >> 24 ) & 0xFF , ( h0 >> 16 ) & 0xFF , ( h0 >> 8 ) & 0xFF , h0 & 0xFF ,
6491- ( h1 >> 24 ) & 0xFF , ( h1 >> 16 ) & 0xFF , ( h1 >> 8 ) & 0xFF , h1 & 0xFF ,
6492- ( h2 >> 24 ) & 0xFF , ( h2 >> 16 ) & 0xFF , ( h2 >> 8 ) & 0xFF , h2 & 0xFF ,
6493- ( h3 >> 24 ) & 0xFF , ( h3 >> 16 ) & 0xFF , ( h3 >> 8 ) & 0xFF , h3 & 0xFF ,
6494- ( h4 >> 24 ) & 0xFF , ( h4 >> 16 ) & 0xFF , ( h4 >> 8 ) & 0xFF , h4 & 0xFF ,
6495- ( h5 >> 24 ) & 0xFF , ( h5 >> 16 ) & 0xFF , ( h5 >> 8 ) & 0xFF , h5 & 0xFF ,
6496- ( h6 >> 24 ) & 0xFF , ( h6 >> 16 ) & 0xFF , ( h6 >> 8 ) & 0xFF , h6 & 0xFF
6493+ ( h0 >>> 24 ) & 0xFF , ( h0 >>> 16 ) & 0xFF , ( h0 > >> 8 ) & 0xFF , h0 & 0xFF ,
6494+ ( h1 >>> 24 ) & 0xFF , ( h1 >>> 16 ) & 0xFF , ( h1 > >> 8 ) & 0xFF , h1 & 0xFF ,
6495+ ( h2 >>> 24 ) & 0xFF , ( h2 >>> 16 ) & 0xFF , ( h2 > >> 8 ) & 0xFF , h2 & 0xFF ,
6496+ ( h3 >>> 24 ) & 0xFF , ( h3 >>> 16 ) & 0xFF , ( h3 > >> 8 ) & 0xFF , h3 & 0xFF ,
6497+ ( h4 >>> 24 ) & 0xFF , ( h4 >>> 16 ) & 0xFF , ( h4 > >> 8 ) & 0xFF , h4 & 0xFF ,
6498+ ( h5 >>> 24 ) & 0xFF , ( h5 >>> 16 ) & 0xFF , ( h5 > >> 8 ) & 0xFF , h5 & 0xFF ,
6499+ ( h6 >>> 24 ) & 0xFF , ( h6 >>> 16 ) & 0xFF , ( h6 > >> 8 ) & 0xFF , h6 & 0xFF
64976500 ] ;
64986501 if ( ! this . is224 ) {
6499- arr . push ( ( h7 >> 24 ) & 0xFF , ( h7 >> 16 ) & 0xFF , ( h7 >> 8 ) & 0xFF , h7 & 0xFF ) ;
6502+ arr . push ( ( h7 >>> 24 ) & 0xFF , ( h7 >>> 16 ) & 0xFF , ( h7 > >> 8 ) & 0xFF , h7 & 0xFF ) ;
65006503 }
65016504 return arr ;
65026505 } ;
@@ -6530,17 +6533,17 @@ <h3>Decoding:</h3>
65306533 if ( code < 0x80 ) {
65316534 bytes [ index ++ ] = code ;
65326535 } else if ( code < 0x800 ) {
6533- bytes [ index ++ ] = ( 0xc0 | ( code >> 6 ) ) ;
6536+ bytes [ index ++ ] = ( 0xc0 | ( code >>> 6 ) ) ;
65346537 bytes [ index ++ ] = ( 0x80 | ( code & 0x3f ) ) ;
65356538 } else if ( code < 0xd800 || code >= 0xe000 ) {
6536- bytes [ index ++ ] = ( 0xe0 | ( code >> 12 ) ) ;
6537- bytes [ index ++ ] = ( 0x80 | ( ( code >> 6 ) & 0x3f ) ) ;
6539+ bytes [ index ++ ] = ( 0xe0 | ( code >>> 12 ) ) ;
6540+ bytes [ index ++ ] = ( 0x80 | ( ( code >>> 6 ) & 0x3f ) ) ;
65386541 bytes [ index ++ ] = ( 0x80 | ( code & 0x3f ) ) ;
65396542 } else {
65406543 code = 0x10000 + ( ( ( code & 0x3ff ) << 10 ) | ( key . charCodeAt ( ++ i ) & 0x3ff ) ) ;
6541- bytes [ index ++ ] = ( 0xf0 | ( code >> 18 ) ) ;
6542- bytes [ index ++ ] = ( 0x80 | ( ( code >> 12 ) & 0x3f ) ) ;
6543- bytes [ index ++ ] = ( 0x80 | ( ( code >> 6 ) & 0x3f ) ) ;
6544+ bytes [ index ++ ] = ( 0xf0 | ( code >>> 18 ) ) ;
6545+ bytes [ index ++ ] = ( 0x80 | ( ( code >>> 12 ) & 0x3f ) ) ;
6546+ bytes [ index ++ ] = ( 0x80 | ( ( code >>> 6 ) & 0x3f ) ) ;
65446547 bytes [ index ++ ] = ( 0x80 | ( code & 0x3f ) ) ;
65456548 }
65466549 }
@@ -9656,6 +9659,8 @@ <h3>Decoding:</h3>
96569659 return a ;
96579660}
96589661
9662+
9663+
96599664( function ( ) {
96609665 var textFile = null ,
96619666 makeTextFile = function ( text ) {
@@ -9701,6 +9706,32 @@ <h3>Decoding:</h3>
97019706
97029707} ) ;
97039708
9709+ function copyOutputToClipboard ( ) {
9710+ var targetBox = document . BWTC32Key . base32768textarea ;
9711+ // https://stackoverflow.com/questions/51158061/copy-data-to-clipboard-without-selecting-any-text
9712+ // - restoring original selection doesn't seem to work
9713+ var origSelectionStart , origSelectionEnd ;
9714+ origSelectionStart = targetBox . selectionStart ;
9715+ origSelectionEnd = targetBox . selectionEnd ;
9716+ // select the content
9717+ var currentFocus = document . activeElement ;
9718+ targetBox . focus ( ) ;
9719+ targetBox . setSelectionRange ( 0 , targetBox . value . length ) ;
9720+ var succeed ;
9721+ try {
9722+ succeed = document . execCommand ( "copy" ) ;
9723+ } catch ( e ) {
9724+ succeed = false ;
9725+ }
9726+ // restore original focus
9727+ if ( currentFocus && typeof currentFocus . focus === "function" ) {
9728+ currentFocus . focus ( ) ;
9729+ }
9730+ // restore prior selection
9731+ targetBox . setSelectionRange ( origSelectionStart , origSelectionEnd ) ;
9732+ } ;
9733+
9734+
97049735//]]>
97059736
97069737
0 commit comments