Added code to generate key hash