My Profile Photo

code ninja . blog

where I show and discuss things I'm working on...

Shannon-Fano coding in Go

For another project I’m working on I needed to Shannon-Fano encode text strings into bit vectors. So, I cranked out a Go package real quick and thought others might find it useful as well.

Aside from - well - encoding, I wanted to be sure the table could be serialized using encoding/gob, that way it would be possible to use the encoding (and decoding) via files and even over the network. There’s an example of doing this in the README.

Cheers! I hope you find it useful.