Pairwise key establishment is a fundamental security service in sensor networks. It enables sensor nodes to communicate securely with each other using cryptographic techniques. However, due to the resource constraints on sensors, it is infeasible to use traditional key management techniques. To facilitate the study of novel pairwise key predistribution techniques, this paper presents a new framework for establishing pairwise keys between sensors on the basis of an ID-based key predistribution protocol. In this paper key agreement uses hash calculation and comparison instead of broadcasting; it reduces communication consumption on sensors. This paper then analyses the security and overhead and compares with previous schemes. The results show our scheme is superior to the existing approaches, and it can save communication resources.