You can reach the functionality regarding UU Encode respectively UU Decode using the menu Individual Procedures \ Tools \ Codes \ UU Encode/Decode.
UUencode is a coding procedure for representing binary data in a printable char set. The name was derived from "Unix to Unix encoding", because it was originally intended for unix systems only.
UUencode is no encryption: No key is used, and every time the plaintext is encoded to UUcode it leads to the same output.
UUencode became popular, because it was one of the first possibilities to send emails with arbitrary data, in which at that time only ASCII characters were allowed. The Usenet (an online messaging platform) was another place were UUencode was often used. UUencode is based on the ASCII char set and therefore is only useful for the data exchange between ASCII platforms. The UUencoding is mostly replaced by Base64 encoding, which only uses characters which exist in both the ASCII and the EBCDIC char set.
An UUencoded file basically consists of 3 parts:
The first line always starts with a "begin". After a space you get the file permissions in form of three digits as used under unix, and after an additional space the file name.
Example:
begin 644 cryptool.exe |
In the body, the real encoding takes place.
Like in Base64 encoding, a 24-bit buffer is always divided into 4 blocks with 6-bit each.
Each 6-bit value is increased by decimal 32, and then the corresponding ASCII character is used. By adding 32, the value gets out of the area of the control characters (ASCII 0 to ASCII 31).
Due to problems that arise by sending mails with the space character (= ASCII 32), the character "`" (= ASCII 96 ) is being used.
The first byte of a line is used for the length byte, it counts the number of input characters which are encoded in this line, here too, increased by 32.
Therefore the number of input characters per line is limited to the highest number which is possible with 6-bit: 63:
A common value for the length byte is the ASCII character "M" (= ASCII 77). So there are 77 - 32 = 45 input characters – which result in 60 coded characters – written in one line.
Every line could have a different length. But usually all lines, except the last line, have the same length.
Encoding expample: The word "Cat"
ASCII input character | C |
a |
t |
|||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ASCII input character, decimal | 67 | 97 | 116 | |||||||||||||||||||||
ASCII, binary | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 |
New decimal value | 16 | 54 | 5 | 52 | ||||||||||||||||||||
+32 | 48 | 86 | 37 | 84 | ||||||||||||||||||||
UUencoded character | 0 |
V |
% |
T |
#0V%T |
In case the number of input characters is no multiple of three, the end is filled up with binary zeros until the next full 6-bit block.
Possible cases:1 input character = 8 bit = 1 full 6-bit block + 2 bit. These are filled up with 4 binary zeros for getting two full 6-bit blocks = 2 coded characters.
Example:ASCII input character | C |
|
||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ASCII input character, decimal | 67 | |||||||||||||||
ASCII, binary | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | ||||
New decimal value | 16 | 48 | ||||||||||||||
+32 | 48 | 80 | ||||||||||||||
UUencoded character | 0 |
P |
2 input characters = 16 bit = 2 full 6-bit blocks + 4 bit. These are filled up with 2 binary zeros for getting three full 6-bit blocks = 3 coded characters.
Beispiel:ASCII input character | C |
a |
|
|||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ASCII input character, decimal | 67 | 97 | ||||||||||||||||||||||
ASCII, binary | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | ||||||
New decimal value | 16 | 54 | 4 | |||||||||||||||||||||
+32 | 48 | 86 | 36 | |||||||||||||||||||||
UUencoded character | 0 |
V |
$ |
The termination is accomplished with an ASCII character of value 96 – followed by a newline, the word "end" and a second newline.
Example:
` end |
Example of a complete UUencoded file:
begin 644 examplefile.txt #0V%T ` end |
Unlike the Base64 encoding there aren't any fixed standards (RFCs) in the field of UUencoding.
Comparison of Base64 and UU encode.
Sources