add function to generate read key, issue #2