-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
212 lines (161 loc) · 8.8 KB
/
index.html
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title> Home</title>
<script src="https://cdn.jsdelivr.net/gh/google/code-prettify@master/loader/run_prettify.js"></script>
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
<script src="./build/entry.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link href="https://fonts.googleapis.com/css?family=Roboto:100,400,700|Inconsolata,700" rel="stylesheet">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
<link type="text/css" rel="stylesheet" href="https://jmblog.github.io/color-themes-for-google-code-prettify/themes/tomorrow-night.min.css">
<link type="text/css" rel="stylesheet" href="styles/app.min.css">
<link type="text/css" rel="stylesheet" href="styles/iframe.css">
<link type="text/css" rel="stylesheet" href="">
<script async defer src="https://buttons.github.io/buttons.js"></script>
</head>
<body class="layout small-header">
<div id="stickyNavbarOverlay"></div>
<div class="top-nav">
<div class="inner">
<a id="hamburger" role="button" class="navbar-burger" aria-label="menu" aria-expanded="false">
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
</a>
<div class="logo">
<a href="index.html">
<h1 class="navbar-item">Encryption tool</h1>
</a>
</div>
<div class="menu">
<div class="navigation">
<a
href="index.html"
class="link"
>
API Documentation
</a>
</div>
</div>
</div>
</div>
<div id="main">
<div
class="sidebar "
id="sidebarNav"
>
<nav>
<h2><a href="index.html">Documentation</a></h2><div class="category"><h3>Classes</h3><ul><li><a href="Feistel.html">Feistel</a></li><li><a href="SessionManager.html">SessionManager</a></li></ul><h3>Components</h3><ul><li><a href="App.html">App</a></li><li><a href="Footer.html">Footer</a></li><li><a href="Header.html">Header</a></li><li><a href="Login.html">Login</a></li><li><a href="Main.html">Main</a></li><li><a href="MainLayout.html">MainLayout</a></li><li><a href="Selector.html">Selector</a></li><li><a href="TextArea.html">TextArea</a></li></ul><h3>Global</h3><ul><li><a href="global.html#openNotification">openNotification</a></li></ul></div><div class="category"><h2>Constants</h2><h3>Global</h3><ul><li><a href="global.html#BITWISE_FUNCTIONS">BITWISE_FUNCTIONS</a></li></ul></div><div class="category"><h2>Utils</h2><h3>Global</h3><ul><li><a href="global.html#base64ToUTF16">base64ToUTF16</a></li><li><a href="global.html#binaryToText">binaryToText</a></li><li><a href="global.html#decimalToBinary">decimalToBinary</a></li><li><a href="global.html#enableTabulatorInTextArea">enableTabulatorInTextArea</a></li><li><a href="global.html#from8BitBinaryToUnicode">from8BitBinaryToUnicode</a></li><li><a href="global.html#generateKey">generateKey</a></li><li><a href="global.html#getBitWiseFunc">getBitWiseFunc</a></li><li><a href="global.html#textToBinary">textToBinary</a></li><li><a href="global.html#textToUnicodeDecimalArray">textToUnicodeDecimalArray</a></li><li><a href="global.html#unicodeTo8BitBinary">unicodeTo8BitBinary</a></li><li><a href="global.html#UTF16ToBase64">UTF16ToBase64</a></li></ul></div>
</nav>
</div>
<div class="core" id="main-content-wrapper">
<div class="content">
<header class="page-title">
<p></p>
<h1>Home</h1>
</header>
<h3> </h3>
<section>
<article><h1>Cipher</h1>
<p><em>This is an ecnryption tool that implements Feistel Cipher and allows to encrypt and decrypt any text string - inluding all languages characters, symbols and emojis.</em></p>
<h3>Links</h3>
<h4><strong><a href="https://www.cipher.ovh/">Demo</a></strong></h4>
<h4><strong><a href="https://www.cipher.ovh/docs">Documentation</a></strong></h4>
<h3>Motivation</h3>
<p>This tool was created for the recruitment process and as a portfolio. As well to to learn and improve programming skills.</p>
<h3>Password</h3>
<blockquote>
<p><strong>Password</strong> : <em>admin</em></p>
</blockquote>
<p>As mentioned above, this tool was created for the recruitment process which required logging in, thus the password is made public.</p>
<h2>Feistel Cipher implementation</h2>
<p>You can read how Feistel Cipher works on <a href="https://en.wikipedia.org/wiki/Feistel_cipher">Wikipedia</a></p>
<p>Diagram below shows basic usage:</p>
<p><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/f/fa/Feistel_cipher_diagram_en.svg/410px-Feistel_cipher_diagram_en.svg.png" alt="enter image description here"></p>
<h3>Algorithm assumptions:</h3>
<ul>
<li>Encrypting function F defined as one of:
<ul>
<li>xor</li>
<li>or</li>
<li>and</li>
<li>signed right shift</li>
</ul>
</li>
<li>Round-dependant key (sub-key) creation function:
<ol>
<li>Define master key as hashed user provided key (string) with sh256 hash function truncated to 64bit hash</li>
<li>Round subkey is defined as sha256 of <em>master key</em> + <em>round number</em> + <em>round number to the power of 37</em> truncated to 64bit hash</li>
</ol>
</li>
<li>Every character is represented in 16bit format</li>
<li>Every block size has size of 128bit</li>
<li>Key size is 64bit</li>
<li>Padding character is defined as Unicode End of Text (\u0003)</li>
<li>In order to provide user friendly encrypted text, result of algorithm is converted to Base64 on input and output.</li>
</ul>
<h3>Algorithm steps:</h3>
<h5>Encryption</h5>
<ol>
<li>Divide input string into 128bit blocks
<ul>
<li>Due to asumptions every single block has 8 characters (block size 128bit / char size 16bit)</li>
<li>Last block is filled with padding character when necessary - less than 8 characters</li>
</ul>
</li>
<li>Every block is processed separately</li>
<li>Each block input text is converted to binary represantation</li>
<li>Core Feistel Cipher alhorithm is executed
<ul>
<li>Binary input is split into two equal pieces</li>
<li>In each round right halft of the block goes through unchanged and becomes new left</li>
<li>Left half is XOR-ed with output of encryption function F that takes right side and round key as parameters - result of that becomes new left</li>
<li>Once the last round is completed - right side is swapped with left.</li>
</ul>
</li>
<li>Concatenate results from each block converted back to UTF16 string as final cipher</li>
</ol>
<h5>Decryption</h5>
<ol>
<li>Same as encryption process but order of applied keys is reversed.</li>
<li>Possible padding characters (\u0003) are removed from final text.</li>
</ol>
<h3>Tests</h3>
<p>Cipher app includes unit tests created with <a href="https://jestjs.io/">JEST.js</a></p>
<h3>Documentation</h3>
<p>Documentation created with <a href="https://jsdoc.app/">JSDoc</a></p>
<p>Available at <strong><a href="https://www.cipher.ovh/docs/">cipher.ovh/docs</a></strong></p>
<h3>Available Scripts</h3>
<pre class="prettyprint source"><code>npm run start - Runs the app in the development mode
npm run test - Runs all tests
npm run build - Builds the app for production to the build folder
npm run docs - Generates docs in docs folder
</code></pre>
<hr>
<p>© May 2021 Patryk Bura</p></article>
</section>
</div>
<footer class="footer">
<div class="content has-text-centered">
<p>Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.7</a></p>
<p class="sidebar-created-by">
<a href="https://github.com/SoftwareBrothers/better-docs" target="_blank">BetterDocs theme</a> provided with <i class="fas fa-heart"></i> by
<a href="http://softwarebrothers.co" target="_blank">SoftwareBrothers - JavaScript Development Agency</a>
</p>
</div>
</footer>
</div>
<div id="side-nav" class="side-nav">
</div>
</div>
<script src="scripts/app.min.js"></script>
<script>PR.prettyPrint();</script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>