Modified keyGen for a fixed key size