资源简介
前段时间看了下libevent的文档,把代码搞过来看了一下,做了一个vs的工程,花了一两个小时。免得下次又弄这些无谓的工作,上传到共享里。有需要的朋友也可以省点时间。工程是vs2008的,到其他版本也是可以使用的。

代码片段和文件信息
/* Portable arc4random.c based on arc4random.c from OpenBSD.
* Portable version by Chris Davis adapted for Libevent by Nick Mathewson
* Copyright (c) 2010 Chris Davis Niels Provos and Nick Mathewson
* Copyright (c) 2010-2012 Niels Provos and Nick Mathewson
*
* Note that in Libevent this file isn‘t compiled directly. Instead
* it‘s included from evutil_rand.c
*/
/*
* Copyright (c) 1996 David Mazieres
* Copyright (c) 2008 Damien Miller
*
* Permission to use copy modify and distribute this software for any
* purpose with or without fee is hereby granted provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED “AS IS“ AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL DIRECT INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE DATA OR PROFITS WHETHER IN AN
* ACTION OF CONTRACT NEGLIGENCE OR OTHER TORTIOUS ACTION ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*
* Arc4 random number generator for OpenBSD.
*
* This code is derived from section 17.1 of Applied Cryptography
* second edition which describes a stream cipher allegedly
* compatible with RSA Labs “RC4“ cipher (the actual description of
* which is a trade secret). The same algorithm is used as a stream
* cipher called “arcfour“ in Tatu Ylonen‘s ssh package.
*
* Here the stream cipher has been modified always to include the time
* when initializing the state. That makes it impossible to
* regenerate the same random sequence twice so this can‘t be used
* for encryption but will generate good random numbers.
*
* RC4 is a registered trademark of RSA Laboratories.
*/
#ifndef ARC4RANDOM_EXPORT
#define ARC4RANDOM_EXPORT
#endif
#ifndef ARC4RANDOM_UINT32
#define ARC4RANDOM_UINT32 uint32_t
#endif
#ifndef ARC4RANDOM_NO_INCLUDES
#ifdef WIN32
#include
#include
#else
#include
#include
#include
#include
#ifdef _EVENT_HAVE_SYS_SYSCTL_H
#include
#endif
#endif
#include
#include
#include
#endif
/* Add platform entropy 32 bytes (256 bits) at a time. */
#define ADD_ENTROPY 32
/* Re-seed from the platform RNG after generating this many bytes. */
#define BYTES_BEFORE_RESEED 1600000
struct arc4_stream {
unsigned char i;
unsigned char j;
unsigned char s[256];
};
#ifdef WIN32
#define getpid _getpid
#define pid_t int
#endif
static int rs_initialized;
static struct arc4_stream rs;
static pid_t arc4_stir_pid;
static int arc4_count;
static int arc4_seeded_ok;
static inline unsigned char arc4_getbyte(void);
static inline void
arc4_init(void)
{
int n;
for (n = 0; n < 256; n++)
rs.s[n] = n;
rs.i = 0;
rs.j = 0;
}
st
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 36789 2012-11-19 23:13 libevent\aclocal.m4
文件 12719 2012-02-12 10:10 libevent\arc4random.c
文件 308 2012-02-11 06:17 libevent\autogen.sh
文件 72383 2014-11-16 21:23 libevent\buffer.c
文件 15801 2012-02-11 06:17 libevent\bufferevent-internal.h
文件 22547 2012-08-23 23:31 libevent\bufferevent.c
文件 18234 2012-02-11 06:17 libevent\bufferevent_async.c
文件 15048 2012-02-11 06:17 libevent\bufferevent_filter.c
文件 37962 2012-11-17 08:22 libevent\bufferevent_openssl.c
文件 8815 2012-02-11 06:17 libevent\bufferevent_pair.c
文件 28521 2012-02-11 06:17 libevent\bufferevent_ratelim.c
文件 17806 2012-11-02 02:00 libevent\bufferevent_sock.c
文件 8604 2012-02-11 06:17 libevent\buffer_iocp.c
文件 4562 2012-02-11 06:17 libevent\changelist-internal.h
文件 88277 2012-11-18 14:34 libevent\ChangeLog
文件 16673 2012-02-11 06:17 libevent\compat\sys\queue.h
文件 7274 2012-11-19 23:13 libevent\compile
文件 44826 2012-11-19 23:13 libevent\config.guess
文件 11968 2012-11-19 23:13 libevent\config.h.in
文件 35454 2012-11-19 23:13 libevent\config.sub
文件 504592 2012-11-19 23:13 libevent\configure
文件 21849 2012-11-18 14:34 libevent\configure.in
文件 3698 2012-02-11 06:17 libevent\defer-internal.h
文件 20899 2012-11-19 23:13 libevent\depcomp
文件 7793 2014-11-22 17:42 libevent\devpoll.c
文件 10206 2012-02-11 06:17 libevent\Doxyfile
文件 13079 2012-02-11 06:17 libevent\epoll.c
文件 2020 2012-02-11 06:17 libevent\epoll_sub.c
文件 10546 2012-02-11 06:17 libevent\evbuffer-internal.h
文件 127701 2012-11-02 02:00 libevent\evdns.c
............此处省略179个文件信息
- 上一篇:Databa
se Desktop - 下一篇:CANopen协议栈源代码详解
相关资源
- vspd7.2.308.zip
- CVSNT 完整覆盖版防TortoiseCVS中文乱码
- VisualStudioUninstaller vs卸载工具
- vSphere6.06.56.7通用版注册机
- ado数据库MFC图书管理系统vs2010
- vs2005骑士巡游问题-分治法C
-
解决安装vs2012后vs2010 li
nk : fatal er - VMware vSphere 的 Intel 82579LM网卡驱动 最
- VisualSVN-VS2019V7.0解除时间限制
- librdkafka win7 64位 vs2015编译Release版本
- VS1053B编解码器的VDR分布式声音采集卡
- VS六种配色方案(工具-导入和导出设
- VS2012OpenGL配置所需要的全部libdllh文件
- 串口模拟器支持win10
- Visual Assist X for vs2005
- VisualSVN-VS2019-7.1.2破解版
- Visual_Assist_X VS2008专用
- Kvsc3.exe、Kvsc3.dll病毒查杀清除方法
- VisualSVN 6.0.4 破解版(支持VS2017)
- CVSNT中文完美稳定版
- AnkhSvn-2.6.12735 支持VS2010-VS2015 官方原版
- Libevent官方原版高清帮助文档
- Visual Studio 2017企业版 Enterprise,专业版
- VS2017_Professional_15.5.7+密钥
- VS2010、VS2012、VS2013代码自动注释插件
- ArangoDB vs. JanusGraph vs. Neo4j vs. OrientDB
- 插件式GIS应用框架的设计与实现&mda
- 通过x264录制RGB屏幕视频vs2013工程,
- Microsoft Visual Studio 2017 Installer Project
- VSuite Ramdisk Server V4.6.7 真正破解版(修
评论
共有 条评论