Unix to Unix (UU) Encoding
Site Map Feedback

Download:

Up ASCIIHex Base32 Base64 MIME QuotedPrintable URL UU
The code I present here encodes binary files to "Unix to Unix" (UU) formatted Text
and Decodes "Unix to Unix" (UU) formatted Text to the original binary file.
This encoding is used to convert binary files into text files so that they can be sent through e-mail systems.
The encoded data is larger than the original data.
Any one encoded line of text will not exceed 62 characters.
Base64 produces smaller encoded files than "Unix to Unix" (UU).
Usage:
  CUU::Encode("c:\\tJpg.uu","c:\\t.Jpg"  );
  CUU::Decode("c:\\t1.Jpg" ,"c:\\tJpg.uu");
(Note that WinZip extracts .uu files)

Unix-to-Unix(UU) encode/decode algorithm:
uuencoding takes 24 bit from input stream (3 bytes) and splits it into 32 bits (4 bytes) output.
Each output byte has the top 2 bits clear, and can be translated into a printable character.
The traditional way is to simply add $20 (space).
uudecoding simply subtracts $20, strips the top 2 bits from input, and puts things back together.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.