[refactor] package "generate-key" is changed to "hat" - it works faster and checks if returned random value is unique