Encode password string