add general Hamming codes