Unveiling the Performance: A Comparative Study of HMAC and RSA Encryption on SHA-512
- 1 Department of Computer Science, BINUS Graduate Program-Master of Computer Science, Bina Nusantara University, Jakarta, Indonesia
- 2 Department of Computer Science, BINUS Graduate Program-Master of Computer Science, Bina Nusantara University, Jakarta, Indonesia
Abstract
The study evaluates critical operations including token signing, verification, and decoding, as well as data transfer efficiency, utilizing the jsonwebtoken library. By benchmarking these operations, we provide insights into the trade-offs between symmetric (HMAC) and asymmetric (RSA) encryption methods, highlighting their impact on performance and security. The results serve as a guideline for developers to make informed decisions when choosing JWT algorithms for their Node.js applications, balancing security needs and application performance. Our analysis revealed that HMAC-SHA512 consistently outperforms RSA-SHA512 in terms of token creation speed, data transfer efficiency, and token size. Specifically, HMAC-SHA512 demonstrated faster token generation times, achieving rates up to ten times higher than RSA-SHA512, and produced tokens that were 256 bytes smaller on average. Furthermore, HMAC-SHA512 maintained superior data transfer rates, reaching up to 42.601 MB/s, compared to RSA-SHA512's maximum of 9.822 MB/s. Despite RSA-SHA512's robust performance in token verification and decoding, HMAC-SHA512's overall efficiency and consistency make it the preferred choice for applications requiring rapid processing and minimal latency. This study underscores the potential of HMAC-SHA512 to enhance performance in data-intensive environments, highlighting its advantages in speed and reduced data payload.
DOI: https://doi.org/10.3844/jcssp.2025.2940.2950
Copyright: © 2025 Louis Leonardo and Rojali. This is an open access article distributed under the terms of the
Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited.
- 27 Views
- 6 Downloads
- 0 Citations
Download
Keywords
- JSON Web Token
- JWT
- HMAC-SHA512
- RSA-SHA512
- NodeJS
- Encryption Performance
- Data Transfer