diff --git a/doc/source/basicgameplay/codingcontracts.rst b/doc/source/basicgameplay/codingcontracts.rst index e8fdabbd9..7dacae18e 100644 --- a/doc/source/basicgameplay/codingcontracts.rst +++ b/doc/source/basicgameplay/codingcontracts.rst @@ -370,3 +370,35 @@ The list contains the name of (i.e. the value returned by | | | aaaaaaaaaaaaa -> 1a91031 | | | | aaaaaaaaaaaaaa -> 1a91041 | +-----------------------------------------+------------------------------------------------------------------------------------------+ +| Encryption I: Caesar Cipher | | Caesar cipher is one of the simplest encryption technique. It is a type of | +| | | substitution cipher in which each letter in the plaintext is replaced by a letter some | +| | | fixed number of positions down the alphabet. For example, with a left shift of 3, D | +| | | would be replaced by A, E would become B, and A would become X (because of rotation). | +| | | You are given the an array with two elements.The first element is the plaintext, the | +| | | second element is the left shift value. Return the ciphertext as uppercase string. | +| | | Spaces remains the same. | ++-----------------------------------------+------------------------------------------------------------------------------------------+ +| Encryption II: Vigenère Cipher | | Vigenère cipher is a type of polyalphabetic substitution. It uses the Vigenère square | +| | | to encrypt and decrypt plaintext with a keyword. | +| | | Vignenère square: | +| | | A B C D E F G H I J K L M N O P Q R S T U V W X Y Z | +| | | +---------------------------------------------------- | +| | | A | A B C D E F G H I J K L M N O P Q R S T U V W X Y Z | +| | | B | B C D E F G H I J K L M N O P Q R S T U V W X Y Z A | +| | | C | C D E F G H I J K L M N O P Q R S T U V W X Y Z A B | +| | | D | D E F G H I J K L M N O P Q R S T U V W X Y Z A B C | +| | | E | E F G H I J K L M N O P Q R S T U V W X Y Z A B C D | +| | | ... | +| | | Y | Y Z A B C D E F G H I J K L M N O P Q R S T U V W X | +| | | Z | Z A B C D E F G H I J K L M N O P Q R S T U V W X Y | +| | | For encryption each letter of the plaintext is paired with the corresponding letter of | +| | | a repeating keyword. For example, the plaintext DASHBOARD is encrypted with the | +| | | keyword LINUX: | +| | | Plaintext: DASHBOARD | +| | | Keyword: LINUXLINU | +| | | So, the first letter D is paired with the first letter of the key L. Therefore, row D | +| | | and column L of the Vigenère square are used to get the first cipher letter O. This | +| | | must be repeated for the whole ciphertext. | +| | | You are given an array with two elements. The first element is the plaintext, the | +| | | second element is the keyword. Return the ciphertext as uppercase string. | ++-----------------------------------------+------------------------------------------------------------------------------------------+ diff --git a/src/data/codingcontracttypes.ts b/src/data/codingcontracttypes.ts index 5effe8d73..48b16ae17 100644 --- a/src/data/codingcontracttypes.ts +++ b/src/data/codingcontracttypes.ts @@ -1618,9 +1618,9 @@ export const codingContractTypesMetadata: ICodingContractTypeMetadata[] = [ "is replaced by a letter some fixed number of positions down the alphabet.", "For example, with a left shift of 3, D would be replaced by A, ", "E would become B, and A would become X (because of rotation).\n\n", - "You are given the following plaintext\n", - `  ${data[0]}\n`, - `and a left shift of ${data[1]}\n\n`, + "You are given the an array with two elements:\n", + `  ["${data[0]}", ${data[1]}]\n`, + "The first element is the plaintext, the second element is the left shift value.\n\n", "Return the ciphertext as uppercase string. Spaces remains the same.", ].join(" "); }, @@ -1659,7 +1659,7 @@ export const codingContractTypesMetadata: ICodingContractTypeMetadata[] = [ .sort(() => Math.random() - 0.5) .slice(0, 5) .join(" "), - Math.floor(Math.random() * 26), + Math.floor(Math.random() * 25 + 1), ]; }, name: "Encryption I: Caesar Cipher", @@ -1695,9 +1695,9 @@ export const codingContractTypesMetadata: ICodingContractTypeMetadata[] = [ "   Keyword:   LINUXLINU\n", "So, the first letter D is paired with the first letter of the key L. Therefore, row D and column L of the ", "Vigenère square are used to get the first cipher letter O. This must be repeated for the whole ciphertext.\n\n", - "You are given the following plaintext\n", - `  ${data[0]}\n`, - `and a keyword ${data[1]}\n\n`, + "You are given an array with two elements:\n", + `  ["${data[0]}", "${data[1]}"]\n`, + "The first element is the plaintext, the second element is the keyword.\n\n", "Return the ciphertext as uppercase string.", ].join(" "); },