Files
dl/document/html/dl__crypto_8h_source.html
T
2026-09-16 14:07:40 +08:00

133 lines
19 KiB
HTML
Vendored

<!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" lang="zh">
<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.13.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>dl: D:/dl/dl/memory/dl_crypto.h 源文件</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>
<script type="text/javascript" src="clipboard.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.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 id="projectrow">
<td id="projectalign">
<div id="projectname">dl
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.13.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() { codefold.init(0); });
/* @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:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
initMenu('',false,false,'search.php','搜索',false);
});
/* @license-end */
</script>
<div id="main-nav"></div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function(){ initResizable(false); });
/* @license-end */
</script>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_17297ffb27ce571941f5fb5008f01a1f.html">dl</a></li><li class="navelem"><a class="el" href="dir_880cbdb7e19477dab0ac315d644729fb.html">memory</a></li> </ul>
</div>
</div><!-- top -->
<div id="doc-content">
<div class="header">
<div class="headertitle"><div class="title">dl_crypto.h</div></div>
</div><!--header-->
<div class="contents">
<a href="dl__crypto_8h.html">浏览该文件的文档.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span></div>
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno"> 11</span><span class="preprocessor">#pragma once</span></div>
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno"> 12</span> </div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span><span class="preprocessor">#include &quot;<a class="code" href="dl__buffer_8h.html">dl_buffer.h</a>&quot;</span></div>
<div class="foldopen" id="foldopen00015" data-start="{" data-end="}">
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"><a class="line" href="namespacedl_1_1_crypto.html"> 15</a></span><span class="keyword">namespace </span><a class="code hl_namespace" href="namespacedl_1_1_crypto.html">dl::Crypto</a></div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"> 16</span>{</div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"><a class="line" href="namespacedl_1_1_crypto.html#a64bbdbf79345d3aacb4ee7773b435963"> 22</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="namespacedl_1_1_crypto.html#a64bbdbf79345d3aacb4ee7773b435963">EncryptXor</a>(<a class="code hl_class" href="classdl_1_1_buffer_view.html">BufferView</a> buf);</div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"><a class="line" href="namespacedl_1_1_crypto.html#aafbef59e0ae954b1ce809f0833f14c99"> 23</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="namespacedl_1_1_crypto.html#aafbef59e0ae954b1ce809f0833f14c99">DecryptXor</a>(<a class="code hl_class" href="classdl_1_1_buffer_view.html">BufferView</a> buf);</div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span></div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"><a class="line" href="namespacedl_1_1_crypto.html#af285ebfe9f8ebaa0204bab237fd23301"> 31</a></span>std::wstring <a class="code hl_function" href="namespacedl_1_1_crypto.html#af285ebfe9f8ebaa0204bab237fd23301">EncodeHan256</a>(<a class="code hl_class" href="classdl_1_1_buffer_view.html">BufferView</a> buf);</div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"><a class="line" href="namespacedl_1_1_crypto.html#a0c4b2d2ea90be8003837085111dcc944"> 38</a></span><span class="keywordtype">bool</span> <a class="code hl_function" href="namespacedl_1_1_crypto.html#a0c4b2d2ea90be8003837085111dcc944">DecodeHan256</a>(<span class="keyword">const</span> std::wstring&amp; str, <a class="code hl_class" href="classdl_1_1_buffer.html">Buffer</a>&amp; buf);</div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span></div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"><a class="line" href="namespacedl_1_1_crypto.html#a3d6a745c3072b3cd82fffd00bab47f42"> 45</a></span>uint32_t <a class="code hl_function" href="namespacedl_1_1_crypto.html#a3d6a745c3072b3cd82fffd00bab47f42">HashCrc32</a>(<a class="code hl_class" href="classdl_1_1_buffer_view.html">BufferView</a> buf, uint32_t crc = 0);</div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span></div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"><a class="line" href="namespacedl_1_1_crypto.html#a4ceb9ca52ad2feed2b43708204009bf8"> 52</a></span>std::string <a class="code hl_function" href="namespacedl_1_1_crypto.html#a4ceb9ca52ad2feed2b43708204009bf8">EncodeBase64</a>(<a class="code hl_class" href="classdl_1_1_buffer_view.html">BufferView</a> buf);</div>
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"><a class="line" href="namespacedl_1_1_crypto.html#a15af493b269753c851ce8aaf34bd3a1e"> 59</a></span><span class="keywordtype">bool</span> <a class="code hl_function" href="namespacedl_1_1_crypto.html#a15af493b269753c851ce8aaf34bd3a1e">DecodeBase64</a>(std::string_view str, <a class="code hl_class" href="classdl_1_1_buffer.html">Buffer</a>&amp; buf);</div>
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span></div>
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"><a class="line" href="namespacedl_1_1_crypto.html#a55954039695ebbe81c746b52353cbbd7"> 65</a></span><a class="code hl_class" href="classdl_1_1_buffer.html">Buffer</a> <a class="code hl_function" href="namespacedl_1_1_crypto.html#a55954039695ebbe81c746b52353cbbd7">HashMd5</a>(<a class="code hl_class" href="classdl_1_1_buffer_view.html">BufferView</a> buf);</div>
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"> 66</span></div>
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"><a class="line" href="namespacedl_1_1_crypto.html#acc63687e5cc2c2e822182a5dfd4aa934"> 71</a></span><a class="code hl_class" href="classdl_1_1_buffer.html">Buffer</a> <a class="code hl_function" href="namespacedl_1_1_crypto.html#acc63687e5cc2c2e822182a5dfd4aa934">HashSha256</a>(<a class="code hl_class" href="classdl_1_1_buffer_view.html">BufferView</a> buf);</div>
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno"><a class="line" href="namespacedl_1_1_crypto.html#a588eebba31570c373b102e76dcdd46cd"> 76</a></span><a class="code hl_class" href="classdl_1_1_buffer.html">Buffer</a> <a class="code hl_function" href="namespacedl_1_1_crypto.html#a588eebba31570c373b102e76dcdd46cd">HashSha512</a>(<a class="code hl_class" href="classdl_1_1_buffer_view.html">BufferView</a> buf);</div>
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"><a class="line" href="namespacedl_1_1_crypto.html#a573523b894702f66f4fac6c1c3d198a9"> 81</a></span><a class="code hl_class" href="classdl_1_1_buffer.html">Buffer</a> <a class="code hl_function" href="namespacedl_1_1_crypto.html#a573523b894702f66f4fac6c1c3d198a9">HashBlake2b</a>(<a class="code hl_class" href="classdl_1_1_buffer_view.html">BufferView</a> buf);</div>
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno"> 82</span> </div>
<div class="foldopen" id="foldopen00083" data-start="{" data-end="};">
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno"><a class="line" href="structdl_1_1_crypto_1_1_aes256_key.html"> 83</a></span><span class="keyword">struct </span><a class="code hl_struct" href="structdl_1_1_crypto_1_1_aes256_key.html">Aes256Key</a></div>
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno"> 84</span>{</div>
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno"><a class="line" href="structdl_1_1_crypto_1_1_aes256_key.html#a547da43e17690dc1f867f5f087897754"> 85</a></span> <a class="code hl_class" href="classdl_1_1_buffer.html">Buffer</a> <a class="code hl_variable" href="structdl_1_1_crypto_1_1_aes256_key.html#a547da43e17690dc1f867f5f087897754">_key</a>;</div>
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno"><a class="line" href="structdl_1_1_crypto_1_1_aes256_key.html#aaf4e8dd7b6acef5de70c8ca79836426b"> 86</a></span> <a class="code hl_class" href="classdl_1_1_buffer.html">Buffer</a> <a class="code hl_variable" href="structdl_1_1_crypto_1_1_aes256_key.html#aaf4e8dd7b6acef5de70c8ca79836426b">_iv</a>;</div>
<div class="line"><a id="l00087" name="l00087"></a><span class="lineno"><a class="line" href="structdl_1_1_crypto_1_1_aes256_key.html#a7ab2902a1104a9e8030be88025306fe7"> 87</a></span> <a class="code hl_class" href="classdl_1_1_buffer.html">Buffer</a> <a class="code hl_variable" href="structdl_1_1_crypto_1_1_aes256_key.html#a7ab2902a1104a9e8030be88025306fe7">_tag</a>;</div>
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno"> 88</span>};</div>
</div>
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"> 89</span></div>
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno"><a class="line" href="namespacedl_1_1_crypto.html#a5d0649b0e1075627ed3cc73f669379ae"> 93</a></span><a class="code hl_struct" href="structdl_1_1_crypto_1_1_aes256_key.html">Aes256Key</a> <a class="code hl_function" href="namespacedl_1_1_crypto.html#a5d0649b0e1075627ed3cc73f669379ae">GenerateKeyAes256</a>();</div>
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno"> 94</span></div>
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno"><a class="line" href="namespacedl_1_1_crypto.html#a7630b9cfb5cb627b17203c59119019fc"> 100</a></span><a class="code hl_class" href="classdl_1_1_buffer.html">Buffer</a> <a class="code hl_function" href="namespacedl_1_1_crypto.html#a7630b9cfb5cb627b17203c59119019fc">EncryptAes256</a>(<a class="code hl_class" href="classdl_1_1_buffer_view.html">BufferView</a> buf, <span class="keyword">const</span> <a class="code hl_struct" href="structdl_1_1_crypto_1_1_aes256_key.html">Aes256Key</a>&amp; key);</div>
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno"><a class="line" href="namespacedl_1_1_crypto.html#a0ae6e63a1298d04239b15b1c0cde8ed7"> 106</a></span><a class="code hl_class" href="classdl_1_1_buffer.html">Buffer</a> <a class="code hl_function" href="namespacedl_1_1_crypto.html#a0ae6e63a1298d04239b15b1c0cde8ed7">DecryptAes256</a>(<a class="code hl_class" href="classdl_1_1_buffer_view.html">BufferView</a> buf, <span class="keyword">const</span> <a class="code hl_struct" href="structdl_1_1_crypto_1_1_aes256_key.html">Aes256Key</a>&amp; key);</div>
<div class="line"><a id="l00107" name="l00107"></a><span class="lineno"> 107</span> </div>
<div class="line"><a id="l00108" name="l00108"></a><span class="lineno"> 108</span>}</div>
</div>
<div class="ttc" id="aclassdl_1_1_buffer_html"><div class="ttname"><a href="classdl_1_1_buffer.html">dl::Buffer</a></div><div class="ttdef"><b>定义</b> <a href="dl__buffer_8h_source.html#l00028">dl_buffer.h:29</a></div></div>
<div class="ttc" id="aclassdl_1_1_buffer_view_html"><div class="ttname"><a href="classdl_1_1_buffer_view.html">dl::BufferView</a></div><div class="ttdef"><b>定义</b> <a href="dl__buffer_8h_source.html#l00155">dl_buffer.h:156</a></div></div>
<div class="ttc" id="adl__buffer_8h_html"><div class="ttname"><a href="dl__buffer_8h.html">dl_buffer.h</a></div><div class="ttdoc">表示一段内存</div></div>
<div class="ttc" id="anamespacedl_1_1_crypto_html"><div class="ttname"><a href="namespacedl_1_1_crypto.html">dl::Crypto</a></div><div class="ttdoc">加解密算法</div><div class="ttdef"><b>定义</b> <a href="#l00015">dl_crypto.h:16</a></div></div>
<div class="ttc" id="anamespacedl_1_1_crypto_html_a0ae6e63a1298d04239b15b1c0cde8ed7"><div class="ttname"><a href="namespacedl_1_1_crypto.html#a0ae6e63a1298d04239b15b1c0cde8ed7">dl::Crypto::DecryptAes256</a></div><div class="ttdeci">Buffer DecryptAes256(BufferView buf, const Aes256Key &amp;key)</div><div class="ttdoc">Aes256解密</div></div>
<div class="ttc" id="anamespacedl_1_1_crypto_html_a0c4b2d2ea90be8003837085111dcc944"><div class="ttname"><a href="namespacedl_1_1_crypto.html#a0c4b2d2ea90be8003837085111dcc944">dl::Crypto::DecodeHan256</a></div><div class="ttdeci">bool DecodeHan256(const std::wstring &amp;str, Buffer &amp;buf)</div><div class="ttdoc">中文映射编码</div></div>
<div class="ttc" id="anamespacedl_1_1_crypto_html_a15af493b269753c851ce8aaf34bd3a1e"><div class="ttname"><a href="namespacedl_1_1_crypto.html#a15af493b269753c851ce8aaf34bd3a1e">dl::Crypto::DecodeBase64</a></div><div class="ttdeci">bool DecodeBase64(std::string_view str, Buffer &amp;buf)</div><div class="ttdoc">base64解码</div></div>
<div class="ttc" id="anamespacedl_1_1_crypto_html_a3d6a745c3072b3cd82fffd00bab47f42"><div class="ttname"><a href="namespacedl_1_1_crypto.html#a3d6a745c3072b3cd82fffd00bab47f42">dl::Crypto::HashCrc32</a></div><div class="ttdeci">uint32_t HashCrc32(BufferView buf, uint32_t crc=0)</div><div class="ttdoc">crc32哈希</div></div>
<div class="ttc" id="anamespacedl_1_1_crypto_html_a4ceb9ca52ad2feed2b43708204009bf8"><div class="ttname"><a href="namespacedl_1_1_crypto.html#a4ceb9ca52ad2feed2b43708204009bf8">dl::Crypto::EncodeBase64</a></div><div class="ttdeci">std::string EncodeBase64(BufferView buf)</div><div class="ttdoc">base64编码</div></div>
<div class="ttc" id="anamespacedl_1_1_crypto_html_a55954039695ebbe81c746b52353cbbd7"><div class="ttname"><a href="namespacedl_1_1_crypto.html#a55954039695ebbe81c746b52353cbbd7">dl::Crypto::HashMd5</a></div><div class="ttdeci">Buffer HashMd5(BufferView buf)</div><div class="ttdoc">md5哈希</div></div>
<div class="ttc" id="anamespacedl_1_1_crypto_html_a573523b894702f66f4fac6c1c3d198a9"><div class="ttname"><a href="namespacedl_1_1_crypto.html#a573523b894702f66f4fac6c1c3d198a9">dl::Crypto::HashBlake2b</a></div><div class="ttdeci">Buffer HashBlake2b(BufferView buf)</div><div class="ttdoc">blake2b哈希</div></div>
<div class="ttc" id="anamespacedl_1_1_crypto_html_a588eebba31570c373b102e76dcdd46cd"><div class="ttname"><a href="namespacedl_1_1_crypto.html#a588eebba31570c373b102e76dcdd46cd">dl::Crypto::HashSha512</a></div><div class="ttdeci">Buffer HashSha512(BufferView buf)</div><div class="ttdoc">sha512哈希</div></div>
<div class="ttc" id="anamespacedl_1_1_crypto_html_a5d0649b0e1075627ed3cc73f669379ae"><div class="ttname"><a href="namespacedl_1_1_crypto.html#a5d0649b0e1075627ed3cc73f669379ae">dl::Crypto::GenerateKeyAes256</a></div><div class="ttdeci">Aes256Key GenerateKeyAes256()</div><div class="ttdoc">生成Aes256密钥</div></div>
<div class="ttc" id="anamespacedl_1_1_crypto_html_a64bbdbf79345d3aacb4ee7773b435963"><div class="ttname"><a href="namespacedl_1_1_crypto.html#a64bbdbf79345d3aacb4ee7773b435963">dl::Crypto::EncryptXor</a></div><div class="ttdeci">void EncryptXor(BufferView buf)</div><div class="ttdoc">快速异或加密</div></div>
<div class="ttc" id="anamespacedl_1_1_crypto_html_a7630b9cfb5cb627b17203c59119019fc"><div class="ttname"><a href="namespacedl_1_1_crypto.html#a7630b9cfb5cb627b17203c59119019fc">dl::Crypto::EncryptAes256</a></div><div class="ttdeci">Buffer EncryptAes256(BufferView buf, const Aes256Key &amp;key)</div><div class="ttdoc">Aes256加密</div></div>
<div class="ttc" id="anamespacedl_1_1_crypto_html_aafbef59e0ae954b1ce809f0833f14c99"><div class="ttname"><a href="namespacedl_1_1_crypto.html#aafbef59e0ae954b1ce809f0833f14c99">dl::Crypto::DecryptXor</a></div><div class="ttdeci">void DecryptXor(BufferView buf)</div></div>
<div class="ttc" id="anamespacedl_1_1_crypto_html_acc63687e5cc2c2e822182a5dfd4aa934"><div class="ttname"><a href="namespacedl_1_1_crypto.html#acc63687e5cc2c2e822182a5dfd4aa934">dl::Crypto::HashSha256</a></div><div class="ttdeci">Buffer HashSha256(BufferView buf)</div><div class="ttdoc">sha256哈希</div></div>
<div class="ttc" id="anamespacedl_1_1_crypto_html_af285ebfe9f8ebaa0204bab237fd23301"><div class="ttname"><a href="namespacedl_1_1_crypto.html#af285ebfe9f8ebaa0204bab237fd23301">dl::Crypto::EncodeHan256</a></div><div class="ttdeci">std::wstring EncodeHan256(BufferView buf)</div><div class="ttdoc">中文映射编码</div></div>
<div class="ttc" id="astructdl_1_1_crypto_1_1_aes256_key_html"><div class="ttname"><a href="structdl_1_1_crypto_1_1_aes256_key.html">dl::Crypto::Aes256Key</a></div><div class="ttdef"><b>定义</b> <a href="#l00083">dl_crypto.h:84</a></div></div>
<div class="ttc" id="astructdl_1_1_crypto_1_1_aes256_key_html_a547da43e17690dc1f867f5f087897754"><div class="ttname"><a href="structdl_1_1_crypto_1_1_aes256_key.html#a547da43e17690dc1f867f5f087897754">dl::Crypto::Aes256Key::_key</a></div><div class="ttdeci">Buffer _key</div><div class="ttdef"><b>定义</b> <a href="#l00085">dl_crypto.h:85</a></div></div>
<div class="ttc" id="astructdl_1_1_crypto_1_1_aes256_key_html_a7ab2902a1104a9e8030be88025306fe7"><div class="ttname"><a href="structdl_1_1_crypto_1_1_aes256_key.html#a7ab2902a1104a9e8030be88025306fe7">dl::Crypto::Aes256Key::_tag</a></div><div class="ttdeci">Buffer _tag</div><div class="ttdef"><b>定义</b> <a href="#l00087">dl_crypto.h:87</a></div></div>
<div class="ttc" id="astructdl_1_1_crypto_1_1_aes256_key_html_aaf4e8dd7b6acef5de70c8ca79836426b"><div class="ttname"><a href="structdl_1_1_crypto_1_1_aes256_key.html#aaf4e8dd7b6acef5de70c8ca79836426b">dl::Crypto::Aes256Key::_iv</a></div><div class="ttdeci">Buffer _iv</div><div class="ttdef"><b>定义</b> <a href="#l00086">dl_crypto.h:86</a></div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
制作者&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.13.1
</small></address>
</div><!-- doc-content -->
</body>
</html>