Encryption is a technique used to transform a string into another such that the algorithm to reverse the transformation is complex and only[citation needed] decipherable by the original encrypter.

## Simple Encryption

### Substitution Cipher

The Substitution Cipher is a simple cipher technique, which involves simply replacing each character in a message with another one, either also part of the alphabet or with a symbol. Some examples are listed below.

#### Cesarean Cipher

This encryption technique was allegedly used in the times of the Roman emperor Julius Caesar who made carriers of the message swear never to reveal the key.[1] A simple encryption program can use the following technique to create a Cesarean Cipher.

• First, convert the string into a list of letters
• Then, iterating through each item of the list, use many If () Then blocks to replace each character with a unique other character
• Finally, join these back into a string and report

To decode, do the same thing, except replace backwards: encrypted values to their keys, rather than keys to values.

This can be used to convert a string like: "Hello world" into "Rqbbwx wmbbf" Note how the lengths of words change. This is because the space was encoded as "X" and "W" was encoded as a space.

## Complex Encryption

Complex encryption systems generally return a fixed length string, no matter how long the input is. These kinds of encryptions, often called hashes, are widely used to securely store passwords in a database.

## Encryption in Scratch

Encryption can be used in lists in Scratch. Suppose a list contains numbers, but one wants those values to be hidden in an encrypted way. A simple method would be the following script:

```set [item# v] to (1) //begin the encryption with the first value
repeat (length of [values v]) //repeat for the amount of numbers that are to be encrypted
replace item (item#) of [values v] with (((item (item#) of [values v]) * (2.463)) + (7.293)) //simple algorithm for encryption
change [item# v] by (1) //move on to the next value in the list
```

Then, to decrypt the values, the algorithm must be reversed:

```set [item# v] to (1)
repeat (length of [values v])
replace item (item#) of [values v] with (((item (item#) of [values v]) - (7.293)) / (2.463))
change [item# v] by (1)
```

Complex numbers with multiple decimal places are used for greater difficulty in deciphering the code. The more mathematical functions and complex numbers are used, the safer the encryption is. Encrypting values in a Scratch project can be difficult to do safely, though, since a user can See Inside and view the encryptor itself. However, if the decipher algorithm is not visible, it may still be difficult do decipher the codes if an intricate algorithm or method was used.

 Warning: No personal information should ever be entered into a Scratch project, even if it is encrypted.