大象传媒

Internet and cybersecurity - EduqasEncryption

Networks operate on the principles of communication and sharing. Unfortunately, these principles mean that network traffic and data can be more easily accessed by people who have no authority to do so. Different vulnerabilities need to be identified and measures put in place to protect systems from them.

Part of Computer ScienceUnderstanding Computer Science

Encryption

is the process of disguising a message so that it cannot be understood by anyone but its intended recipient. Encryption requires the use of a key. The key is the secret that defines how the message has been disguised.

Five facts about encryption

  • Unencrypted messages are referred to as messages.
  • Encrypted messages are known as .

A simple method of encryption is a technique known as the Caesar cipher. The cipher works by using a numerical key. Each plaintext letter is replaced by a new letter, the one found at the original letter's position in the alphabet plus or minus the value of the key.

For example, a key value of plus three would change the plaintext message 鈥榮ee you tonight鈥 to the ciphertext message 鈥榲hh brx wrqljkw鈥.

A table containing plaintext and an example ciphertext

To decrypt the message the process is reversed.

Although this is a good example of encryption, today much more complicated are used to encrypt messages.

Encryption in use

Most communications sent via the internet are encrypted in some way:

  • purchases made online are encrypted to try to prevent theft of credit card details
  • tools enable a user to encrypt a document, such as a spreadsheet, before sending it to a colleague via the internet
  • satellite TV transmissions are encrypted to prevent users who do not subscribe from watching TV shows

XOR encryption

Another method for encrypting text is to use the XOR method.

To encrypt a message:

  1. select a random 8-bit
  2. convert each character of the message into binary
  3. use XOR logic to create a new code
  4. convert the new 8-bit binary number into an ASCII character

For instance, using a randomly selected 8-bit binary pattern of 00110110 we can encrypt the string 鈥楥omputer鈥.

Convert each character into 8-bit ASCII

C = 01000011

o = 01101111

m = 01101101

p = 01110000

u = 01110101

t = 01110100

e = 01100101

r = 01110010

For each character use XOR (exclusive OR) to compare the ASCII code to the randomly selected pattern. If exactly one of the two characters you are comparing is a 1, place a 1 in that position in the new code. If both are 0, or if both are 1, then place a 0 in that position.

Here is the conversion for the letter 鈥楥鈥.

Original ASCII code = 0 1 0 0 0 0 1 1
8 bit pattern = 0 0 1 1 0 1 1 0
NEW ASCII Code = 0 1 1 1 0 1 0 1
Original ASCII code =
0 1 0 0 0 0 1 1
8 bit pattern =
0 0 1 1 0 1 1 0
NEW ASCII Code =
0 1 1 1 0 1 0 1

The new character generated is 01110101, which converts to the ASCII character 鈥榰鈥. Sometimes the character will be a letter, number, or symbol, or it could be a hidden character such as NULL, SPACE or LINE BREAK.

All of the characters are converted this way using the same 8-bit pattern that was used to convert the first character.

CharacterOriginal ASCII CODEConverted ASCII codeNEW ASCII character
C0100001101110101u
o0110111101011001Y
m0110110101011011[
p0111000001000110F
u0111010101000011C
t0111010001000010B
e0110010101010011S
r0111001001000100D
CharacterC
Original ASCII CODE01000011
Converted ASCII code01110101
NEW ASCII characteru
Charactero
Original ASCII CODE01101111
Converted ASCII code01011001
NEW ASCII characterY
Characterm
Original ASCII CODE01101101
Converted ASCII code01011011
NEW ASCII character[
Characterp
Original ASCII CODE01110000
Converted ASCII code01000110
NEW ASCII characterF
Characteru
Original ASCII CODE01110101
Converted ASCII code01000011
NEW ASCII characterC
Charactert
Original ASCII CODE01110100
Converted ASCII code01000010
NEW ASCII characterB
Charactere
Original ASCII CODE01100101
Converted ASCII code01010011
NEW ASCII characterS
Characterr
Original ASCII CODE01110010
Converted ASCII code01000100
NEW ASCII characterD

The encrypted message would display 鈥榰Y[FCBSD鈥.

To decrypt a message, repeat the method using the same 8-bit binary pattern.