In wireless sensor networks (WSNs), the data packets are aggregated and compressed before being sent to the base station, aiming to keep the data secure in the transmission process. This paper presents an arithmetic coding scheme with graph-based mirror system (GBMS) to guard against intruders. Considering its good encryption effect, the hash function, a.k.a. the one-way function, was adopted to encrypt the original messages. The crypto signature was selected to validate the source and destination with temper-proof hash function. In addition, each message was transformed into a graph through inverse mirror mapping, and the graph was taken as final cipher along with the hash value. All the messages were authenticated and authorized by session id created at the time of user entry. Simulation results show that the proposed scheme achieved an efficiency up to 99% without any loss or addition of information. The research findings protect the message integrity and facilitates data aggregation in the WSNs.