forked from exercism/problem-specifications
-
Notifications
You must be signed in to change notification settings - Fork 0
/
crypto-square.json
97 lines (97 loc) · 3.16 KB
/
crypto-square.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
{
"normalized_plaintext": {
"description": "the spaces and punctuation are removed from the English text and the message is downcased",
"cases": [
{
"description": "Lowercase",
"plaintext": "Hello",
"expected": "hello"
},
{
"description": "Remove spaces",
"plaintext": "Hi there",
"expected": "hithere"
},
{
"description": "Remove punctuation",
"plaintext": "@1, 2%, 3 Go!",
"expected": "123go"
}
]
},
"plaintext_segments": {
"description": "The plaintext should be organized in to a rectangle. The size of the rectangle (`r x c`) should be decided by the length of the message, such that `c >= r` and `c - r <= 1`, where `c` is the number of columns and `r` is the number of rows.",
"cases": [
{
"description": "empty plaintext results in an empty rectangle",
"plaintext": "",
"expected": "[]"
},
{
"description": "4 character plaintext results in an 2x2 rectangle",
"plaintext": "Ab Cd",
"expected": [
"ab",
"cd"
]
},
{
"description": "9 character plaintext results in an 3x3 rectangle",
"plaintext": "This is fun!",
"expected": [
"thi",
"sis",
"fun"
]
},
{
"description": "54 character plaintext results in an 8x7 rectangle",
"plaintext": "If man was meant to stay on the ground, god would have given us roots.",
"expected": [
"ifmanwas",
"meanttos",
"tayonthe",
"groundgo",
"dwouldha",
"vegivenu",
"sroots"
]
}
]
},
"encoded": {
"description": "The coded message is obtained by reading down the columns going left to right.",
"cases": [
{
"description": "empty plaintext results in an empty encode",
"plaintext": "",
"expected": ""
},
{
"description": "Non-empty plaintext results in the combined plaintext segments",
"plaintext": "If man was meant to stay on the ground, god would have given us roots.",
"expected": "imtgdvsfearwermayoogoanouuiontnnlvtwttddesaohghnsseoau"
}
]
},
"ciphertext": {
"description": "Output the encoded text in chunks. Phrases that fill perfect squares `(r X r)` should be output in `r`-length chunks separated by spaces. Imperfect squares will have `n` empty spaces. Those spaces should be distributed evenly across the last `n` rows.",
"cases": [
{
"description": "empty plaintext results in an empty ciphertext",
"plaintext": "",
"expected": ""
},
{
"description": "9 character plaintext results in 3 chunks of 3 characters",
"plaintext": "This is fun!",
"expected": "tsf hiu isn"
},
{
"description": "54 character plaintext results in 7 chunks, the last two padded with spaces",
"plaintext": "If man was meant to stay on the ground, god would have given us roots.",
"expected": "imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn sseoau "
}
]
}
}