Documentation for 341ed50da8

This commit is contained in:
github-actions
2021-09-03 19:56:17 +00:00
parent 52d0c55145
commit 08e8eb037e
3432 changed files with 71392 additions and 72953 deletions

View File

@@ -2,8 +2,8 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.2"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Algorithms_in_C++: ciphers/xor_cipher.cpp File Reference</title>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
@@ -17,9 +17,9 @@
<script type="text/javascript" src="../../search/searchdata.js"></script>
<script type="text/javascript" src="../../search/search.js"></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
jax: ["input/TeX","output/HTML-CSS"],
MathJax.Hub.Config({
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
jax: ["input/TeX","output/HTML-CSS"],
});
</script>
<script type="text/javascript" async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML/MathJax.js"></script>
@@ -32,8 +32,7 @@
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">Algorithms_in_C++
&#160;<span id="projectnumber">1.0.0</span>
<div id="projectname">Algorithms_in_C++<span id="projectnumber">&#160;1.0.0</span>
</div>
<div id="projectbrief">Set of algorithms implemented in C++.</div>
</td>
@@ -42,21 +41,22 @@
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<!-- Generated by Doxygen 1.9.2 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "../../search",false,'Search','.html');
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "../../search",'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="../../menudata.js"></script>
<script type="text/javascript" src="../../menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
initMenu('../../',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
@@ -70,7 +70,7 @@ $(function() {
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('d3/d4c/xor__cipher_8cpp.html','../../'); initResizable(); });
/* @license-end */
</script>
@@ -93,12 +93,11 @@ $(document).ready(function(){initNavTree('d3/d4c/xor__cipher_8cpp.html','../../'
<div class="summary">
<a href="#namespaces">Namespaces</a> &#124;
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">xor_cipher.cpp File Reference</div> </div>
<div class="headertitle"><div class="title">xor_cipher.cpp File Reference</div></div>
</div><!--header-->
<div class="contents">
<p>Implementation of <a href="https://en.wikipedia.org/wiki/XOR_cipher">XOR cipher</a> algorithm.
<p>Implementation of <a href="https://en.wikipedia.org/wiki/XOR_cipher" target="_blank">XOR cipher</a> algorithm.
<a href="#details">More...</a></p>
<div class="textblock"><code>#include &lt;iostream&gt;</code><br />
<code>#include &lt;string&gt;</code><br />
@@ -110,16 +109,16 @@ Include dependency graph for xor_cipher.cpp:</div>
</div>
</div>
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="namespaces"></a>
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="namespaces" name="namespaces"></a>
Namespaces</h2></td></tr>
<tr class="memitem:d6/d4e/namespaceciphers"><td class="memItemLeft" align="right" valign="top"> &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d6/d4e/namespaceciphers.html">ciphers</a></td></tr>
<tr class="memdesc:d6/d4e/namespaceciphers"><td class="mdescLeft">&#160;</td><td class="mdescRight"><a href="https://en.wikipedia.org/wiki/Base64">Base64 Encoding and Decoding</a> <br /></td></tr>
<tr class="memitem:d6/d4e/namespaceciphers"><td class="memItemLeft" align="right" valign="top">namespace &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d6/d4e/namespaceciphers.html">ciphers</a></td></tr>
<tr class="memdesc:d6/d4e/namespaceciphers"><td class="mdescLeft">&#160;</td><td class="mdescRight"><a href="https://en.wikipedia.org/wiki/Base64" target="_blank">Base64 Encoding and Decoding</a> <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:d7/d47/namespace_x_o_r"><td class="memItemLeft" align="right" valign="top"> &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d7/d47/namespace_x_o_r.html">XOR</a></td></tr>
<tr class="memdesc:d7/d47/namespace_x_o_r"><td class="mdescLeft">&#160;</td><td class="mdescRight">Functions for <a href="https://en.wikipedia.org/wiki/XOR_cipher">XOR cipher</a> algorithm. <br /></td></tr>
<tr class="memitem:d7/d47/namespace_x_o_r"><td class="memItemLeft" align="right" valign="top">namespace &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d7/d47/namespace_x_o_r.html">XOR</a></td></tr>
<tr class="memdesc:d7/d47/namespace_x_o_r"><td class="mdescLeft">&#160;</td><td class="mdescRight">Functions for <a href="https://en.wikipedia.org/wiki/XOR_cipher" target="_blank">XOR cipher</a> algorithm. <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:aeff72a463ffc580c16cc849cbbdc58ef"><td class="memItemLeft" align="right" valign="top"><a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/d4c/xor__cipher_8cpp.html#aeff72a463ffc580c16cc849cbbdc58ef">ciphers::XOR::encrypt</a> (const <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> &amp;text, const int &amp;key)</td></tr>
<tr class="separator:aeff72a463ffc580c16cc849cbbdc58ef"><td class="memSeparator" colspan="2">&#160;</td></tr>
@@ -131,22 +130,22 @@ Functions</h2></td></tr>
<tr class="separator:ae66f6b31b5ad750f1fe042a706a4e3d4"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Implementation of <a href="https://en.wikipedia.org/wiki/XOR_cipher">XOR cipher</a> algorithm. </p>
<p>In cryptography, the simple <a class="el" href="../../d7/d47/namespace_x_o_r.html" title="Functions for XOR cipher algorithm.">XOR</a> cipher is a type of additive cipher, an encryption algorithm that operates according to the principles:</p>
<div class="textblock"><p >Implementation of <a href="https://en.wikipedia.org/wiki/XOR_cipher" target="_blank">XOR cipher</a> algorithm. </p>
<p >In cryptography, the simple <a class="el" href="../../d7/d47/namespace_x_o_r.html" title="Functions for XOR cipher algorithm.">XOR</a> cipher is a type of additive cipher, an encryption algorithm that operates according to the principles:</p>
<ul>
<li>\(A {\oplus} 0 = A\)</li>
<li>\(A {\oplus} A = 0\)</li>
<li>\( (A {\oplus} B) {\oplus} C = A {\oplus} (B {\oplus} C)\)</li>
<li>\( (B {\oplus} A) {\oplus} B = B {\oplus} 0 = B \)</li>
</ul>
<p>where \(\oplus\) symbol denotes the exclusive disjunction (<a class="el" href="../../d7/d47/namespace_x_o_r.html" title="Functions for XOR cipher algorithm.">XOR</a>) operation. This operation is sometimes called modulus 2 addition (or subtraction, which is identical). With this logic, a string of text can be encrypted by applying the bitwise <a class="el" href="../../d7/d47/namespace_x_o_r.html" title="Functions for XOR cipher algorithm.">XOR</a> operator to every character using a given key. To decrypt the output, merely reapplying the <a class="el" href="../../d7/d47/namespace_x_o_r.html" title="Functions for XOR cipher algorithm.">XOR</a> function with the key will remove the cipher.</p>
<p >where \(\oplus\) symbol denotes the exclusive disjunction (<a class="el" href="../../d7/d47/namespace_x_o_r.html" title="Functions for XOR cipher algorithm.">XOR</a>) operation. This operation is sometimes called modulus 2 addition (or subtraction, which is identical). With this logic, a string of text can be encrypted by applying the bitwise <a class="el" href="../../d7/d47/namespace_x_o_r.html" title="Functions for XOR cipher algorithm.">XOR</a> operator to every character using a given key. To decrypt the output, merely reapplying the <a class="el" href="../../d7/d47/namespace_x_o_r.html" title="Functions for XOR cipher algorithm.">XOR</a> function with the key will remove the cipher.</p>
<h3><a class="anchor" id="autotoc_md2"></a>
Algorithm</h3>
<p>Choose the key for encryption and apply <a class="el" href="../../d7/d47/namespace_x_o_r.html" title="Functions for XOR cipher algorithm.">XOR</a> operation to each character of a string. Reapplying <a class="el" href="../../d7/d47/namespace_x_o_r.html" title="Functions for XOR cipher algorithm.">XOR</a> operation to each character of encrypted string will give original string back.</p>
<p >Choose the key for encryption and apply <a class="el" href="../../d7/d47/namespace_x_o_r.html" title="Functions for XOR cipher algorithm.">XOR</a> operation to each character of a string. Reapplying <a class="el" href="../../d7/d47/namespace_x_o_r.html" title="Functions for XOR cipher algorithm.">XOR</a> operation to each character of encrypted string will give original string back.</p>
<dl class="section note"><dt>Note</dt><dd>This program implements <a class="el" href="../../d7/d47/namespace_x_o_r.html" title="Functions for XOR cipher algorithm.">XOR</a> Cipher for string with ASCII characters.</dd></dl>
<dl class="section author"><dt>Author</dt><dd><a href="https://github.com/imdeep2905">Deep Raval</a> </dd></dl>
<dl class="section author"><dt>Author</dt><dd><a href="https://github.com/imdeep2905" target="_blank">Deep Raval</a> </dd></dl>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="a6099b7e0f1793f418d2c1befca8355a4"></a>
<a id="a6099b7e0f1793f418d2c1befca8355a4" name="a6099b7e0f1793f418d2c1befca8355a4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6099b7e0f1793f418d2c1befca8355a4">&#9670;&nbsp;</a></span>decrypt()</h2>
<div class="memitem">
@@ -171,7 +170,7 @@ Algorithm</h3>
</tr>
</table>
</div><div class="memdoc">
<p>Decrypt given text using <a class="el" href="../../d7/d47/namespace_x_o_r.html" title="Functions for XOR cipher algorithm.">XOR</a> cipher. </p><dl class="params"><dt>Parameters</dt><dd>
<p >Decrypt given text using <a class="el" href="../../d7/d47/namespace_x_o_r.html" title="Functions for XOR cipher algorithm.">XOR</a> cipher. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">text</td><td>text to be encrypted </td></tr>
<tr><td class="paramname">key</td><td>to be used for decryption </td></tr>
@@ -179,19 +178,19 @@ Algorithm</h3>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>new decrypted text </dd></dl>
<div class="fragment"><div class="line"><a name="l00061"></a><span class="lineno"> 61</span>&#160; {</div>
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>&#160; <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> decrypted_text = <span class="stringliteral">&quot;&quot;</span>; <span class="comment">// Empty string to store decrypted text</span></div>
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span>&#160; <span class="keywordflow">for</span> (<span class="keyword">auto</span> &amp;c : text) { <span class="comment">// Going through each character</span></div>
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>&#160; <span class="keywordtype">char</span> decrypted_char = char(c ^ key); <span class="comment">// Applying decryption</span></div>
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>&#160; decrypted_text += decrypted_char; <span class="comment">// Appending decrypted character</span></div>
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>&#160; }</div>
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span>&#160; <span class="keywordflow">return</span> decrypted_text; <span class="comment">// Returning decrypted text</span></div>
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>&#160; }</div>
<div class="fragment"><div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span> {</div>
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> decrypted_text = <span class="stringliteral">&quot;&quot;</span>; <span class="comment">// Empty string to store decrypted text</span></div>
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span> <span class="keywordflow">for</span> (<span class="keyword">auto</span> &amp;c : text) { <span class="comment">// Going through each character</span></div>
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span> <span class="keywordtype">char</span> decrypted_char = char(c ^ key); <span class="comment">// Applying decryption</span></div>
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span> decrypted_text += decrypted_char; <span class="comment">// Appending decrypted character</span></div>
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"> 66</span> }</div>
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"> 67</span> <span class="keywordflow">return</span> decrypted_text; <span class="comment">// Returning decrypted text</span></div>
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno"> 68</span> }</div>
<div class="ttc" id="abasic_string_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a></div></div>
</div><!-- fragment -->
</div>
</div>
<a id="aeff72a463ffc580c16cc849cbbdc58ef"></a>
<a id="aeff72a463ffc580c16cc849cbbdc58ef" name="aeff72a463ffc580c16cc849cbbdc58ef"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aeff72a463ffc580c16cc849cbbdc58ef">&#9670;&nbsp;</a></span>encrypt()</h2>
<div class="memitem">
@@ -216,7 +215,7 @@ Algorithm</h3>
</tr>
</table>
</div><div class="memdoc">
<p>Encrypt given text using <a class="el" href="../../d7/d47/namespace_x_o_r.html" title="Functions for XOR cipher algorithm.">XOR</a> cipher. </p><dl class="params"><dt>Parameters</dt><dd>
<p >Encrypt given text using <a class="el" href="../../d7/d47/namespace_x_o_r.html" title="Functions for XOR cipher algorithm.">XOR</a> cipher. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">text</td><td>text to be encrypted </td></tr>
<tr><td class="paramname">key</td><td>to be used for encyption </td></tr>
@@ -224,18 +223,18 @@ Algorithm</h3>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>new encrypted text </dd></dl>
<div class="fragment"><div class="line"><a name="l00047"></a><span class="lineno"> 47</span>&#160; {</div>
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span>&#160; <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> encrypted_text = <span class="stringliteral">&quot;&quot;</span>; <span class="comment">// Empty string to store encrypted text</span></div>
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span>&#160; <span class="keywordflow">for</span> (<span class="keyword">auto</span> &amp;c: text) { <span class="comment">// Going through each character</span></div>
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span>&#160; <span class="keywordtype">char</span> encrypted_char = char(c ^ key); <span class="comment">// Applying encyption</span></div>
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>&#160; encrypted_text += encrypted_char; <span class="comment">// Appending encrypted character</span></div>
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span>&#160; }</div>
<div class="line"><a name="l00053"></a><span class="lineno"> 53</span>&#160; <span class="keywordflow">return</span> encrypted_text; <span class="comment">// Returning encrypted text</span></div>
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span>&#160; }</div>
<div class="fragment"><div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span> {</div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> encrypted_text = <span class="stringliteral">&quot;&quot;</span>; <span class="comment">// Empty string to store encrypted text</span></div>
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> <span class="keywordflow">for</span> (<span class="keyword">auto</span> &amp;c: text) { <span class="comment">// Going through each character</span></div>
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span> <span class="keywordtype">char</span> encrypted_char = char(c ^ key); <span class="comment">// Applying encyption</span></div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> encrypted_text += encrypted_char; <span class="comment">// Appending encrypted character</span></div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span> }</div>
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span> <span class="keywordflow">return</span> encrypted_text; <span class="comment">// Returning encrypted text</span></div>
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span> }</div>
</div><!-- fragment -->
</div>
</div>
<a id="ae66f6b31b5ad750f1fe042a706a4e3d4"></a>
<a id="ae66f6b31b5ad750f1fe042a706a4e3d4" name="ae66f6b31b5ad750f1fe042a706a4e3d4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae66f6b31b5ad750f1fe042a706a4e3d4">&#9670;&nbsp;</a></span>main()</h2>
<div class="memitem">
@@ -250,12 +249,12 @@ Algorithm</h3>
</tr>
</table>
</div><div class="memdoc">
<p>Driver Code </p>
<div class="fragment"><div class="line"><a name="l00095"></a><span class="lineno"> 95</span>&#160; {</div>
<div class="line"><a name="l00096"></a><span class="lineno"> 96</span>&#160; <span class="comment">// Testing</span></div>
<div class="line"><a name="l00097"></a><span class="lineno"> 97</span>&#160; <a class="code" href="../../d3/d4c/xor__cipher_8cpp.html#ae1a3968e7947464bee7714f6d43b7002">test</a>();</div>
<div class="line"><a name="l00098"></a><span class="lineno"> 98</span>&#160; <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00099"></a><span class="lineno"> 99</span>&#160;}</div>
<p >Driver Code </p>
<div class="fragment"><div class="line"><a id="l00095" name="l00095"></a><span class="lineno"> 95</span> {</div>
<div class="line"><a id="l00096" name="l00096"></a><span class="lineno"> 96</span> <span class="comment">// Testing</span></div>
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno"> 97</span> <a class="code hl_function" href="../../d3/d4c/xor__cipher_8cpp.html#ae1a3968e7947464bee7714f6d43b7002">test</a>();</div>
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno"> 98</span> <span class="keywordflow">return</span> 0;</div>
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno"> 99</span>}</div>
<div class="ttc" id="axor__cipher_8cpp_html_ae1a3968e7947464bee7714f6d43b7002"><div class="ttname"><a href="../../d3/d4c/xor__cipher_8cpp.html#ae1a3968e7947464bee7714f6d43b7002">test</a></div><div class="ttdeci">void test()</div><div class="ttdef"><b>Definition:</b> xor_cipher.cpp:75</div></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
@@ -266,7 +265,7 @@ Here is the call graph for this function:</div>
</div>
</div>
<a id="ae1a3968e7947464bee7714f6d43b7002"></a>
<a id="ae1a3968e7947464bee7714f6d43b7002" name="ae1a3968e7947464bee7714f6d43b7002"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae1a3968e7947464bee7714f6d43b7002">&#9670;&nbsp;</a></span>test()</h2>
<div class="memitem">
@@ -280,25 +279,25 @@ Here is the call graph for this function:</div>
</tr>
</table>
</div><div class="memdoc">
<p>Function to test above algorithm </p>
<div class="fragment"><div class="line"><a name="l00075"></a><span class="lineno"> 75</span>&#160; {</div>
<div class="line"><a name="l00076"></a><span class="lineno"> 76</span>&#160; <span class="comment">// Test 1</span></div>
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span>&#160; <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> text1 = <span class="stringliteral">&quot;Whipalsh! : Do watch this movie...&quot;</span>;</div>
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span>&#160; <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> encrypted1 = <a class="code" href="../../d3/d4c/xor__cipher_8cpp.html#aeff72a463ffc580c16cc849cbbdc58ef">ciphers::XOR::encrypt</a>(text1, 17);</div>
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>&#160; <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> decrypted1 = <a class="code" href="../../d3/d4c/xor__cipher_8cpp.html#a6099b7e0f1793f418d2c1befca8355a4">ciphers::XOR::decrypt</a>(encrypted1, 17);</div>
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>&#160; assert(text1 == decrypted1);</div>
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span>&#160; <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;Original text : &quot;</span> &lt;&lt; text1;</div>
<div class="line"><a name="l00082"></a><span class="lineno"> 82</span>&#160; <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot; , Encrypted text (with key = 17) : &quot;</span> &lt;&lt; encrypted1;</div>
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span>&#160; <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot; , Decrypted text : &quot;</span>&lt;&lt; decrypted1 &lt;&lt; <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span>&#160; <span class="comment">// Test 2</span></div>
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span>&#160; <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> text2 = <span class="stringliteral">&quot;-&gt;Valar M0rghulis&lt;-&quot;</span>;</div>
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span>&#160; <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> encrypted2 = <a class="code" href="../../d3/d4c/xor__cipher_8cpp.html#aeff72a463ffc580c16cc849cbbdc58ef">ciphers::XOR::encrypt</a>(text2, 29);</div>
<div class="line"><a name="l00087"></a><span class="lineno"> 87</span>&#160; <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> decrypted2 = <a class="code" href="../../d3/d4c/xor__cipher_8cpp.html#a6099b7e0f1793f418d2c1befca8355a4">ciphers::XOR::decrypt</a>(encrypted2, 29);</div>
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>&#160; assert(text2 == decrypted2);</div>
<div class="line"><a name="l00089"></a><span class="lineno"> 89</span>&#160; <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;Original text : &quot;</span> &lt;&lt; text2;</div>
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span>&#160; <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot; , Encrypted text (with key = 29) : &quot;</span> &lt;&lt; encrypted2;</div>
<div class="line"><a name="l00091"></a><span class="lineno"> 91</span>&#160; <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot; , Decrypted text : &quot;</span>&lt;&lt; decrypted2 &lt;&lt; <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><a name="l00092"></a><span class="lineno"> 92</span>&#160;}</div>
<p >Function to test above algorithm </p>
<div class="fragment"><div class="line"><a id="l00075" name="l00075"></a><span class="lineno"> 75</span> {</div>
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno"> 76</span> <span class="comment">// Test 1</span></div>
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> text1 = <span class="stringliteral">&quot;Whipalsh! : Do watch this movie...&quot;</span>;</div>
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> encrypted1 = <a class="code hl_function" href="../../d3/d4c/xor__cipher_8cpp.html#aeff72a463ffc580c16cc849cbbdc58ef">ciphers::XOR::encrypt</a>(text1, 17);</div>
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> decrypted1 = <a class="code hl_function" href="../../d3/d4c/xor__cipher_8cpp.html#a6099b7e0f1793f418d2c1befca8355a4">ciphers::XOR::decrypt</a>(encrypted1, 17);</div>
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span> assert(text1 == decrypted1);</div>
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"> 81</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;Original text : &quot;</span> &lt;&lt; text1;</div>
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno"> 82</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot; , Encrypted text (with key = 17) : &quot;</span> &lt;&lt; encrypted1;</div>
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno"> 83</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot; , Decrypted text : &quot;</span>&lt;&lt; decrypted1 &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno"> 84</span> <span class="comment">// Test 2</span></div>
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno"> 85</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> text2 = <span class="stringliteral">&quot;-&gt;Valar M0rghulis&lt;-&quot;</span>;</div>
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno"> 86</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> encrypted2 = <a class="code hl_function" href="../../d3/d4c/xor__cipher_8cpp.html#aeff72a463ffc580c16cc849cbbdc58ef">ciphers::XOR::encrypt</a>(text2, 29);</div>
<div class="line"><a id="l00087" name="l00087"></a><span class="lineno"> 87</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> decrypted2 = <a class="code hl_function" href="../../d3/d4c/xor__cipher_8cpp.html#a6099b7e0f1793f418d2c1befca8355a4">ciphers::XOR::decrypt</a>(encrypted2, 29);</div>
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno"> 88</span> assert(text2 == decrypted2);</div>
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"> 89</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;Original text : &quot;</span> &lt;&lt; text2;</div>
<div class="line"><a id="l00090" name="l00090"></a><span class="lineno"> 90</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot; , Encrypted text (with key = 29) : &quot;</span> &lt;&lt; encrypted2;</div>
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno"> 91</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot; , Decrypted text : &quot;</span>&lt;&lt; decrypted2 &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno"> 92</span>}</div>
<div class="ttc" id="abasic_ostream_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a></div></div>
<div class="ttc" id="aendl_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a></div><div class="ttdeci">T endl(T... args)</div></div>
<div class="ttc" id="axor__cipher_8cpp_html_a6099b7e0f1793f418d2c1befca8355a4"><div class="ttname"><a href="../../d3/d4c/xor__cipher_8cpp.html#a6099b7e0f1793f418d2c1befca8355a4">ciphers::XOR::decrypt</a></div><div class="ttdeci">std::string decrypt(const std::string &amp;text, const int &amp;key)</div><div class="ttdef"><b>Definition:</b> xor_cipher.cpp:61</div></div>
@@ -318,7 +317,7 @@ Here is the call graph for this function:</div>
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="../../dir_4d6e05837bf820fb089a8a8cdf2f42b7.html">ciphers</a></li><li class="navelem"><a class="el" href="../../d3/d4c/xor__cipher_8cpp.html">xor_cipher.cpp</a></li>
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="../../doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1 </li>
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="../../doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.2 </li>
</ul>
</div>
</body>