polyglot book stage 1: generating keys