First principles study of structural, elastic, and electronic properties of the cubic perovskitetype BaHfO$_3$ has been performed using the plane wave ultrasoft pseudo-potential method based on density functional theory with revised Perdew-Burke-Ernzerhof exchange-correlation functional of the generalized gradient approximation (GGA-RPBE). The calculated equilibrium lattice constant of this compound is in good agreement with the available experimental and theoretical data reported in the literatures. The independent elastic constants (emph{C}$_{11}$, emph{C}$_{12}$, and emph{C}$_{44}$), bulk modules emph{B} and its pressure derivatives $B^{prime}$, compressibility $beta$, shear modulus emph{G}, Youngs modulus emph{Y}, Poissons ratio $ u$, and Lam{e} constants ($mu, lambda$) are obtained and analyzed in comparison with the available theoretical and experimental data for both the singlecrystalline and polycrystalline BaHfO$_3$. The band structure calculations show that BaHfO$_3$ is a indirect bandgap material (R-$Gamma$ = 3.11 eV) derived basically from the occupied O 2emph{p} and unoccupied Hf 5emph{d} states, and it still awaits experimental confirmation. The density of states (total, site-projected, and emph{l}-decomposed) and the bonding charge density calculations make it clear that the covalent bonds exist between the Hf and O atoms and the ionic bonds exist between the Ba atoms and HfO$_3$ ionic groups in BaHfO$_3$. From our calculations, it is shown that BaHfO$_3$ should be promising as a candidate for synthesis and design of superhard materials due to the covalent bonding between the transition metal Hf 5emph{d} and O 2emph{p} states.