basE91 encoding

basE91 is an advanced method for encoding binary data as ASCII characters. It is similar to UUencode or base64, but is more efficient. The overhead produced by basE91 depends on the input data. It amounts at most to 23% (versus 33% for base64) and can range down to 14%, which typically occurs on 0-byte blocks. This makes basE91 very useful for transferring larger files over binary unsafe connections like e-mail or terminal lines.

As the name suggests, basE91 needs 91 characters to represent the encoded binary data in ASCII. From the 94 printable ASCII characters (0x21-0x7E), the following three ones have been omitted to build the basE91 alphabet:

- (dash, 0x2D)\ (backslash, 0x5C)' (apostrophe, 0x27)

The translation table is composed of the remaining characters as shown below.

The table below shows a comparison of base64 and basE91, each method applied to 1 MiB binary data. The plain row lists the results with unformatted output and the MIME values show the amount of data that is produced, when you attach a file to an email (MIME requires a line break <CR><LF> after 76 characters).

binary

base64

basE91

worst case

random data

best case

plain

1048576 Byte=1024 KiB100%

1398104 Byte+341 KiB133.33%

1290556 Byte+236 KiB123.08%

1289478 Byte+235 KiB122.97%

1198373 Byte+146 KiB114.29%

MIME

1434898 Byte+377 KiB136.84%

1324518 Byte+269 KiB126.32%

1323412 Byte+268 KiB126.21%

1229911 Byte+177 KiB117.29%

Using basE91 you need to transfer only 85.7% to 92.3% of the data, you would have to transfer with base64.