Unveiling the Performance: A Comparative Study of HMAC and RSA Encryption on SHA-512
Louis Leonardo1 & Rojali2 Show affiliations
- Department of Computer Science, BINUS Graduate Program-Master of Computer Science, Bina Nusantara University, Jakarta, Indonesia
- Department of Computer Science, BINUS Graduate Program-Master of Computer Science, Bina Nusantara University, Jakarta, Indonesia
Journal of Computer Science, Volume 21, Issue 12, pp. 2940–2950 · doi.org/10.3844/jcssp.2025.2940.2950
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.
Licence and reuse
Open access. This article is licensed under a Creative Commons Attribution 4.0 International Licence (CC BY 4.0), as printed on the article, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original authors and the source. No permission is needed.
How to reuse this articleResponses (0)
About this article
Leonardo, L. & Rojali, . (2025). Unveiling the Performance: A Comparative Study of HMAC and RSA Encryption on SHA-512. Journal of Computer Science, 21(12), 2940–2950. https://doi.org/10.3844/jcssp.2025.2940.2950
- Licence
- CC BY 4.0
- Issue
- Volume 21, Issue 12
- Policies
- Editorial independenceUse of generative AIData availabilityAppeals and complaints
- Version
- Version of record
