better key generation, started encipher function