support providing both code and hash