Measuring the security of an encryption algorithm involves understanding several key concepts. There are no definitive rules for assessing security, but two critical techniques include adherence to Shannon's principles of confusion and diffusion, and ensuring the mathematical foundation of the encryption method is rooted in NP Class problems. Various types of attacks can target encryption, including ciphertext-only, known plaintext, probable plaintext, chosen plaintext, and chosen ciphertext attacks. Effective countermeasures often rely on common sense and statistical analysis. For substitution algorithms, while the Enigma machine is a historical example, modern algorithms like DES and AES also utilize substitution and permutation techniques to enhance security. DES employs these transformations to create confusion and diffusion, while AES's substitution is based on inverse modulo operations in the GF(2^8) field.