Existing solutions based Advanced Encryption Standard to address the security issues of nonvolatile memories incurs significant performance and power overhead. Here, the authors propose a lightweight XOR-gate based encryption/decryption technique by exploiting in-situ array operations, which achieves significant area/latency/power reduction compared to conventional designs.