Encoding before hash