The counting ability of weak formalisms is of interest as a measure of their expressive
power. The question was investigated in the 1980's in several papers in complexity theory and in weak arithmetic. In each case, the considered formalism (AC$^0$--circuits, first--order logic, $\Delta_0$, respectively) was shown to be able to count precisely up to a polylogarithmic number. An essential part of each of the proofs is the construction of a 1--1
mapping from a small subset of $\{0,\ldots,N-1\}$ into a small initial segment. In each case the expressibility of such a mapping depends on some strong argument (group theoretic device or prime number theorem) or intricate construction. We present a coding device based on a collision-free hashing technique, leading to a completely elementary proof for the polylog counting capability of first--order logic (with built--in arithmetic), $AC^0$--circuits, rudimentary arithmetic, the Linear Hierarchy, and monadic--second order logic with addition.