<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://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.5"/> <title>BeeCrypt: include/beecrypt/blowfish.h Source File</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="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 style="padding-left: 0.5em;"> <div id="projectname">BeeCrypt  <span id="projectnumber">4.2.1</span> </div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.5 --> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="annotated.html"><span>Data Structures</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>Globals</span></a></li> </ul> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_7519372152c32ce484a8cde0fb6b8cd0.html">beecrypt</a></li> </ul> </div> </div><!-- top --> <div class="header"> <div class="headertitle"> <div class="title">blowfish.h</div> </div> </div><!--header--> <div class="contents"> <a href="blowfish_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">/*</span></div> <div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment"> * Copyright (c) 1999, 2000, 2002 X-Way Rights BV</span></div> <div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment"> *</span></div> <div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment"> * This library is free software; you can redistribute it and/or</span></div> <div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment"> * modify it under the terms of the GNU Lesser General Public</span></div> <div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment"> * License as published by the Free Software Foundation; either</span></div> <div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment"> * version 2.1 of the License, or (at your option) any later version.</span></div> <div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment"> *</span></div> <div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="comment"> * This library is distributed in the hope that it will be useful,</span></div> <div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span></div> <div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span></div> <div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="comment"> * Lesser General Public License for more details.</span></div> <div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="comment"> *</span></div> <div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="comment"> * You should have received a copy of the GNU Lesser General Public</span></div> <div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="comment"> * License along with this library; if not, write to the Free Software</span></div> <div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span></div> <div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="comment"> *</span></div> <div class="line"><a name="l00018"></a><span class="lineno"> 18</span> <span class="comment"> */</span></div> <div class="line"><a name="l00019"></a><span class="lineno"> 19</span> </div> <div class="line"><a name="l00034"></a><span class="lineno"> 34</span> <span class="preprocessor">#ifndef _BLOWFISH_H</span></div> <div class="line"><a name="l00035"></a><span class="lineno"> 35</span> <span class="preprocessor"></span><span class="preprocessor">#define _BLOWFISH_H</span></div> <div class="line"><a name="l00036"></a><span class="lineno"> 36</span> <span class="preprocessor"></span></div> <div class="line"><a name="l00037"></a><span class="lineno"> 37</span> <span class="preprocessor">#include "<a class="code" href="beecrypt_8h.html">beecrypt/beecrypt.h</a>"</span></div> <div class="line"><a name="l00038"></a><span class="lineno"> 38</span> <span class="preprocessor">#include "<a class="code" href="blowfishopt_8h.html">beecrypt/blowfishopt.h</a>"</span></div> <div class="line"><a name="l00039"></a><span class="lineno"> 39</span> </div> <div class="line"><a name="l00040"></a><span class="lineno"><a class="line" href="blowfish_8h.html#a320de9881e6c7560cd5b13828c420d5a"> 40</a></span> <span class="preprocessor">#define BLOWFISHROUNDS 16</span></div> <div class="line"><a name="l00041"></a><span class="lineno"><a class="line" href="blowfish_8h.html#aa638e9cb3cbf0ad5b94a25fdb9eb64c6"> 41</a></span> <span class="preprocessor"></span><span class="preprocessor">#define BLOWFISHPSIZE (BLOWFISHROUNDS+2)</span></div> <div class="line"><a name="l00042"></a><span class="lineno"> 42</span> <span class="preprocessor"></span></div> <div class="line"><a name="l00046"></a><span class="lineno"> 46</span> <span class="preprocessor">#ifdef __cplusplus</span></div> <div class="line"><a name="l00047"></a><span class="lineno"><a class="line" href="structblowfishParam.html"> 47</a></span> <span class="preprocessor"></span><span class="keyword">struct </span><a class="code" href="api_8h.html#a4f699d64328623c51b22f3b3f1ff4150">BEECRYPTAPI</a> <a class="code" href="structblowfishParam.html">blowfishParam</a></div> <div class="line"><a name="l00048"></a><span class="lineno"> 48</span> #else</div> <div class="line"><a name="l00049"></a><span class="lineno"> 49</span> struct _blowfishParam</div> <div class="line"><a name="l00050"></a><span class="lineno"> 50</span> #endif</div> <div class="line"><a name="l00051"></a><span class="lineno"> 51</span> {</div> <div class="line"><a name="l00055"></a><span class="lineno"><a class="line" href="structblowfishParam.html#a4c5ad09d2167f603682f84373b4708b6"> 55</a></span>  uint32_t p[<a class="code" href="blowfish_8h.html#aa638e9cb3cbf0ad5b94a25fdb9eb64c6">BLOWFISHPSIZE</a>];</div> <div class="line"><a name="l00059"></a><span class="lineno"><a class="line" href="structblowfishParam.html#a82a3e49436fba83242b66f2d530cea21"> 59</a></span>  uint32_t s[1024];</div> <div class="line"><a name="l00063"></a><span class="lineno"><a class="line" href="structblowfishParam.html#a1ca673c86a0c0a5fecc3eb47ca812536"> 63</a></span>  uint32_t fdback[2];</div> <div class="line"><a name="l00064"></a><span class="lineno"> 64</span> };</div> <div class="line"><a name="l00065"></a><span class="lineno"> 65</span> </div> <div class="line"><a name="l00066"></a><span class="lineno"> 66</span> <span class="preprocessor">#ifndef __cplusplus</span></div> <div class="line"><a name="l00067"></a><span class="lineno"> 67</span> <span class="preprocessor"></span><span class="keyword">typedef</span> <span class="keyword">struct </span>_blowfishParam <a class="code" href="structblowfishParam.html">blowfishParam</a>;</div> <div class="line"><a name="l00068"></a><span class="lineno"> 68</span> <span class="preprocessor">#endif</span></div> <div class="line"><a name="l00069"></a><span class="lineno"> 69</span> <span class="preprocessor"></span></div> <div class="line"><a name="l00070"></a><span class="lineno"> 70</span> <span class="preprocessor">#ifdef __cplusplus</span></div> <div class="line"><a name="l00071"></a><span class="lineno"> 71</span> <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">"C"</span> {</div> <div class="line"><a name="l00072"></a><span class="lineno"> 72</span> <span class="preprocessor">#endif</span></div> <div class="line"><a name="l00073"></a><span class="lineno"> 73</span> <span class="preprocessor"></span></div> <div class="line"><a name="l00077"></a><span class="lineno"> 77</span> <span class="keyword">extern</span> <span class="keyword">const</span> <a class="code" href="api_8h.html#a4f699d64328623c51b22f3b3f1ff4150">BEECRYPTAPI</a> <a class="code" href="structblockCipher.html">blockCipher</a> <a class="code" href="blowfish_8h.html#a58839854cfc0f9bcafd4b79ffd8e9d91">blowfish</a>;</div> <div class="line"><a name="l00078"></a><span class="lineno"> 78</span> </div> <div class="line"><a name="l00089"></a><span class="lineno"> 89</span> <a class="code" href="api_8h.html#a4f699d64328623c51b22f3b3f1ff4150">BEECRYPTAPI</a></div> <div class="line"><a name="l00090"></a><span class="lineno"> 90</span> <span class="keywordtype">int</span> <a class="code" href="blowfish_8h.html#acce3d0c95c67c98202e851063604819e">blowfishSetup</a> (<a class="code" href="structblowfishParam.html">blowfishParam</a>*, <span class="keyword">const</span> <a class="code" href="api_8h.html#ab8ef12fab634c171394422d0ee8baf94">byte</a>*, <span class="keywordtype">size_t</span>, <a class="code" href="group__BC__m.html#gace10d4c0b0409d35c6a703d6445fc558">cipherOperation</a>);</div> <div class="line"><a name="l00091"></a><span class="lineno"> 91</span> </div> <div class="line"><a name="l00099"></a><span class="lineno"> 99</span> <a class="code" href="api_8h.html#a4f699d64328623c51b22f3b3f1ff4150">BEECRYPTAPI</a></div> <div class="line"><a name="l00100"></a><span class="lineno"> 100</span> <span class="keywordtype">int</span> <a class="code" href="blowfish_8h.html#a56566a49f33043d7a443a7bbbcd7bd5f">blowfishSetIV</a> (<a class="code" href="structblowfishParam.html">blowfishParam</a>*, <span class="keyword">const</span> <a class="code" href="api_8h.html#ab8ef12fab634c171394422d0ee8baf94">byte</a>* iv);</div> <div class="line"><a name="l00101"></a><span class="lineno"> 101</span> </div> <div class="line"><a name="l00102"></a><span class="lineno"> 102</span> <a class="code" href="api_8h.html#a4f699d64328623c51b22f3b3f1ff4150">BEECRYPTAPI</a></div> <div class="line"><a name="l00103"></a><span class="lineno"> 103</span> <span class="keywordtype">int</span> <a class="code" href="blowfish_8h.html#a8bd243fafbf7c52359f19ab04de13c42">blowfishSetCTR</a> (<a class="code" href="structblowfishParam.html">blowfishParam</a>*, <span class="keyword">const</span> <a class="code" href="api_8h.html#ab8ef12fab634c171394422d0ee8baf94">byte</a>* nivz, <span class="keywordtype">size_t</span> counter);</div> <div class="line"><a name="l00104"></a><span class="lineno"> 104</span> </div> <div class="line"><a name="l00113"></a><span class="lineno"> 113</span> <a class="code" href="api_8h.html#a4f699d64328623c51b22f3b3f1ff4150">BEECRYPTAPI</a></div> <div class="line"><a name="l00114"></a><span class="lineno"> 114</span> <span class="keywordtype">int</span> <a class="code" href="blowfish_8h.html#a2b48ab4a1793739d266308d1033aee70">blowfishEncrypt</a> (<a class="code" href="structblowfishParam.html">blowfishParam</a>*, uint32_t*, <span class="keyword">const</span> uint32_t*);</div> <div class="line"><a name="l00115"></a><span class="lineno"> 115</span> </div> <div class="line"><a name="l00124"></a><span class="lineno"> 124</span> <a class="code" href="api_8h.html#a4f699d64328623c51b22f3b3f1ff4150">BEECRYPTAPI</a></div> <div class="line"><a name="l00125"></a><span class="lineno"> 125</span> <span class="keywordtype">int</span> <a class="code" href="blowfish_8h.html#a6339ebc5b30a93680c152076ddd5f033">blowfishDecrypt</a> (<a class="code" href="structblowfishParam.html">blowfishParam</a>*, uint32_t*, <span class="keyword">const</span> uint32_t*);</div> <div class="line"><a name="l00126"></a><span class="lineno"> 126</span> </div> <div class="line"><a name="l00127"></a><span class="lineno"> 127</span> <a class="code" href="api_8h.html#a4f699d64328623c51b22f3b3f1ff4150">BEECRYPTAPI</a></div> <div class="line"><a name="l00128"></a><span class="lineno"> 128</span> uint32_t* <a class="code" href="blowfish_8h.html#ae2137286429679c247215465d99342c5">blowfishFeedback</a>(<a class="code" href="structblowfishParam.html">blowfishParam</a>*);</div> <div class="line"><a name="l00129"></a><span class="lineno"> 129</span> </div> <div class="line"><a name="l00130"></a><span class="lineno"> 130</span> <span class="preprocessor">#ifdef __cplusplus</span></div> <div class="line"><a name="l00131"></a><span class="lineno"> 131</span> <span class="preprocessor"></span>}</div> <div class="line"><a name="l00132"></a><span class="lineno"> 132</span> <span class="preprocessor">#endif</span></div> <div class="line"><a name="l00133"></a><span class="lineno"> 133</span> <span class="preprocessor"></span></div> <div class="line"><a name="l00134"></a><span class="lineno"> 134</span> <span class="preprocessor">#endif</span></div> <div class="ttc" id="blowfishopt_8h_html"><div class="ttname"><a href="blowfishopt_8h.html">blowfishopt.h</a></div><div class="ttdoc">Blowfish block cipher, assembler-optimized routines, headers. </div></div> <div class="ttc" id="blowfish_8h_html_a8bd243fafbf7c52359f19ab04de13c42"><div class="ttname"><a href="blowfish_8h.html#a8bd243fafbf7c52359f19ab04de13c42">blowfishSetCTR</a></div><div class="ttdeci">int blowfishSetCTR(blowfishParam *, const byte *nivz, size_t counter)</div></div> <div class="ttc" id="structblockCipher_html"><div class="ttname"><a href="structblockCipher.html">blockCipher</a></div><div class="ttdoc">Holds information and pointers to code specific to each cipher. </div><div class="ttdef"><b>Definition:</b> beecrypt.h:644</div></div> <div class="ttc" id="blowfish_8h_html_a6339ebc5b30a93680c152076ddd5f033"><div class="ttname"><a href="blowfish_8h.html#a6339ebc5b30a93680c152076ddd5f033">blowfishDecrypt</a></div><div class="ttdeci">int blowfishDecrypt(blowfishParam *, uint32_t *, const uint32_t *)</div><div class="ttdoc">This function performs the Blowfish decryption; it Rderypts one block of 64 bits. ...</div></div> <div class="ttc" id="beecrypt_8h_html"><div class="ttname"><a href="beecrypt_8h.html">beecrypt.h</a></div><div class="ttdoc">BeeCrypt API, headers. </div></div> <div class="ttc" id="api_8h_html_ab8ef12fab634c171394422d0ee8baf94"><div class="ttname"><a href="api_8h.html#ab8ef12fab634c171394422d0ee8baf94">byte</a></div><div class="ttdeci">uint8_t byte</div><div class="ttdef"><b>Definition:</b> api.h:72</div></div> <div class="ttc" id="api_8h_html_a4f699d64328623c51b22f3b3f1ff4150"><div class="ttname"><a href="api_8h.html#a4f699d64328623c51b22f3b3f1ff4150">BEECRYPTAPI</a></div><div class="ttdeci">#define BEECRYPTAPI</div><div class="ttdef"><b>Definition:</b> api.h:52</div></div> <div class="ttc" id="group__BC__m_html_gace10d4c0b0409d35c6a703d6445fc558"><div class="ttname"><a href="group__BC__m.html#gace10d4c0b0409d35c6a703d6445fc558">cipherOperation</a></div><div class="ttdeci">cipherOperation</div><div class="ttdoc">Specifies whether to perform encryption or decryption. </div><div class="ttdef"><b>Definition:</b> beecrypt.h:556</div></div> <div class="ttc" id="structblowfishParam_html"><div class="ttname"><a href="structblowfishParam.html">blowfishParam</a></div><div class="ttdoc">Holds all the parameters necessary for the Blowfish cipher. </div><div class="ttdef"><b>Definition:</b> blowfish.h:47</div></div> <div class="ttc" id="blowfish_8h_html_aa638e9cb3cbf0ad5b94a25fdb9eb64c6"><div class="ttname"><a href="blowfish_8h.html#aa638e9cb3cbf0ad5b94a25fdb9eb64c6">BLOWFISHPSIZE</a></div><div class="ttdeci">#define BLOWFISHPSIZE</div><div class="ttdef"><b>Definition:</b> blowfish.h:41</div></div> <div class="ttc" id="blowfish_8h_html_ae2137286429679c247215465d99342c5"><div class="ttname"><a href="blowfish_8h.html#ae2137286429679c247215465d99342c5">blowfishFeedback</a></div><div class="ttdeci">uint32_t * blowfishFeedback(blowfishParam *)</div></div> <div class="ttc" id="blowfish_8h_html_a58839854cfc0f9bcafd4b79ffd8e9d91"><div class="ttname"><a href="blowfish_8h.html#a58839854cfc0f9bcafd4b79ffd8e9d91">blowfish</a></div><div class="ttdeci">const blockCipher blowfish</div><div class="ttdoc">Holds the full API description of the Blowfish algorithm. </div></div> <div class="ttc" id="blowfish_8h_html_acce3d0c95c67c98202e851063604819e"><div class="ttname"><a href="blowfish_8h.html#acce3d0c95c67c98202e851063604819e">blowfishSetup</a></div><div class="ttdeci">int blowfishSetup(blowfishParam *, const byte *, size_t, cipherOperation)</div><div class="ttdoc">The function performs the cipher&#39;s key expansion. </div></div> <div class="ttc" id="blowfish_8h_html_a2b48ab4a1793739d266308d1033aee70"><div class="ttname"><a href="blowfish_8h.html#a2b48ab4a1793739d266308d1033aee70">blowfishEncrypt</a></div><div class="ttdeci">int blowfishEncrypt(blowfishParam *, uint32_t *, const uint32_t *)</div><div class="ttdoc">This function performs the Blowfish encryption; it encrypts one block of 64 bits. ...</div></div> <div class="ttc" id="blowfish_8h_html_a56566a49f33043d7a443a7bbbcd7bd5f"><div class="ttname"><a href="blowfish_8h.html#a56566a49f33043d7a443a7bbbcd7bd5f">blowfishSetIV</a></div><div class="ttdeci">int blowfishSetIV(blowfishParam *, const byte *iv)</div><div class="ttdoc">This function sets the Initialization Vector. </div></div> </div><!-- fragment --></div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated on Fri Sep 27 2013 02:36:25 for BeeCrypt by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.5 </small></address> </body> </html>