/usr/share/doc/ucommon-doc/html/a00769.html is in ucommon-doc 7.0.0-9.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | <!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.12"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>UCommon: cipher.cpp</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 id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">UCommon
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.12 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
initMenu('',false,false,'search.php','Search');
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">cipher.cpp</div> </div>
</div><!--header-->
<div class="contents">
<p>Example of cipher code.</p>
<div class="fragment"><div class="line"><span class="comment">// Copyright (C) 2006-2014 David Sugar, Tycho Softworks.</span></div><div class="line"><span class="comment">// Copyright (C) 2015 Cherokees of Idaho.</span></div><div class="line"><span class="comment">//</span></div><div class="line"><span class="comment">// This file is part of GNU uCommon C++.</span></div><div class="line"><span class="comment">//</span></div><div class="line"><span class="comment">// GNU uCommon C++ is free software: you can redistribute it and/or modify</span></div><div class="line"><span class="comment">// it under the terms of the GNU Lesser General Public License as published</span></div><div class="line"><span class="comment">// by the Free Software Foundation, either version 3 of the License, or</span></div><div class="line"><span class="comment">// (at your option) any later version.</span></div><div class="line"><span class="comment">//</span></div><div class="line"><span class="comment">// GNU uCommon C++ is distributed in the hope that it will be useful,</span></div><div class="line"><span class="comment">// but WITHOUT ANY WARRANTY; without even the implied warranty of</span></div><div class="line"><span class="comment">// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span></div><div class="line"><span class="comment">// GNU Lesser General Public License for more details.</span></div><div class="line"><span class="comment">//</span></div><div class="line"><span class="comment">// You should have received a copy of the GNU Lesser General Public License</span></div><div class="line"><span class="comment">// along with GNU uCommon C++. If not, see <http://www.gnu.org/licenses/>.</span></div><div class="line"></div><div class="line"><span class="preprocessor">#ifndef DEBUG</span></div><div class="line"><span class="preprocessor">#define DEBUG</span></div><div class="line"><span class="preprocessor">#endif</span></div><div class="line"></div><div class="line"><span class="preprocessor">#include <ucommon-config.h></span></div><div class="line"><span class="preprocessor">#include <<a class="code" href="a00473.html">ucommon/secure.h</a>></span></div><div class="line"></div><div class="line"><span class="preprocessor">#include <stdio.h></span></div><div class="line"></div><div class="line"><span class="keyword">using namespace </span><a class="code" href="a00563.html">ucommon</a>;</div><div class="line"></div><div class="line"><span class="preprocessor">#define STR "this is a test of some text we wish to post"</span></div><div class="line"></div><div class="line"><span class="keywordtype">int</span> main(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> **argv)</div><div class="line">{</div><div class="line"> <span class="keywordflow">if</span>(!<a name="a0"></a><a class="code" href="a00464.html#afe8e952d8c396ae9dc6d4bfd7a134a42">secure::init</a>())</div><div class="line"> <span class="keywordflow">return</span> 0;</div><div class="line"></div><div class="line"> <a class="code" href="a00563.html#a6fc0e947d5804f6c146674fa3b7042c2">skey_t</a> mykey(<span class="stringliteral">"aes256"</span>, <span class="stringliteral">"sha"</span>, <span class="stringliteral">"testing"</span>);</div><div class="line"> <a class="code" href="a00563.html#a249b7f159cb1ba294206586ca8aeb4af">cipher_t</a> enc, dec;</div><div class="line"> uint8_t ebuf[256], dbuf[256];</div><div class="line"></div><div class="line"> memset(dbuf, 0, <span class="keyword">sizeof</span>(dbuf));</div><div class="line"></div><div class="line"> enc.set(&mykey, Cipher::ENCRYPT, ebuf);</div><div class="line"> dec.set(&mykey, Cipher::DECRYPT, dbuf);</div><div class="line"></div><div class="line"> <span class="keywordtype">size_t</span> total = enc.puts(STR);</div><div class="line"></div><div class="line"> assert(!<a name="a1"></a><a class="code" href="a00563.html#a234bf410b2784ea31e5b72bebcc72516">eq</a>(STR, (<span class="keywordtype">char</span> *)ebuf, strlen(STR)));</div><div class="line"></div><div class="line"> assert(total == 48);</div><div class="line"></div><div class="line"> dec.put(ebuf, total);</div><div class="line"> dec.flush();</div><div class="line"> assert(<a class="code" href="a00563.html#a234bf410b2784ea31e5b72bebcc72516">eq</a>((<span class="keywordtype">char</span> *)dbuf, STR));</div><div class="line"> <span class="keywordflow">return</span> 0;</div><div class="line">}</div><div class="line"></div></div><!-- fragment --> </div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.12
</small></address>
</body>
</html>
|