15.04.2018 Views

programming-for-dummies

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

448<br />

The Basics of Encryption<br />

After you have a valid encryption algorithm that’s been implemented properly<br />

in a particular <strong>programming</strong> language, the final step to creating a secure<br />

encryption algorithm is the key length used to scramble the data.<br />

In a simple substitution cipher, the key length could be considered as the<br />

value 1 because it offers only one way of replacing letters with another letter,<br />

such as shifting each letter by a fixed position in the alphabet. To encrypt a<br />

1,000-character message, a one-time pad would need 1,000 different random<br />

numbers <strong>for</strong> shifting each letter in the message, so the key length could be<br />

considered as 1,000.<br />

The key length is crucial because the details of an encryption algorithm are<br />

often published <strong>for</strong> anyone to examine. As a result, the security of most<br />

encryption algorithms rests solely on the key length used <strong>for</strong> the password.<br />

You don’t need to create a long password of 1,000 or more characters; the<br />

encryption algorithm needs to use more bits of data to store any password<br />

whether the password consists of 1 character or 100.<br />

The length of the password simply makes it harder <strong>for</strong> other people to<br />

guess. A 1-letter password means someone needs only 26 guesses. A 100-<br />

letter password <strong>for</strong>ces someone to try all possible combinations of letters,<br />

making guessing much more difficult. The key length simply defines the<br />

amount of space used to store the password but doesn’t specify the physical<br />

length of the password.<br />

As a simple analogy, think of encryption key lengths like the physical key to<br />

your front door. A physical key consists of rods that drop down to prevent a<br />

doorknob from turning. The more rods used, the harder it is to pick the lock.<br />

The fewer rods used, the easier it is to pick the lock.<br />

In the same way, encryption keys are used to hold passwords. The shorter<br />

the key length (measured in bits), the fewer possibilities exist and the weaker<br />

the encryption, making it more vulnerable to being broken. The longer the<br />

encryption key length, the less likely the encryption will break.<br />

No encryption is considered unbreakable, but the goal of every encryption<br />

algorithm is to make unscrambling data so difficult that the time needed to<br />

read the encrypted message takes too long. Typically an encrypted message<br />

might take the world’s fastest computer a million years to break, which effectively<br />

makes the encryption “unbreakable.”<br />

At one time, a 56-bit key was considered unbreakable, but with today’s<br />

computers, the smallest secure key length is 128-bits, although many<br />

people prefer using 256-bit or 512-bit keys <strong>for</strong> added security.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!