Documentation for 0931d530ae

This commit is contained in:
github-actions
2023-01-22 19:44:10 +00:00
parent a448f64699
commit b48f6e8671
2457 changed files with 9513 additions and 8691 deletions

View File

@@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.5"/>
<meta name="generator" content="Doxygen 1.9.6"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Algorithms_in_C++: ciphers/hill_cipher.cpp File Reference</title>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
@@ -41,7 +41,7 @@ MathJax.Hub.Config({
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.5 -->
<!-- Generated by Doxygen 1.9.6 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "../../search/",'.html');
@@ -142,10 +142,10 @@ Functions</h2></td></tr>
<tr class="memitem:a34bfcd756610834acac501f9eea1e2eb"><td class="memTemplItemLeft" align="right" valign="top">static <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::ostream</a> &amp;&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="../../d7/db9/hill__cipher_8cpp.html#a34bfcd756610834acac501f9eea1e2eb">operator&lt;&lt;</a> (<a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::ostream</a> &amp;out, <a class="el" href="../../d1/dbe/lu__decomposition_8h.html#aed8766713ee9b561a4acdcdff5f90ea5">matrix</a>&lt; T &gt; const &amp;v)</td></tr>
<tr class="separator:a34bfcd756610834acac501f9eea1e2eb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3147ad576f8a94a2a6b66948672b452b"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d7/db9/hill__cipher_8cpp.html#a3147ad576f8a94a2a6b66948672b452b">test1</a> (const <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> &amp;text)</td></tr>
<tr class="memdesc:a3147ad576f8a94a2a6b66948672b452b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Self test 1 - using 3x3 randomly generated key. <a href="../../d7/db9/hill__cipher_8cpp.html#a3147ad576f8a94a2a6b66948672b452b">More...</a><br /></td></tr>
<tr class="memdesc:a3147ad576f8a94a2a6b66948672b452b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Self test 1 - using 3x3 randomly generated key. <br /></td></tr>
<tr class="separator:a3147ad576f8a94a2a6b66948672b452b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a04391124480d2a49f2dec900237b0712"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d7/db9/hill__cipher_8cpp.html#a04391124480d2a49f2dec900237b0712">test2</a> (const <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a> &amp;text)</td></tr>
<tr class="memdesc:a04391124480d2a49f2dec900237b0712"><td class="mdescLeft">&#160;</td><td class="mdescRight">Self test 2 - using 8x8 randomly generated key. <a href="../../d7/db9/hill__cipher_8cpp.html#a04391124480d2a49f2dec900237b0712">More...</a><br /></td></tr>
<tr class="memdesc:a04391124480d2a49f2dec900237b0712"><td class="mdescLeft">&#160;</td><td class="mdescRight">Self test 2 - using 8x8 randomly generated key. <br /></td></tr>
<tr class="separator:a04391124480d2a49f2dec900237b0712"><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="../../d7/db9/hill__cipher_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4">main</a> ()</td></tr>
<tr class="separator:ae66f6b31b5ad750f1fe042a706a4e3d4"><td class="memSeparator" colspan="2">&#160;</td></tr>
@@ -156,12 +156,12 @@ Variables</h2></td></tr>
<tr class="separator:ab9aec0ccf4b6809f652bb540be87c216"><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/Hill_cipher" target="_blank">Hill cipher</a> algorithm. </p>
<p >Program to generate the encryption-decryption key and perform encryption and decryption of ASCII text using the famous block cipher algorithm. This is a powerful encryption algorithm that is relatively easy to implement with a given key. The strength of the algorithm depends on the size of the block encryption matrix key; the bigger the matrix, the stronger the encryption and more difficult to break it. However, the important requirement for the matrix is that:</p><ol type="1">
<div class="textblock"><p>Implementation of <a href="https://en.wikipedia.org/wiki/Hill_cipher" target="_blank">Hill cipher</a> algorithm. </p>
<p>Program to generate the encryption-decryption key and perform encryption and decryption of ASCII text using the famous block cipher algorithm. This is a powerful encryption algorithm that is relatively easy to implement with a given key. The strength of the algorithm depends on the size of the block encryption matrix key; the bigger the matrix, the stronger the encryption and more difficult to break it. However, the important requirement for the matrix is that:</p><ol type="1">
<li>matrix should be invertible - all inversion conditions should be satisfied and</li>
<li>its determinant must not have any common factors with the length of character set Due to this restriction, most implementations only implement with small 3x3 encryption keys and a small subset of ASCII alphabets.</li>
</ol>
<p >In the current implementation, I present to you an implementation for generating larger encryption keys (I have attempted upto 10x10) and an ASCII character set of 97 printable characters. Hence, a typical ASCII text file could be easily encrypted with the module. The larger character set increases the modulo of cipher and hence the matrix determinants can get very large very quickly rendering them ill-defined.</p>
<p>In the current implementation, I present to you an implementation for generating larger encryption keys (I have attempted upto 10x10) and an ASCII character set of 97 printable characters. Hence, a typical ASCII text file could be easily encrypted with the module. The larger character set increases the modulo of cipher and hence the matrix determinants can get very large very quickly rendering them ill-defined.</p>
<dl class="section note"><dt>Note</dt><dd>This program uses determinant computation using LU decomposition from the file <a class="el" href="../../d1/dbe/lu__decomposition_8h.html" title="Functions associated with LU Decomposition of a square matrix.">lu_decomposition.h</a> </dd>
<dd>
The matrix generation algorithm is very rudimentary and does not guarantee an invertible modulus matrix. </dd></dl>
@@ -183,7 +183,7 @@ The matrix generation algorithm is very rudimentary and does not guarantee an in
</tr>
</table>
</div><div class="memdoc">
<p >Main function </p>
<p>Main function </p>
<div class="fragment"><div class="line"><span class="lineno"> 532</span> {</div>
<div class="line"><span class="lineno"> 533</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/random/srand.html">std::srand</a>(<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/chrono/c/time.html">std::time</a>(<span class="keyword">nullptr</span>));</div>
<div class="line"><span class="lineno"> 534</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;Key dictionary: (&quot;</span> &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/byte/strlen.html">std::strlen</a>(<a class="code hl_variable" href="../../d6/d4e/namespaceciphers.html#ab9aec0ccf4b6809f652bb540be87c216">ciphers::STRKEY</a>) &lt;&lt; <span class="stringliteral">&quot;)\n\t&quot;</span></div>
@@ -248,7 +248,7 @@ template&lt;typename T &gt; </div>
</tr>
</table>
</div><div class="memdoc">
<p >operator to print a matrix </p>
<p>operator to print a matrix </p>
<div class="fragment"><div class="line"><span class="lineno"> 54</span> {</div>
<div class="line"><span class="lineno"> 55</span> <span class="keyword">const</span> <span class="keywordtype">int</span> width = 15;</div>
<div class="line"><span class="lineno"> 56</span> <span class="keyword">const</span> <span class="keywordtype">char</span> separator = <span class="charliteral">&#39; &#39;</span>;</div>
@@ -407,7 +407,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="../../d7/db9/hill__cipher_8cpp.html">hill_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.5 </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.6 </li>
</ul>
</div>
</body>