自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(14)
  • 收藏
  • 关注

原创 Use windows message to change text in CEdit with timeout control

  When using socket class, usually you have to send your data received from remote peer to upper CDialog class, the basic ways are:    1, pass the windows handle (this or m_hWnd)to socket class ob

2008-07-30 22:34:00 464

原创 test if a string is a number

 int _istdigit(TCHAR): to test if a string is a number. int _ttoi(TCHAR*): is the same as atoi, change a string into a int.    if ( _istdigit( strServiceName[0] ) ) {       nPortNumb

2008-07-30 22:32:00 496

原创 confirm if a file exists

 Before opening  a file, it’s better to confirm if it exists.    WIN32_FIND_DATA  fd;    HANDLE hFile = ::FindFirstFile( fName, &fd );     if ( hFile == INVALID_HANDLE_VALUE )   

2008-07-30 22:23:00 518

原创 Symmetric encryption padding

 Today still debug MAC algorithm in Java card with Xuxu, I have to implement the MAC algorithm but there are so little document on it, I can only try time after time. Girls are always girls, alway

2008-07-30 22:11:00 956

原创 BIO md

 A easier way to digest. Only notes that BIO_f_xx() algorithm is a filter BIO, can’t be used alone, you have to combine a BIO_s_xx() to go with it, which stands for a source BIO. Sample function c

2008-07-28 00:39:00 521

原创 EVP MD

Easy, nothing more to say.Sample code:     const EVP_MD *md = EVP_sha1();    EVP_MD_CTX ctx;    unsigned char md_buf[EVP_MAX_MD_SIZE];    unsigned int mdLen = 0;     EVP_MD_CTX

2008-07-28 00:33:00 2849

原创 EVP cipher

    Symmetric encryption with EVP Steps As follows: notes that cipher buffer length should be one block size longer.  // 1, initial the CTX truct  EVP_CIPHER_CTX_init(&ctx);    // 2,

2008-07-28 00:14:00 3705

原创 Use EVP to generate random key and IV.

  The EVP have provided a function EVP_BytesToKey() to generate session key and initial vector. And we can use the function to separate the input password to gain our secrete key or session key. And

2008-07-28 00:04:00 1198

原创 ASCII and Unicode transfer

    We can use the windows API WideCharToMultiByte()transfer to each other.    The code is as fellows:#ifdef _UNICODE    char pstrService[HOSTNAME_SIZE];    WideCharToMultiByte(CP_AC

2008-07-27 23:55:00 489

原创 Basic way to get local IP

The function is as follow:BOOL getLocalIP(CString &cstrIP){    char strHostname[MAX_PATH] = {0};    hostent* pHost = NULL;     if (SOCKET_ERROR == gethostname(strHostname, sizeof(strHostna

2008-07-15 21:14:00 493

原创 有意思的中间人攻击

  提到网络安全,不得不说说这个“中间人”攻击。 先讲个故事吧,2k年的时候很喜欢五子棋,不管上课下课找人就下,奈何周围高手甚众,屡战屡败,到263的网络游戏找菜鸟pk,也是败多胜少。于是在电脑上修炼,下个中级的电脑都很吃力。发现高级电脑计算精准,妙招频出,忽然想到个点子,可以用电脑帮我赢棋啊。操作如下: 到游戏室找人PK,让对方先手,同时自己先手与本机的高级电脑开局。我把网上对手的每一步

2008-07-12 16:09:00 982

原创 英文水平不够

看了这么久的MSDN、digital TV文档,原以为自己英文水平还不错,可是看了几页外国大牛写的原版书《Security Engineering》(by Ross J. Anderson),备受打击。看过原版一章,再对照中文版扫一下,发现自己只理解了1/3,很多重要信息都漏过去了。虽然中文版译的很烂。原来看Deitel写的书还可以一目十行,可能他写的太温和了。 还是得看原版书,很多schol

2008-07-09 21:57:00 648

原创 Difference between release and debug build when initial a struct

Today meet such a bug, when initial a struct with a redundant bytes, using struct a = {0}; the release build and debug build acts differently! In the debug build, the redundant bytes are filled with

2008-07-07 22:29:00 409

原创 The basic way to support both ASCII and Unicode:

By useing #include , you can support both ASCII and Unicode in your program. The tchar.h header file, defined both way to conduct two kinds of character. Use the macro “_UNICODE” to control if use Uni

2008-07-06 17:12:00 409

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除