Lightweight Sensor Data Encryption on ESP32 Using the Pi Number for Dynamic Operations

Since intercepted sensor data can reveal user activities, lightweight cryptography is essential for protecting information in resource-constrained devices. Although ARX-based lightweight schemes offer high computational efficiency, their lack of inherent non-linear substitution and permutation layers motivates their integration into secure cryptographic designs. This paper proposes LSEPI (Lightweight Sensor Encryption Using PI), a lightweight stream cipher for protecting electrical sensor data. LSEPI employs a single-round substitution-permutation design that combines the AES substitution box with a key-dependent dynamic permutation and a dynamically selected XOR mask derived from the secret key and the digits of the number π. To mitigate the computational cost of pseudorandom sequence generation, the first 20 KB of the decimal expansion of π are stored on both the ESP32 and Android device. Encryption is performed on the ESP32 during the simultaneous acquisition and computation of voltage, current, power, and energy, while decryption is performed on an Android application for user-selected time intervals. Statistical evaluation shows that LSEPI achieves an entropy of 7.9971 with a single encryption round, comparable to Speck-CTR with 32 rounds (7.9970) and Ascon (7.9969), and higher than the approximately 7.18 reported for recent lightweight proposals. The encrypted data also satisfies the chi-square goodness-of-fit criterion, exhibits correlation coefficients close to zero, and achieves average avalanche effects of 50.005% for one-bit plaintext changes and 50.08% for one-bit key changes. GLCM-based texture metrics are comparable to those of Speck-CTR and Ascon. The known-plaintext analysis indicates that recovering the key-dependent masking sequence requires determining or inverting the key-dependent permutation; thus, despite the use of XOR operations, the attack does not directly succeed. From a computational perspective, LSEPI requires 135 μs per sensor record after initialization, adding only 0.04% overhead to the computation of the electrical variables on the ESP32.

Authors

Institutions

Publication Details

Journal
Technologies
Published
2026-09-22
DOI
https://doi.org/10.3390/technologies14100595
Primary Topic
Cryptographic Implementations and Security
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
article

Lightweight Sensor Data Encryption on ESP32 Using the Pi Number for Dynamic Operations

Moisés Salinas-Rosales, Rolando Flores-Carapia, Manuel Alejandro Cardona-López, Jaime Robles García et al.
Technologies
Cryptographic Implementations and Security
article

Lightweight Sensor Data Encryption on ESP32 Using the Pi Number for Dynamic Operations

Moisés Salinas-Rosales, Rolando Flores-Carapia, Manuel Alejandro Cardona-López, Jaime Robles García, Santiago Segura-Romo, Aura Luz Barcenas-Medina
article en

Abstract

Since intercepted sensor data can reveal user activities, lightweight cryptography is essential for protecting information in resource-constrained devices. Although ARX-based lightweight schemes offer high computational efficiency, their lack of inherent non-linear substitution and permutation layers motivates their integration into secure cryptographic designs. This paper proposes LSEPI (Lightweight Sensor Encryption Using PI), a lightweight stream cipher for protecting electrical sensor data. LSEPI employs a single-round substitution-permutation design that combines the AES substitution box with a key-dependent dynamic permutation and a dynamically selected XOR mask derived from the secret key and the digits of the number π. To mitigate the computational cost of pseudorandom sequence generation, the first 20 KB of the decimal expansion of π are stored on both the ESP32 and Android device. Encryption is performed on the ESP32 during the simultaneous acquisition and computation of voltage, current, power, and energy, while decryption is performed on an Android application for user-selected time intervals. Statistical evaluation shows that LSEPI achieves an entropy of 7.9971 with a single encryption round, comparable to Speck-CTR with 32 rounds (7.9970) and Ascon (7.9969), and higher than the approximately 7.18 reported for recent lightweight proposals. The encrypted data also satisfies the chi-square goodness-of-fit criterion, exhibits correlation coefficients close to zero, and achieves average avalanche effects of 50.005% for one-bit plaintext changes and 50.08% for one-bit key changes. GLCM-based texture metrics are comparable to those of Speck-CTR and Ascon. The known-plaintext analysis indicates that recovering the key-dependent masking sequence requires determining or inverting the key-dependent permutation; thus, despite the use of XOR operations, the attack does not directly succeed. From a computational perspective, LSEPI requires 135 μs per sensor record after initialization, adding only 0.04% overhead to the computation of the electrical variables on the ESP32.

TechnologiesVol. 14(10)
Universidad La Salle (BO), Universidad La Salle (MX), Instituto Politécnico Nacional (MX)
Openalex Percentile: Top 8%
Cryptographic Implementations and Security
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.