# CSE 127: Lecture 10

The topics covered in this lecture are KISS, and review for midterm.

## KISS Rule

The KISS rule refers to simplicity in designs. It is an acronym for ``Keep It Simple, Stupid'', which is obviously an admonition to avoid unnecessary complexities -- here, the context is in engineering systems design. Complex designs are more likely to have bugs, both in the design specification and in the implementation, than a simpler design.

Bugs, as we should know by now, often lead to exploitable security vulnerabilities.

Generalizations of this idea would include using simple, easy to understand user interfaces; using simpler, easier-to-understand, though possibly less efficient algorithms when the performance requirements are not tight; using well understood, well tested library routines/modules in lieu of writing custom code (i.e., avoid the Not Invented Here (NIH) syndrome); etc.

## Review

I will not put the Q&A on the web page. One answer that I'd like to clarify:

It is infeasible to tabulate primes. Consider a modulus N, where |N|=n=1024 (lower case n is the number of bits in N). The prime number theorem says that the density of primes less than N is approximately 1/log(N). This means that the number of primes less than N, denoted pi(N), is N/log(N). (Natural logarithm.)

To figure out approximately how many primes there are that are 512-bits long -- N=P*Q, so if P and Q are the same length, they will be 512-bits long -- we compute the following:

```number of primes with 512 or fewer bits is approx 2^512/(512 log(2))
number of primes with 511 or fewer bits is approx 2^511/(511 log(2))
so
number of primes with exactly 512 bits is approx the difference, or
2^512/(512 log(2)) - 2^511/(511 log(2))
= 2^512/(512 log(2)) - 2^511 (512/511)/(512 log(2))
= (2*2^511 - 2^511 (512/511)) / (512 log(2))
= 2^511 * (2 - (512/511)) / (512 log(2))
which is slightly less than
2^511 * 1 / (512 log(2))
```
still a very very large number.