David' Scott's SUBSET ONE TO ONE HUFFMAN COMPRESSION

files updated on September 23,1999

My main concern is to create compression routines that are of great use to the person who some day may want to compress data before encryption is used. I feel very strongly that a compression routine should be "one to one" on the previous page I give the rules for h2com.exe; However this was for 256 symbol adaptive huffman compression. This is an attempt to make the one to one feature extend to set of symbols of less than 256. you can hopefully compress one to one with as little as 9 symbol types.
Here is h2comaa.exe this routine can be used to change bases in a "one to one" way. That means if you had a file writte in HEX you compress the characters to a binary file in a unique way. Then uncompress the file in base 10. It would be a "one to one" mapping that is not a normal base conversion.
It also means that if you have a file made up just a few symbols then you can convert it to a "one to one" binary file. Use your binary encryption method of choice. Then if you need to send it on you can uncompress the resulting enrypted file to a charset that you desire to use for the mail.
This may sound hard but it is not. I have included a batch program that does the job you just have to supply the encryption method. The batch program also uses h3com.exe so that the file gets a reverse huffman pass through the binary so that the resulting file better suited for AES types of encryption methods. Of course you don't need this if using scott16u or scott19u.

The following is what happen when h2comaa.bat aa is ran

file aa1.txt  first condition file
0000  48 45 4C 4F 57 52 20 79 55 72 69 65 6E 64 0D 0A  *HELOWR yUriend..*
0010  49 4D 46 4E 45 21 0D 0A  .  .  .  .  .  .  .  .  *IMFNE!..*
 number of bytes is 24 

file aa2.txt second condition file
0000  30 31 32 33 34 35 36 37 20  .  .  .  .  .  .  .  *01234567 *
 number of bytes is 9 

file aa.tx THE INPUT FILE
0000  48 45 4C 4C 4F 20 48 4F 57 20 41 52 45 20 79 4F  *HELLO HOW ARE yO*
0010  55 20 66 72 69 65 6E 64 0D 0A 49 20 41 4D 20 46  *U friend..I AM F*
0020  49 4E 45 21 49 20 41 4D 20 46 49 4E 45 21 49 20  *INE!I AM FINE!I *
0030  41 4D 20 46 49 4E 45 21 49 20 41 4D 20 46 49 4E  *AM FINE!I AM FIN*
0040  45 21 49 20 41 4D 20 46 49 4E 45 21 0D 0A  .  .  *E!I AM FINE!..*
 number of bytes is 78 

file z.aaa THE INPUT FILE ACTUALLY COMPRESSES via aa1.txt
0000  48 45 4C 4C 4F 20 48 4F 57 20 52 45 20 79 4F 55  *HELLO HOW RE yOU*
0010  20 72 69 65 6E 64 0D 0A 49 20 4D 20 46 49 4E 45  * riend..I M FINE*
0020  21 49 20 4D 20 46 49 4E 45 21 49 20 4D 20 46 49  *!I M FINE!I M FI*
0030  4E 45 21 49 20 4D 20 46 49 4E 45 21 49 20 4D 20  *NE!I M FINE!I M *
0040  46 49 4E 45 21 0D 0A  .  .  .  .  .  .  .  .  .  *FINE!..*
 number of bytes is 71 

file  z.paa the input compresses ready to be encrypted
0000  20 3B 3C F6 37 7F EF 46 84 46 DF E7 7B E7 37 FF  * ;<.7..F.F..{.7.*
0010  CE 60 3F 1C AE C1 F1 D7 78 F8 E9 FE BF D6 41 DB  *.`?.....x.....A.*
0020  65 7E 00 82 45 FA F2 08 1E 32 F3 F3  .  .  .  .  *e~..E....2..*
 number of bytes is 44 

** note no encyption done ** so expanding z.paa 

file z.daa The predceeding file uncompressed with aa2.txt
0000  36 30 36 36 30 36 32 36 36 36 32 36 36 36 30 36  *6066062666266606*
0010  20 36 30 36 36 30 36 36 36 36 36 36 36 36 36 30  * 606606666666660*
0020  36 36 36 30 20 36 30 34 20 32 36 30 36 30 36 36  *6660 604 2606066*
0030  36 36 36 36 36 20 36 36 30 36 36 36 30 36 36 36  *66666 6606660666*
0040  36 20 36 36 20 36 30 36 36 36 36 36 36 36 36 36  *6 66 60666666666*
0050  36 36 36 20 36 36 20 36 33 36 36 36 36 36 32 36  *666 66 636666626*
0060  36 20 30 30 36 36 30 36 33 36 36 36 36 32 36 36  *6 00660636666266*
0070  30 30 36 36 30 36 36 36 32 36 36 36 36 32 36 36  *0066066626666266*
0080  30 20 36 36 36 36 36 36 36 30 30 36 36 36 36 36  *0 66666660066666*
0090  36 36 30 30 36 20 34 36 36 30 36 30 36 30 36 20  *66006 466060606 *
00A0  30 30 36 36 36 36 36 35 30 34 20 32 30 36 36 36  *0066666504 20666*
00B0  36 36 30 30 36 36 36 20 33 35 36 36 36 32 36 20  *6600666 3566626 *
00C0  30 36 36 36 20 36 36 36 36 36 20 36  .  .  .  .  *0666 66666 6*
 number of bytes is 204 

file z.caa result of aa.txt compressed with aa1.txt 
0000  1B 16 40 01 62 84 C8 04 A0 4E 05 83 01 03 80 80  *..@.b....N......*
0010  98 41 F0 78 04 C0 28 04 87 21 8B 01 A0 13 5F 0D  *.A.x..(..!...._.*
0020  04 C0 0F 3E DD 82 00 F7 E1 CD 00 0C  .  .  .  .  *...>........*
 number of bytes is 44 

file z.aaa The predceeding file uncompressed with aa2.txt
0000  32 32 31 32 37 31 32 37 36 20 37 32 36 31 20 32  *221271276 7261 2*
0010  31 32 30 32 37 31 33 32 31 31 33 31 32 33 32 35  *1202713211312325*
0020  30 32 32 35 35 30 31 35 30 31 31 31 32 33 31 32  *0225501501112312*
0030  32 34 32 35 32 34 31 35 34 31 37 30 31 31 35 30  *2425241541701150*
0040  32 30 31 32 20 32 31 34 32 35 32 31 31 32 32 32  *2012 21425211222*
0050  32 37 32 31 20 35 32 34 35 32 32 32 35 32 32 32  *2721 52452225222*
0060  32 35 32 35 32 32 35 32 31 34 35 32 32 32 35 32  *2525225214522252*
0070  32 32 32 32 36 32 32 37 32 35 34 36 32  .  .  .  *2222622725462*
 number of bytes is 125 
ENTER here for MY Home Page