Encryption
encryptionFiles that are encrypted have been altered using a secret code and are unreadable to unauthorised parties. 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.
- Unencrypted messages are referred to as plaintextAn unencrypted message. messages.
- Encrypted messages are known as ciphertextAn encrypted message..
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鈥.
To decrypt the message the process is reversed.
Although this is a good example of encryption, today much more complicated algorithmA sequence of logical instructions for carrying out a task. In computing, algorithms are needed to design computer programs. 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:
- select a random 8-bit binaryA number system that contains two symbols, 0 and 1. Also known as base 2.bit patternA number of bits that together represent something, for example a character.
- convert each character of the message into binary ASCIIAmerican Standard Code for Information Interchange. A 7-bit character set used for representing English keyboard characters.
- use XOR logic to create a new code
- 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.
Character | Original ASCII CODE | Converted ASCII code | NEW ASCII character |
C | 01000011 | 01110101 | u |
o | 01101111 | 01011001 | Y |
m | 01101101 | 01011011 | [ |
p | 01110000 | 01000110 | F |
u | 01110101 | 01000011 | C |
t | 01110100 | 01000010 | B |
e | 01100101 | 01010011 | S |
r | 01110010 | 01000100 | D |
Character | C |
---|---|
Original ASCII CODE | 01000011 |
Converted ASCII code | 01110101 |
NEW ASCII character | u |
Character | o |
---|---|
Original ASCII CODE | 01101111 |
Converted ASCII code | 01011001 |
NEW ASCII character | Y |
Character | m |
---|---|
Original ASCII CODE | 01101101 |
Converted ASCII code | 01011011 |
NEW ASCII character | [ |
Character | p |
---|---|
Original ASCII CODE | 01110000 |
Converted ASCII code | 01000110 |
NEW ASCII character | F |
Character | u |
---|---|
Original ASCII CODE | 01110101 |
Converted ASCII code | 01000011 |
NEW ASCII character | C |
Character | t |
---|---|
Original ASCII CODE | 01110100 |
Converted ASCII code | 01000010 |
NEW ASCII character | B |
Character | e |
---|---|
Original ASCII CODE | 01100101 |
Converted ASCII code | 01010011 |
NEW ASCII character | S |
Character | r |
---|---|
Original ASCII CODE | 01110010 |
Converted ASCII code | 01000100 |
NEW ASCII character | D |
The encrypted message would display 鈥榰Y[FCBSD鈥.
To decrypt a message, repeat the method using the same 8-bit binary pattern.
More guides on this topic
- The CPU - Eduqas
- Primary storage - Eduqas
- Secondary storage and embedded systems - Eduqas
- Networks - Eduqas
- Data representation - Eduqas
- Storage and data organisation - Eduqas
- Operating systems - Eduqas
- Principles of programming - Eduqas
- Algorithms - Eduqas
- Sorting, searching and validation - Eduqas
- Software development - Eduqas
- Impacts of digital technology on wider society - Eduqas