A Lightweight Approach to Data Protection: Implementing Base64 Encryption and Decryption in Python

Imelda Maretta Putri, Albertus Bobby Nugroho, Ans’ Akmal Surya Myriano

Abstract


This paper presents a lightweight data protection method combining Base64 encoding with a modular linear congruential transformation. The encryption algorithm f(x) = (7x + 23) mod 256 was tested on the sample string "Polke," achieving accurate encryption and decryption with minimal computational cost. Experiments show transformation rates up to 215.84%, perfect data recovery, and negligible resource usage (processing time <1 ms, memory 0.1 KB, CPU <1%). Scalability tests demonstrate linear performance up to 5000 characters. The proposed system is suitable for basic data security in resource-constrained applications.

Full Text:

PDF

References


C. A. Pamungkas, Z. Pratama, I. Setiarso, and M. Doheir, “Implementation Of The Base64 Algorithm For Text Encryption And Decryption Using The Python Programming Language,” JAIS J. Appl. Intell. Syst., vol. 9, no. 1, Art. no. 1, 2024, doi: 10.62411/jais.v9i1.10310.

A. Andilala, A. K. Hidayah, A. W. Mahfuzy, and M. Oki, “Implementasi Kombinasi Enkripsi Base64 Dengan Hashing Sha-1 Dan Md5 Pada Aplikasi Perpustakaan Universitas Muhammadiyah Bengkulu,” J. Teknol. Sist. Inf. Dan Sist. Komput. TGD, vol. 6, no. 2, Art. no. 2, Jul. 2023, doi: 10.53513/jsk.v6i2.8546.

K. Xiao, “Implementation Analysis of Encryption and Decryption Algorithm Based on python Language,” in Proceedings of the 2022 7th International Conference on Systems, Control and Communications, in ICSCC ’22. New York, NY, USA: Association for Computing Machinery, Feb. 2023, pp. 1–5. doi: 10.1145/3575828.3575829.

A. E. Sunday and O. E. Olufunminiyi, “An Efficient Data Protection for Cloud Storage Through Encryption,” Int. J. Adv. Netw. Appl., vol. 14, no. 05, pp. 5609–5618, 2023, doi: 10.35444/IJANA.2023.14505.

A. K. Muthaura and J. Kandiri, “Data protection in Healthcare Information Systems Using Cryptographic Algorithm with Base64 512 bits,” J. Kenya Natl. Comm. UNESCO, vol. 4, no. 2, Art. no. 2, Jul. 2024, doi: 10.62049/jkncu.v4i2.105.

A. Taufiqur Rohman and Moh. A. Romli, “Implementasi Algoritma Base64 Pada Aplikasi Kriptografi Gambar Untuk Keamanan Data Visual Berbasis Mobile Android,” TEKNO J. Penelit. Teknol. Dan Peradil., vol. 2, no. 2, pp. 1–15, Aug. 2024, doi: 10.62565/tekno.v2i2.46.

F. Sieck, S. Berndt, J. Wichelmann, and T. Eisenbarth, “Util::Lookup: Exploiting key decoding in cryptographic libraries,” in Proceedings of the 2021 ACM SIGSAC Conference on Computer and Communications Security, Nov. 2021, pp. 2456–2473. doi: 10.1145/3460120.3484783.

A.-K. Wickert, L. Baumgärtner, F. Breitfelder, and M. Mezini, “Python Crypto Misuses in the Wild,” in Proceedings of the 15th ACM / IEEE International Symposium on Empirical Software Engineering and Measurement (ESEM), Oct. 2021, pp. 1–6. doi: 10.1145/3475716.3484195.

S. Wen and W. Dang, “Research on Base64 Encoding Algorithm and PHP Implementation,” in 2018 26th International Conference on Geoinformatics, Jun. 2018, pp. 1–5. doi: 10.1109/GEOINFORMATICS.2018.8557068.

Muchamad Kurniawan, I Gede Ardi Sukaryadi Putra, I Made Agastya Maheswara, Reynaldus Yoseph Maria Neto Labamaking, I Made Edy Listartha, and Gede Arna Jude Saskara, “Analisis efektivitas dan efisiensi metode encoding dan decoding algoritma base64,” J. Inform. Dan Tekonologi Komput., vol. 3, no. 1, pp. 24–34, Mar. 2023, doi: 10.55606/jitek.v3i1.897.

S. R. Hart, E. S. Powers, and J. W. Sweeny, “Format-preserving encryption of base64 encoded data,” US20170170952A1, Jun. 15, 2017 Accessed: Jun. 19, 2025. [Online]. Available: https://patents.google.com/patent/US20170170952A1/en

Isnar Sumartono, Andysah Putera Utama Siahaan, and Arpan, “Base64 Character Encoding and Decoding Modeling,” Sep. 22, 2017, OSF. doi: 10.31227/osf.io/ndzqp.

“Encoding and Decoding Base64 Strings in Python,” GeeksforGeeks. Accessed: Jun. 19, 2025. [Online]. Available: https://www.geeksforgeeks.org/encoding-and-decoding-base64-strings-in-python/

T. G, “A Re-Examine on Assorted Digital Image Encryption | Algorithm’s Techniques,” Biostat. Biom. Open Access J., vol. 4, no. 2, Jan. 2018, doi: 10.19080/BBOAJ.2018.04.555633.

S. Josefsson, “The Base16, Base32, and Base64 Data Encodings,” Internet Engineering Task Force, Request for Comments RFC 3548, Jul. 2003. doi: 10.17487/RFC3548.

“Base64,” Wikipedia. Jun. 15, 2025. Accessed: Jun. 20, 2025. [Online]. Available: https://en.wikipedia.org/w/index.php?title=Base64&oldid=1295689538

“Base64 - Glossary | MDN.” Accessed: Jun. 20, 2025. [Online]. Available: https://developer.mozilla.org/en-US/docs/Glossary/Base64

P. R. Kumar and S. Goel, “A secure and efficient encryption system based on adaptive and machine learning for securing data in fog computing,” Sci. Rep., vol. 15, no. 1, p. 11654, Apr. 2025, doi: 10.1038/s41598-025-92245-9.

S. I. Serengil and A. Ozpinar, “LightPHE: Integrating Partially Homomorphic Encryption into Python with Extensive Cloud Environment Evaluations,” Jul. 25, 2024, arXiv: arXiv:2408.05219. doi: 10.48550/arXiv.2408.05219.

A. Kumar J and G. Ganapathy, “A Visual Cryptographic Technique for Transferring Secret Image in Public Cloud,” Int. J. Innov. Technol. Explor. Eng., vol. 9, no. 3, pp. 2257–2260, Jan. 2020, doi: 10.35940/ijitee.C9037.019320.

M. Kazemian and M. Helfert, “A lightweight Encryption Method For Privacy-Preserving in Process Mining,” in 2023 IEEE Intl Conf on Dependable, Autonomic and Secure Computing, Intl Conf on Pervasive Intelligence and Computing, Intl Conf on Cloud and Big Data Computing, Intl Conf on Cyber Science and Technology Congress (DASC/PiCom/CBDCom/CyberSciTech), Nov. 2023, pp. 0228–0233. doi: 10.1109/DASC/PiCom/CBDCom/Cy59711.2023.10361442.


Refbacks

  • There are currently no refbacks.


Flag Counter

 International Journal of Engineering Computing Advanced Research (IJECAR) (e-ISSN : xxxx-xxxxp-ISSN : xxxx-xxxx) is published by ARCES.

 

This journal is under licensed of Creative Commons Attribution 4.0 International License.

Visitor Stats