📄 ida_8h-source.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"><title>Crypto++: ida.h Source File</title><link href="doxygen.css" rel="stylesheet" type="text/css"><link href="tabs.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.5.2 --><div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="classes.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul></div><div class="tabs"> <ul> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>File Members</span></a></li> </ul></div><h1>ida.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef CRYPTOPP_IDA_H</span><a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define CRYPTOPP_IDA_H</span><a name="l00003"></a>00003 <span class="preprocessor"></span><a name="l00004"></a>00004 <span class="preprocessor">#include "mqueue.h"</span><a name="l00005"></a>00005 <span class="preprocessor">#include "filters.h"</span><a name="l00006"></a>00006 <span class="preprocessor">#include "channels.h"</span><a name="l00007"></a>00007 <span class="preprocessor">#include <map></span><a name="l00008"></a>00008 <span class="preprocessor">#include <vector></span><a name="l00009"></a>00009 <a name="l00010"></a>00010 NAMESPACE_BEGIN(CryptoPP)<a name="l00011"></a>00011 <a name="l00012"></a>00012 <span class="comment">/// base class for secret sharing and information dispersal</span><a name="l00013"></a><a class="code" href="class_raw_i_d_a.html">00013</a> <span class="comment"></span>class <a class="code" href="class_raw_i_d_a.html" title="base class for secret sharing and information dispersal">RawIDA</a> : public <a class="code" href="class_auto_signaling.html" title="_">AutoSignaling</a><<a class="code" href="class_unflushable.html" title="_">Unflushable</a><<a class="code" href="class_multichannel.html" title="_">Multichannel</a><<a class="code" href="class_filter.html" title="provides an implementation of BufferedTransformation's attachment interface">Filter</a>> > ><a name="l00014"></a>00014 {<a name="l00015"></a>00015 <span class="keyword">public</span>:<a name="l00016"></a><a class="code" href="class_raw_i_d_a.html#e5b5e2c34d30c169251603d79403f3aa">00016</a> <a class="code" href="class_raw_i_d_a.html" title="base class for secret sharing and information dispersal">RawIDA</a>(<a class="code" href="class_buffered_transformation.html" title="interface for buffered transformations">BufferedTransformation</a> *attachment=NULL)<a name="l00017"></a>00017 {Detach(attachment);}<a name="l00018"></a>00018 <a name="l00019"></a><a class="code" href="class_raw_i_d_a.html#cbdf3bfeabd7a7c64b03b61fa8929d4c">00019</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> GetThreshold()<span class="keyword"> const </span>{<span class="keywordflow">return</span> m_threshold;}<a name="l00020"></a>00020 <span class="keywordtype">void</span> AddOutputChannel(word32 channelId);<a name="l00021"></a>00021 <span class="keywordtype">void</span> ChannelData(word32 channelId, <span class="keyword">const</span> byte *inString, <span class="keywordtype">size_t</span> length, <span class="keywordtype">bool</span> messageEnd);<a name="l00022"></a>00022 lword InputBuffered(word32 channelId) <span class="keyword">const</span>;<a name="l00023"></a>00023 <a name="l00024"></a>00024 <span class="keywordtype">void</span> IsolatedInitialize(<span class="keyword">const</span> <a class="code" href="class_name_value_pairs.html" title="interface for retrieving values given their names">NameValuePairs</a> &parameters=g_nullNameValuePairs);<a name="l00025"></a><a class="code" href="class_raw_i_d_a.html#de3964428df9a1d872926db0cc2e1251">00025</a> <span class="keywordtype">size_t</span> ChannelPut2(<span class="keyword">const</span> std::string &channel, <span class="keyword">const</span> byte *begin, <span class="keywordtype">size_t</span> length, <span class="keywordtype">int</span> messageEnd, <span class="keywordtype">bool</span> blocking)<a name="l00026"></a>00026 {<a name="l00027"></a>00027 <span class="keywordflow">if</span> (!blocking)<a name="l00028"></a>00028 <span class="keywordflow">throw</span> BlockingInputOnly(<span class="stringliteral">"RawIDA"</span>);<a name="l00029"></a>00029 ChannelData(StringToWord<word32>(channel), begin, length, messageEnd != 0);<a name="l00030"></a>00030 <span class="keywordflow">return</span> 0;<a name="l00031"></a>00031 }<a name="l00032"></a>00032 <a name="l00033"></a>00033 <span class="keyword">protected</span>:<a name="l00034"></a>00034 <span class="keyword">virtual</span> <span class="keywordtype">void</span> FlushOutputQueues();<a name="l00035"></a>00035 <span class="keyword">virtual</span> <span class="keywordtype">void</span> OutputMessageEnds();<a name="l00036"></a>00036 <a name="l00037"></a>00037 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> InsertInputChannel(word32 channelId);<a name="l00038"></a>00038 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> LookupInputChannel(word32 channelId) <span class="keyword">const</span>;<a name="l00039"></a>00039 <span class="keywordtype">void</span> ComputeV(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>);<a name="l00040"></a>00040 <span class="keywordtype">void</span> PrepareInterpolation();<a name="l00041"></a>00041 <span class="keywordtype">void</span> ProcessInputQueues();<a name="l00042"></a>00042 <a name="l00043"></a><a class="code" href="class_raw_i_d_a.html#13a5549536394618117dbeb51fcc42f3">00043</a> <span class="keyword">typedef</span> std::map<word32, unsigned int> InputChannelMap;<a name="l00044"></a><a class="code" href="class_raw_i_d_a.html#0515815d1f31024c7ac45760303bd680">00044</a> InputChannelMap m_inputChannelMap;<a name="l00045"></a><a class="code" href="class_raw_i_d_a.html#2a6879cff90946155d76dbe5ed7d3dcb">00045</a> InputChannelMap::iterator m_lastMapPosition;<a name="l00046"></a><a class="code" href="class_raw_i_d_a.html#584a7b425d16b083cce42f5af573dc52">00046</a> std::vector<MessageQueue> m_inputQueues;<a name="l00047"></a><a class="code" href="class_raw_i_d_a.html#eeecf596f67b49b762b131b80a5ccce0">00047</a> std::vector<word32> m_inputChannelIds, m_outputChannelIds, m_outputToInput;<a name="l00048"></a><a class="code" href="class_raw_i_d_a.html#a2a11404f7b82de338821b549dd7b851">00048</a> std::vector<std::string> m_outputChannelIdStrings;<a name="l00049"></a><a class="code" href="class_raw_i_d_a.html#ae55af87cd9751e8b37923bde5aacd82">00049</a> std::vector<ByteQueue> m_outputQueues;<a name="l00050"></a><a class="code" href="class_raw_i_d_a.html#a2983c025ce40ed5b39aa41419cc8cbe">00050</a> <span class="keywordtype">int</span> m_threshold;<a name="l00051"></a><a class="code" href="class_raw_i_d_a.html#c6f20ebfa8c7d0bb793267d401905c27">00051</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> m_channelsReady, m_channelsFinished;<a name="l00052"></a><a class="code" href="class_raw_i_d_a.html#b634332d6f20a199d5dae6189bb81c27">00052</a> std::vector<SecBlock<word32> > m_v;<a name="l00053"></a><a class="code" href="class_raw_i_d_a.html#f18d09b7e8088ccb33e3b905fb326a4d">00053</a> <a class="code" href="class_sec_block.html" title="a block of memory allocated using A">SecBlock<word32></a> m_u, m_w, m_y;<a name="l00054"></a>00054 };<a name="l00055"></a>00055 <span class="comment"></span><a name="l00056"></a>00056 <span class="comment">/// a variant of Shamir's Secret Sharing Algorithm</span><a name="l00057"></a><a class="code" href="class_secret_sharing.html">00057</a> <span class="comment"></span><span class="keyword">class </span><a class="code" href="class_secret_sharing.html" title="a variant of Shamir's Secret Sharing Algorithm">SecretSharing</a> : <span class="keyword">public</span> <a class="code" href="class_custom_flush_propagation.html" title="_">CustomFlushPropagation</a><Filter><a name="l00058"></a>00058 {<a name="l00059"></a>00059 <span class="keyword">public</span>:<a name="l00060"></a><a class="code" href="class_secret_sharing.html#03397a282cf7b7ce1ad177db86d45085">00060</a> <a class="code" href="class_secret_sharing.html#03397a282cf7b7ce1ad177db86d45085">SecretSharing</a>(<a class="code" href="class_random_number_generator.html" title="interface for random number generators">RandomNumberGenerator</a> &rng, <span class="keywordtype">int</span> threshold, <span class="keywordtype">int</span> nShares, <a class="code" href="class_buffered_transformation.html" title="interface for buffered transformations">BufferedTransformation</a> *attachment=NULL, <span class="keywordtype">bool</span> addPadding=<span class="keyword">true</span>)<a name="l00061"></a>00061 : <a class="code" href="class_secret_sharing.html#8eca29688fdebc5ef5d9677f3075248a">m_rng</a>(rng), <a class="code" href="class_secret_sharing.html#e1d66bb234b7cbee456d58557b8d9129">m_ida</a>(new <a class="code" href="class_output_proxy.html">OutputProxy</a>(*this, true))<a name="l00062"></a>00062 {<a name="l00063"></a>00063 <a class="code" href="class_filter.html#93817876b45172108fe0342de6442f75" title="delete the current attachment chain and replace it with newAttachment">Detach</a>(attachment);<a name="l00064"></a>00064 IsolatedInitialize(MakeParameters(<span class="stringliteral">"RecoveryThreshold"</span>, threshold)(<span class="stringliteral">"NumberOfShares"</span>, nShares)(<span class="stringliteral">"AddPadding"</span>, addPadding));<a name="l00065"></a>00065 }<a name="l00066"></a>00066 <a name="l00067"></a>00067 <span class="keywordtype">void</span> IsolatedInitialize(<span class="keyword">const</span> <a class="code" href="class_name_value_pairs.html" title="interface for retrieving values given their names">NameValuePairs</a> &parameters=g_nullNameValuePairs);<a name="l00068"></a>00068 <span class="keywordtype">size_t</span> <a class="code" href="class_secret_sharing.html#26acaced75c630173f17ab29f615d409" title="input multiple bytes for blocking or non-blocking processing">Put2</a>(<span class="keyword">const</span> byte *begin, <span class="keywordtype">size_t</span> length, <span class="keywordtype">int</span> messageEnd, <span class="keywordtype">bool</span> blocking);<a name="l00069"></a><a class="code" href="class_secret_sharing.html#670b6f5ba7ee9e1f029cd199f6722bb6">00069</a> <span class="keywordtype">bool</span> <a class="code" href="class_secret_sharing.html#670b6f5ba7ee9e1f029cd199f6722bb6" title="flush buffered input and/or output">Flush</a>(<span class="keywordtype">bool</span> hardFlush, <span class="keywordtype">int</span> propagation=-1, <span class="keywordtype">bool</span> blocking=<span class="keyword">true</span>) {<span class="keywordflow">return</span> <a class="code" href="class_secret_sharing.html#e1d66bb234b7cbee456d58557b8d9129">m_ida</a>.<a class="code" href="class_unflushable.html#e5070b5e2895ca6cf458ff7ccef9f1e1">Flush</a>(hardFlush, propagation, blocking);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -