gf256_8cpp-source.html

来自「Crypto++是一个非常强大的密码学库,主要是功能全」· HTML 代码 · 共 48 行

HTML
48
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>Crypto++: gf256.cpp Source File</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.3.2 --><div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Compound&nbsp;List</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="namespacemembers.html">Namespace&nbsp;Members</a> | <a class="qindex" href="functions.html">Compound&nbsp;Members</a> | <a class="qindex" href="globals.html">File&nbsp;Members</a></div><h1>gf256.cpp</h1><div class="fragment"><pre>00001 <span class="comment">// gf256.cpp - written and placed in the public domain by Wei Dai</span>00002 00003 <span class="preprocessor">#include "pch.h"</span>00004 <span class="preprocessor">#include "gf256.h"</span>00005 00006 NAMESPACE_BEGIN(CryptoPP)00007 00008 GF256::Element GF256::Multiply(Element a, Element b)<span class="keyword"> const</span>00009 <span class="keyword"></span>{00010         word result = 0, t = b;00011 00012         <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i&lt;8; i++)00013         {00014                 result &lt;&lt;= 1;00015                 <span class="keywordflow">if</span> (result &amp; 0x100)00016                         result ^= m_modulus;00017 00018                 t &lt;&lt;= 1;00019                 <span class="keywordflow">if</span> (t &amp; 0x100)00020                         result ^= a;00021         }00022 00023         <span class="keywordflow">return</span> (GF256::Element) result;00024 }00025 00026 GF256::Element GF256::MultiplicativeInverse(Element a)<span class="keyword"> const</span>00027 <span class="keyword"></span>{00028         Element result = a;00029         <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=1; i&lt;7; i++)00030                 result = Multiply(<a class="code" href="class_square.html">Square</a>(result), a);00031         <span class="keywordflow">return</span> <a class="code" href="class_square.html">Square</a>(result);00032 }00033 00034 NAMESPACE_END</pre></div><hr size="1"><address style="align: right;"><small>Generated on Tue Jul 8 23:34:15 2003 for Crypto++ by<a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border=0 > </a>1.3.2 </small></address></body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?