UUEncode Decoder - UUDecode
Answers to Questions
How to encrypt using UUEncode cipher?
Uuencode encoding is able to encode any binary string using 65 ASCII characters (from 32 to 96):
Example: space ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ `
A message encrypted by uuencode begins with begin (mode) (name) where (mode) is the value of the access rights to the Unix file and (name) is the name of the file that will be created at decoding.
Example: begin 664 dcode.txt will create a file named dcode.txt with access rights 664.
A message encoded by uuencode ends with a line containing only end.
The encoding consists of reading the binary data (stream or file) divided by a group of 3 bytes (ie 24 bits, possibly supplemented by bits at 0 at the end if necessary). These 24 bits are themselves divided into 4 groups of 6 bits. And each 6-bit group (having a binary value between 000000 and 111111) is converted to decimal (a number between 0 and 63 in base 10).
The encoding table is similar to the ASCII table but shifted by 32 and limited to 64 characters.
The encoding program also adds, at the very beginning of each line of text produced, the character count / bytes count encoded in this line; This count (from 1 to 45) is itself encoded (by adding 32 to itself) before being converted to an ASCII character. The maximum allowed size of the lines produced is therefore 61 characters (1 character for the initial length plus 60 characters encoding 45 bytes).
Example: Encoding dCode is translated %9$-O9&4`
How to decrypt UUEncode cipher?
Decryption by UUEncode (uudecode) applies by lines.
Example: A message have been uuencoded %9$-O9&4`
The first character of each line corresponds to the number of characters in the line.
Example: % is the 5th character of the UUEncode alphabet (0-index), the plain message will contain 5 bytes.
The other characters must be treated in groups of 4.
Example: The first group of 4 characters is 9$-O
Write the position of each character in the alphabet and convert this position to binary (6 bits) to obtain 24 bits.
Example: 9 is at position 25 or 011001 in 6-bit binary, $ is at position 4 either 000100, etc.
Example: 9$-O therefore corresponds to these 24 bits: 011001 000100 001101 101111
The 24 bits are then divided into 3 bytes (of 8 bits). These 3 bytes are those of the original data.
Example: 011001 000100 001101 101111 becomes 01100100 01000011 01101111 which are the ASCII values of d, C and o, respectively.
Example: Finally, the encrypted message '%9$-O9&4` corresponds to the plain message dCode.
How to recognize UUEncode ciphertext?
The message should normally start with begin and end with end (but this is not mandatory).
If it starts with begin, it is followed by a triplet of octal digits, usually 644, 755 or 777
The message consists of up to 65 distinct characters.
What are the variants of the UUEncode cipher?
Technically it is possible to use another alphabet but this is no longer really UUEncode. There are other similar techniques for encoding, the best known is Base64, complementary with a MIME type for file sending over Internet.