
August 1st, 2002, 09:55 PM
|
 |
Banned ;)
|
|
Join Date: Nov 2001
Location: Glendale, Los Angeles County, California, USA
|
|
This might actually be a question to be asked in the algorithm forum, but I'll try to answer it here. It's possible to do this, provided you give some information about what the possible range of characters is in the 7 character string.
Assuming that the characters used are only A-Z (uppercase or lowercase alone) and maybe a few other characters like space, comma, period etc. here's how I'd do it.
We have to compress our data into a 5 byte array. Therefore we have 5 Bytes = 40 bits (because each byte = 8 bits)
Assume a 5 bit baudot character set. This means that 5 bits will be used to represent each character, so there can be a maximum of 2^5 = 32 characters in this set. A-Z will take up 26 of these characters, leaving 6 free characters which you can use for characters such as space, period, comma and three other characters of your choosing. Now, if each character uses up 5 bits, then to represent 7 characters in this set, you'll need (7 x 5) = 35 bits
Therefore, you can squeeze 7 characters into a 5 byte array using this 5 bit character set. Matter of fact, you can squeeze an 8th character in there as well, or use the remaining 5 bits for status, parity or checksum bits of some sort. Does this give you an idea how to proceed? 
|