1. A method for encoding data, the method comprising the steps of: implementing dynamic Huffman tables in hardware representing a plurality of Huffman tree shapes precomputed from a sample data set, wherein the Huffman tree shapes are represented in the dynamic Huffman tables by code length values; upon receipt of input data, writing symbols and their counts from the input data to the dynamic Huffman tables; calculating a score for each of the dynamic Huffman tables with the symbols and counts from the input data, wherein the score is based on the code length values of the precomputed Huffman tree shapes and the counts from the input data; and selecting a given one of the dynamic Huffman tables having a lowest score for encoding the input data.