We encode the binomials belonging to the toric ideal $I_A$ associated with an
integral $d \times n$ matrix $A$ using a short sum of rational functions as introduced by
Barvinok \cite{bar,newbar}. Under the assumption that $d,n$ are fixed, this representation
allows us to compute the Graver basis and the reduced Gr\"obner basis of the ideal $I_A$,
with respect to any term order, in time polynomial in the size of the input. We also derive
a polynomial time algorithm for normal form computation which replaces in this new encoding
the usual reductions typical of the division algorithm. We describe other applications,
such as the computation of Hilbert series of normal semigroup rings, and we indicate
further connections to integer programming and statistics.