Implementations of various encoding algorithms