changed secret key generation method