Hamiltonian formulation of teleparallel gravity