Huffman compression in python and javascript