# Thread: Huffman decoding

1. ## Huffman decoding

Hi. I am new to the board and no absolutely nothing about Huffman coding. I am actually trying to solve a geocaching puzzle where there is a Huffman code I nee to decode. I have no idea what it is or how to solve it. If anyone can be of assistance I would greatly appreciate it. Below is the information I was able to find. Thanks.

http://regex.info/exif.cgi?url=http%...nd%3D0.9374906

2. You'd need to know the table for the Huffman code. Generally the leading few bits of a Huffman Code determine the total number of bits in a single code. Some implementations, such as zip compression utilities, may optionally create and use a dynamically created Huffman code table, and include that table as part of the "header" in a compressed file. Wiki article:

Huffman coding - Wikipedia, the free encyclopedia

3. Originally Posted by rcgldr
You'd need to know the table for the Huffman code. Generally the leading few bits of a Huffman Code determine the total number of bits in a single code. Some implementations, such as zip compression utilities, may optionally create and use a dynamically created Huffman code table, and include that table as part of the "header" in a compressed file. Wiki article:

Huffman coding - Wikipedia, the free encyclopedia

I'm sorry, but everything you posted is complete jibberish to me. I am not computer literate at all, but thanks for your reply. I stumbled to get the info I got from the photo that I need to decode. Here is the original photo.

4. The huffman coding is used in the image compression and has nothing to do with the metadata.
If you're trying to "decode" the hex string on the page you linked, note that it's just ascii.
20 is a space.
30 is a zero.
31 is a one.
So your data is apparently:
Code:
`01001110 00110100 00110000 00100000 00110001 00110100 00101110 00110111 00110001 00110000 00100000 01010111 00110111 00110101 00100000 00110011 00111001 00101110 00110000 00110111 00110001`
Which, interpreted a single byte at a time (and in decimal) is:
Code:
`78 52 48 32 49 52 46 55 49 48 32 87 55 53 32 51 57 46 48 55 49`
Interpretting again as ascii gives:
Code:
`N 4 0   1 4 . 7 1 0   W 7 5   3 9 . 0 7 1`
which I believe is what you're looking for.

5. Yes, yes! That is what I was looking for. I was going nuts trying to understand all of this coding stuff and getting nowhere. Thanks so much for your quick reply.

6. The quick-and-dirty program I used to decode the info:
Code:
```#include <stdio.h>
#include <ctype.h>

int main(void) {

int c1, c2, n = 0;

while ((c1 = getchar()) != EOF) {

if (isspace(c1)) continue;

c2 = getchar();

if (c1 == '2') {
printf("%c", n);
n = 0;
}
else {
n <<= 1;
if (c2 == '1') n++;
}
}

return 0;
}```

Popular pages Recent additions