Gitlab CSE Unil

help_cleartext.html 7.3 KB
Newer Older
M. Chardon's avatar
M. Chardon committed
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<div class="modal-dialog modal-lg">

    <!-- Modal content-->
    <div class="modal-content">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal">&times;</button>
            <h4 class="modal-title"><span class="i18n" data-lang="menu_help"></span></h4>
        </div>
        <div class="modal-body">
            <h4>Encrypt text:</h4>
            <ol>
                <li>Normalization in order to remove spaces and punctuation.</li>
                <li>Choose a key. The key length must be (much) smaller than the length of the plaintext. A long text and a short key will make it easier to decipher the message.</li>
            </ol>
            <hr/>
            <h4 style="padding-top: 10px;">Example:</h4>
            <p>Key: SECRET</p>
            <table class="table table-striped">
                <tr>
                    <td></td>
                    <td style="padding-left: 10px;">
                        A la fin, il ne peut en rester qu’un
                    </td>
                </tr>
                <tr>
                    <td>Message</td>
                    <td style="padding-left: 10px;font-family: 'Lucida Grande,Lucida Sans,Arial',monospace">
                        A&nbsp;&nbsp;L&nbsp;&nbsp;A&nbsp;&nbsp;F&nbsp;&nbsp;I&nbsp;&nbsp;&nbsp;&nbsp;N&nbsp;&nbsp;I&nbsp;&nbsp;L&nbsp;&nbsp;N&nbsp;&nbsp;E&nbsp;&nbsp;&nbsp;&nbsp;P&nbsp;&nbsp;E&nbsp;&nbsp;U&nbsp;&nbsp;T&nbsp;&nbsp;E&nbsp;&nbsp;&nbsp;&nbsp;N&nbsp;&nbsp;R&nbsp;&nbsp;E&nbsp;&nbsp;S&nbsp;&nbsp;T&nbsp;&nbsp;&nbsp;&nbsp;E&nbsp;&nbsp;R&nbsp;&nbsp;Q&nbsp;&nbsp;U&nbsp;&nbsp;U&nbsp;&nbsp;&nbsp;&nbsp;N&nbsp;&nbsp;
                    </td>
                </tr>
                <tr>
                    <td>Key</td>
                    <td style="padding-left: 10px;font-family: 'Lucida Grande,Lucida Sans,Arial',monospace">
                        S&nbsp;&nbsp;E&nbsp;&nbsp;C&nbsp;&nbsp;R&nbsp;&nbsp;E&nbsp;&nbsp;&nbsp;&nbsp;T&nbsp;&nbsp;S&nbsp;&nbsp;E&nbsp;&nbsp;C&nbsp;&nbsp;R&nbsp;&nbsp;&nbsp;&nbsp;E&nbsp;&nbsp;T&nbsp;&nbsp;S&nbsp;&nbsp;E&nbsp;&nbsp;C&nbsp;&nbsp;&nbsp;&nbsp;R&nbsp;&nbsp;E&nbsp;&nbsp;T&nbsp;&nbsp;S&nbsp;&nbsp;E&nbsp;&nbsp;&nbsp;&nbsp;C&nbsp;&nbsp;R&nbsp;&nbsp;E&nbsp;&nbsp;T&nbsp;&nbsp;S&nbsp;&nbsp;&nbsp;&nbsp;E
                    </td>
                </tr>
            </table>
            <p>Letters are added together using an addition table based on the alphabetical order.</p>
            <div class="alert alert-info">
                <strong>Example:</strong> A (0) + S (18) = S (18)
            </div>
            <p>When the addition exceeds Z (25), we start again at the beginning of the alphabet, like if all characters were written on a circle.</p>
            <div class="alert alert-info">
                <strong>Example:</strong> N (13) + T (19) = G (32 / 6)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;32-26 = 6
            </div>
            <table class="table table-striped">
                <tr>
                    <td>Plaintext</td>
                    <td style="padding-left: 10px;font-family: 'Lucida Grande,Lucida Sans,Arial',monospace">
                        A&nbsp;&nbsp;L&nbsp;&nbsp;A&nbsp;&nbsp;F&nbsp;&nbsp;I&nbsp;&nbsp;&nbsp;&nbsp;N&nbsp;&nbsp;I&nbsp;&nbsp;L&nbsp;&nbsp;N&nbsp;&nbsp;E&nbsp;&nbsp;&nbsp;&nbsp;P&nbsp;&nbsp;E&nbsp;&nbsp;U&nbsp;&nbsp;T&nbsp;&nbsp;E&nbsp;&nbsp;&nbsp;&nbsp;N&nbsp;&nbsp;R&nbsp;&nbsp;E&nbsp;&nbsp;S&nbsp;&nbsp;T&nbsp;&nbsp;&nbsp;&nbsp;E&nbsp;&nbsp;R&nbsp;&nbsp;Q&nbsp;&nbsp;U&nbsp;&nbsp;U&nbsp;&nbsp;&nbsp;&nbsp;N&nbsp;&nbsp;
                    </td>
                </tr>
                <tr>
                    <td>Key</td>
                    <td style="padding-left: 10px;font-family: 'Lucida Grande,Lucida Sans,Arial',monospace">
                        S&nbsp;&nbsp;E&nbsp;&nbsp;C&nbsp;&nbsp;R&nbsp;&nbsp;E&nbsp;&nbsp;&nbsp;&nbsp;T&nbsp;&nbsp;S&nbsp;&nbsp;E&nbsp;&nbsp;C&nbsp;&nbsp;R&nbsp;&nbsp;&nbsp;&nbsp;E&nbsp;&nbsp;T&nbsp;&nbsp;S&nbsp;&nbsp;E&nbsp;&nbsp;C&nbsp;&nbsp;&nbsp;&nbsp;R&nbsp;&nbsp;E&nbsp;&nbsp;T&nbsp;&nbsp;S&nbsp;&nbsp;E&nbsp;&nbsp;&nbsp;&nbsp;C&nbsp;&nbsp;R&nbsp;&nbsp;E&nbsp;&nbsp;T&nbsp;&nbsp;S&nbsp;&nbsp;&nbsp;&nbsp;E
                    </td>
                </tr>
                <tr>
                    <td>Ciphertext</td>
                    <td style="padding-left: 10px;font-family: 'Lucida Grande,Lucida Sans,Arial',monospace">
                        S&nbsp;&nbsp;P&nbsp;&nbsp;C&nbsp;&nbsp;W&nbsp;&nbsp;M&nbsp;&nbsp;&nbsp;&nbsp;G&nbsp;&nbsp;A&nbsp;&nbsp;P&nbsp;&nbsp;P&nbsp;&nbsp;V&nbsp;&nbsp;&nbsp;&nbsp;T&nbsp;&nbsp;X&nbsp;&nbsp;M&nbsp;&nbsp;X&nbsp;&nbsp;G&nbsp;&nbsp;&nbsp;&nbsp;E&nbsp;&nbsp;V&nbsp;&nbsp;X&nbsp;&nbsp;K&nbsp;&nbsp;X&nbsp;&nbsp;&nbsp;&nbsp;G&nbsp;&nbsp;I&nbsp;&nbsp;U&nbsp;&nbsp;N&nbsp;&nbsp;M&nbsp;&nbsp;&nbsp;&nbsp;R
                    </td>
                </tr>
            </table>
            <p>We can use the Vigenère table in order to avoid the calculations.</p>
            <hr/>
            <div class="panel-group" style="padding-top: 10px;">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h4 class="panel-title">
                            <a data-toggle="collapse" href="#collapseh1">Potential addition for those wanting to go further</a>
                        </h4>
                    </div>
                    <div id="collapseh1" class="panel-collapse collapse">
                        <div class="panel-body">
                            <h5>The modulo calculus works with the remainder of the Euclidean division:</h5>
                            A / B = Q + R&nbsp;&nbsp;&nbsp;&nbsp;A ≡ R (modulo B)<br/>
                            <h5>Observation about the modulo:</h5>
                            <table>
                                <tr>
                                    <td style='padding-left: 20px;'>0/3 = 0 remainder 0</td>
                                    <td style='padding-left: 20px;'>0 ≡ 0 (modulo 3)</td>
                                </tr>
                                <tr>
                                    <td style='padding-left: 20px;'>1/3 = 0 remainder 1</td>
                                    <td style='padding-left: 20px;'>1 ≡ 1 (modulo 3)</td>
                                </tr>
                                <tr>
                                    <td style='padding-left: 20px;'>2/3 = 0 remainder 2</td>
                                    <td style='padding-left: 20px;'>2 ≡ 2 (modulo 3)</td>
                                </tr>
                                <tr>
                                    <td style='padding-left: 20px;'>3/3 = 1 remainder 0</td>
                                    <td style='padding-left: 20px;'>3 ≡ 0 (modulo 3)</td>
                                </tr>
                                <tr>
                                    <td style='padding-left: 20px;'>4/3 = 1 remainder 1</td>
                                    <td style='padding-left: 20px;'>4 ≡ 1 (modulo 3)</td>
                                </tr>
                            </table>
                            <p>With the alphabet, we work modulo 26</p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="modal-footer">
            <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        </div> 
    </div>
</div>