Encode text and decode hash