Data security in modern computing, particularly in IoT and edge environments, demanded lightweight cryptographic solutions due to resource constraints. Classical cryptographic algorithms, such as the Affine Cipher and Vigenere Cipher, were attractive for their simplicity and low computational overhead but suffer from vulnerabilities to modern attacks, including brute force and frequency analysis. This study aimed to optimize these algorithms by increasing key length and applying polyalphabetic variations, enhancing their resilience to attacks while maintaining efficiency. Experimental resulted demonstrate significant improvements in resistance to decryption attempts, with optimized algorithms proving highly resilient even under constrained environments. Despite minor increased in computational resources, the algorithms remain efficient and practical for IoT applications. These findings underscored the potential of optimized classical cryptography as a secure yet resource-efficient alternative for modern computing systems, bridging the gap between robust security and operational feasibility. Future research could explore hybrid algorithms combining classical and modern techniques.