Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Uuencoding
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Formatting mechanism == The mechanism of <code>uuencoding</code> repeats the following for every 3 bytes, encoding them into 4 printable characters, each character representing a [[radix-64]] [[numerical digit]]: # Start with 3 [[bytes]] from the source, 24 [[bit]]s in total. # Split into 4 6-bit groupings, each representing a value in the range 0 to 63: bits (00-05), (06-11), (12-17) and (18-23). # Add 32 to each of the values. With the addition of 32 this means that the possible results can be between 32 (" " space) and 95 ("_" [[underline]]). 96 ("`" [[grave accent]]) as the "special character" is a logical extension of this range. Despite space character being documented as the encoding for value of 0, implementations, such as GNU sharutils,<ref>{{Cite web |title=uuencode.c source |url=https://fossies.org/dox/sharutils-4.15.2/uuencode_8c_source.html#l00085 |access-date=2021-06-05 |website=fossies.org |language=en-US}}</ref> actually use the grave accent character to encode zeros in the body of the file as well, never using space. # Output the ASCII equivalent of these numbers. If the source length is not divisible by 3, then the last 4-byte section will contain padding bytes to make it cleanly divisible. These bytes are subtracted from the line's <code><length character></code> so that the decoder does not append unwanted characters to the file. <code>uudecoding</code> is reverse of the above, subtract 32 from each character's ASCII code ([[modulo]] 64 to account for the grave accent usage) to get a 6-bit value, concatenate 4 6-bit groups to get 24 bits, then output 3 bytes. The encoding process is demonstrated by this table, which shows the derivation of the above encoding for "Cat". {| class="wikitable" | style="border-right: 2px solid black" | Original characters ! colspan=8 style="border-right: 2px solid green" | <code>C</code> ! colspan=8 style="border-right: 2px solid green" | <code>a</code> ! colspan=8 style="border-right: 2px solid black" | <code>t</code> |- | style="border-right: 2px solid black" | Original ASCII, decimal ! colspan=8 style="border-right: 2px solid green" | 67 ! colspan=8 style="border-right: 2px solid green" | 97 ! colspan=8 style="border-right: 2px solid black" | 116 |- | style="border-right: 2px solid black" | ASCII, binary | 0 | 1 | 0 | 0 | 0 | style="border-right: 2px solid red" |0 | 1 | style="border-right: 2px solid green" | 1 | 0 | 1 | 1 | style="border-right: 2px solid red" | 0 | 0 | 0 | 0 | style="border-right: 2px solid green" | 1 | 0 | style="border-right: 2px solid red" | 1 | 1 | 1 | 0 | 1 | 0 | style="border-right: 2px solid black" | 0 |- | style="border-right: 2px solid black" | New decimal values ! colspan=6 style="border-right: 2px solid red" | 16 ! colspan=6 style="border-right: 2px solid red" | 54 ! colspan=6 style="border-right: 2px solid red" | 5 ! colspan=6 style="border-right: 2px solid black" | 52 |- | style="border-right: 2px solid black" | +32 ! colspan=6 style="border-right: 2px solid red" | 48 ! colspan=6 style="border-right: 2px solid red" | 86 ! colspan=6 style="border-right: 2px solid red" | 37 ! colspan=6 style="border-right: 2px solid black" | 84 |- | style="border-right: 2px solid black" | Uuencoded characters ! colspan=6 style="border-right: 2px solid red" | <code>0</code> ! colspan=6 style="border-right: 2px solid red" | <code>V</code> ! colspan=6 style="border-right: 2px solid red" | <code>%</code> ! colspan=6 style="border-right: 2px solid black" | <code>T</code> |}
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)