Over-the-air reprogramming is a key service in wireless sensor networks. The service can disseminate a new code image to every sensor node in the network. For security reasons, every code image must be authenticated to prevent an attacker from installing its code to the network. In this paper, an authentication method named Hierarchical Hash Tree (HHT) is proposed to reduce the overheads of Sreluge, which is a reprogramming protocol based on rateless codes. HHT is a composed structure including two layers of Merkle Tree. The pages from code image are used to construct small hash trees in bottom. For reducing communication overhead, the roots of bottom trees are aggregated into root fingerprints, which are used to build top tree. Then, the security is analysed for proposed method and mathematical analysis are provided for the HHT overheads. Furthermore, we implement pages authentication using HHT in Sreluge. Experimental results show that our method can cut pages authentication overhead by at least half that of Sreluge for more than 3-KByte code image. And dissemination completion time of our method is about 60% that of Sreluge.