hEncode and hDecode in C