In this paper we describe an efficient implementation of the Tate and Ate pairings using Barreto-Naehrig pairing-friendly curves, on both a standard 32-bit PC and on a 32-bit smartcard. First we introduce a sub-family of such curves with a particularly simple representation. Next we consider the issues that arise in the efficient implementation of field arithmetic in Fp12 , which is crucial to good performance. Various optimisations are suggested, including a novel approach to the ‘final exponentiation’, which is faster and requires less memory than the methods previously recommended.