Various compression, de-compression, error-correction functions