This paper presents a novel algorithm for watermark (WM) embedding in the discrete cosine transform (DCT) domain and its implementation in hardware. The proposed algorithm is shown to be easily integrated in the peripheral image processing circuitry of a CMOS image sensor that holds JPEG compression capabilities. The proposed algorithm embeds the WM in middle frequency DCT coefficients, according to the output of a random number generator. This addresses the trade-off between the WM robustness and image quality degradation. Choosing the DCT coefficient in a pseudo-random manner provides higher effective coverage, as a potential attacker must consider a wide range of possible coefficients. Matlab simulations show the ability of the algorithm to ensure image authenticity even when changing only 2 DCT coefficients in each 8×8 block. The WM embedder was designed in Verilog according to the proposed algorithm.