Files
C-Plus-Plus/d3/d4c/xor__cipher_8cpp.html
2020-07-19 20:48:36 +00:00

327 lines
25 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<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.8.18"/>
<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"/>
<script type="text/javascript" src="../../jquery.js"></script>
<script type="text/javascript" src="../../dynsections.js"></script>
<link href="../../navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../resize.js"></script>
<script type="text/javascript" src="../../navtreedata.js"></script>
<script type="text/javascript" src="../../navtree.js"></script>
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
<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"],
});
</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>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<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>
<div id="projectbrief">Set of algorithms implemented in C++.</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.18 -->
<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');
/* @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 */
$(function() {
initMenu('../../',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('d3/d4c/xor__cipher_8cpp.html','../../'); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<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><!--header-->
<div class="contents">
<p>Implementation of <a href="https://en.wikipedia.org/wiki/XOR_cipher">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 />
<code>#include &lt;cassert&gt;</code><br />
</div><div class="textblock"><div class="dynheader">
Include dependency graph for xor_cipher.cpp:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d5/d85/xor__cipher_8cpp__incl.svg" width="252" height="112"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
</div>
</div>
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a 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">Algorithms for encryption and decryption. <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="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>
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>
<tr class="memitem:a6099b7e0f1793f418d2c1befca8355a4"><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#a6099b7e0f1793f418d2c1befca8355a4">ciphers::XOR::decrypt</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:a6099b7e0f1793f418d2c1befca8355a4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae1a3968e7947464bee7714f6d43b7002"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/d4c/xor__cipher_8cpp.html#ae1a3968e7947464bee7714f6d43b7002">test</a> ()</td></tr>
<tr class="separator:ae1a3968e7947464bee7714f6d43b7002"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae66f6b31b5ad750f1fe042a706a4e3d4"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/d4c/xor__cipher_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4">main</a> ()</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>
<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>
<h3><a class="anchor" id="autotoc_md1"></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>
<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>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="a6099b7e0f1793f418d2c1befca8355a4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6099b7e0f1793f418d2c1befca8355a4">&#9670;&nbsp;</a></span>decrypt()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> ciphers::XOR::decrypt </td>
<td>(</td>
<td class="paramtype">const <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> &amp;&#160;</td>
<td class="paramname"><em>text</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const int &amp;&#160;</td>
<td class="paramname"><em>key</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</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>
<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>
</table>
</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><!-- fragment -->
</div>
</div>
<a id="aeff72a463ffc580c16cc849cbbdc58ef"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aeff72a463ffc580c16cc849cbbdc58ef">&#9670;&nbsp;</a></span>encrypt()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> ciphers::XOR::encrypt </td>
<td>(</td>
<td class="paramtype">const <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> &amp;&#160;</td>
<td class="paramname"><em>text</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const int &amp;&#160;</td>
<td class="paramname"><em>key</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</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>
<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>
</table>
</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><!-- fragment -->
</div>
</div>
<a id="ae66f6b31b5ad750f1fe042a706a4e3d4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae66f6b31b5ad750f1fe042a706a4e3d4">&#9670;&nbsp;</a></span>main()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int main </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</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>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d3/d4c/xor__cipher_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg" width="274" height="38"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
</div>
</div>
</div>
</div>
<a id="ae1a3968e7947464bee7714f6d43b7002"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae1a3968e7947464bee7714f6d43b7002">&#9670;&nbsp;</a></span>test()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void test </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</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>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d3/d4c/xor__cipher_8cpp_ae1a3968e7947464bee7714f6d43b7002_cgraph.svg" width="175" height="38"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
</div>
</div>
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<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 class="ttdoc">STL class.</div></div>
<div class="ttc" id="axor__cipher_8cpp_html_aeff72a463ffc580c16cc849cbbdc58ef"><div class="ttname"><a href="../../d3/d4c/xor__cipher_8cpp.html#aeff72a463ffc580c16cc849cbbdc58ef">ciphers::XOR::encrypt</a></div><div class="ttdeci">std::string encrypt(const std::string &amp;text, const int &amp;key)</div><div class="ttdef"><b>Definition:</b> xor_cipher.cpp:47</div></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 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>
<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>
<!-- start footer part -->
<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="http://www.doxygen.org/index.html">
<img class="footer" src="../../doxygen.png" alt="doxygen"/></a> 1.8.18 </li>
</ul>
</div>
</body>
</html>