亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? entropy.c

?? flint庫 RSA算法
?? C
字號:
/******************************************************************************//*                                                                            *//* Functions for arithmetic and number theory with large integers in C        *//* Software supplement to the book "Cryptography in C and C++"                *//* by Michael Welschenbach                                                    *//*                                                                            *//* Module entropy.c        Revision: 01.07.2002                               *//*                                                                            *//*  Copyright (C) 1998-2005 by Michael Welschenbach                           *//*  Copyright (C) 2001-2005 by Springer-Verlag Berlin, Heidelberg             *//*  Copyright (C) 2001-2005 by Apress L.P., Berkeley, CA                      *//*  Copyright (C) 2002-2005 by Wydawnictwa MIKOM, Poland                      *//*  Copyright (C) 2002-2005 by PHEI, P.R.China                                *//*  Copyright (C) 2002-2005 by InfoBook, Korea                                *//*  Copyright (C) 2002-2005 by Triumph Publishing, Russia                     *//*                                                                            *//*  All Rights Reserved                                                       *//*                                                                            *//*  The software may be used for noncommercial purposes and may be altered,   *//*  as long as the following conditions are accepted without any              *//*  qualification:                                                            *//*                                                                            *//*  (1) All changes to the sources must be identified in such a way that the  *//*      changed software cannot be misinterpreted as the original software.   *//*                                                                            *//*  (2) The statements of copyright may not be removed or altered.            *//*                                                                            *//*  (3) The following DISCLAIMER is accepted:                                 *//*                                                                            *//*  DISCLAIMER:                                                               *//*                                                                            *//*  There is no warranty for the software contained in this distribution, to  *//*  the extent permitted by applicable law. The copyright holders provide the *//*  software `as is' without warranty of any kind, either expressed or        *//*  implied, including, but not limited to, the implied warranty of fitness   *//*  for a particular purpose. The entire risk as to the quality and           *//*  performance of the program is with you.                                   *//*                                                                            *//*  In no event unless required by applicable law or agreed to in writing     *//*  will the copyright holders, or any of the individual authors named in     *//*  the source files, be liable to you for damages, including any general,    *//*  special, incidental or consequential damages arising out of any use of    *//*  the software or out of inability to use the software (including but not   *//*  limited to any financial losses, loss of data or data being rendered      *//*  inaccurate or losses sustained by you or by third parties as a result of  *//*  a failure of the software to operate with any other programs), even if    *//*  such holder or other party has been advised of the possibility of such    *//*  damages.                                                                  *//*                                                                            *//******************************************************************************/#if defined _WIN32 && defined _MSC_VER#include <windows.h>#include <winbase.h>#include <wincrypt.h>#endif /* _WIN32 */#include <stdio.h>#include <stdlib.h>#include <string.h>#include <math.h>#include <time.h>#include "ripemd.h"#include "flint.h"#include "entropy.h"static void * local_memset (void *ptr, int val, size_t len);/******************************************************************************//*                                                                            *//*  Function:   Generation of entropy for initialization of Pseudo-           *//*              randomnumber generators. In addition to a user defined byte   *//*              vector (optional) entropy bytes are read from system specific *//*              sources:                                                      *//*               - For Win32: Value from QueryPerformanceCounter (64 bytes),  *//*                 Values from CryptGenRandom                                 *//*               - For Unix/Linux systems:                                    *//*                 Entropy is read from virtual device /dev/urandom           *//*                 if this source is available.                               *//*              Altogether a number of LenRndStr+AddEntropy bytes are fed     *//*              into the result, which is returned as CLINT-value and in      *//*              addition as Ripemd-160 hashvalue.                             *//*                                                                            *//*              Usage with Windows 9x/ME/NT/2K/XP:                            *//*              -----------------------------------------                     *//*              Usage of Win32-function GenRandom() requires linking with     *//*              advapi32.lib and accessibility of DLL advapi32.dll at runtime *//*              (available under Windows 95 OSR2 and higher, Windows NT 4.x   *//*              Windows 2000, XP).                                            *//*                                                                            *//*  Syntax:     GetEntropy_l (CLINT Seed_l, char *Hashres, int AddEntropy,    *//*                                              char *RndStr, int LenRndStr); *//*  Input:      AddEntropy (Number of entropy btes to be generated)           *//*              RndStr (User defined byte vector, NULL-pointer accepted)      *//*              LenRndStr (Laenge von RndStr in Bytes)                        *//*  Output:     Seed_l (Entropie as CLINT-value. If Seed_l == NULL-pointer    *//*                      no output is given)                                   *//*              Hashres (Entropy as Ripemd-160-hashvalue, length of 20 bytes  *//*                       If Hashres == NULL-pointer no Output is given)       *//*  Returns:    0 if everything is OK                                         *//*              n > 0 if n bytes less than the requested number of entropy    *//*                    bytes could be generated                                *//*              E_CLINT_MAL error in allocation of memory                     *//*                                                                            *//******************************************************************************/int __FLINT_APIGetEntropy_l (CLINT Seed_l, UCHAR *Hashres, int AddEntropy, char *RndStr, int LenRndStr){  unsigned nextfree = 0, MissingEntropy = MAX(AddEntropy, sizeof (time_t));  unsigned i, j;  UCHAR *Seedbytes;  int BytesRead;  int LenSeedbytes = LenRndStr + MissingEntropy +                      sizeof (time_t) + 2*sizeof (ULONG);  RMDSTAT hws;  time_t SeedTime;  FILE *fp;#if defined _WIN32 && defined _MSC_VER  LARGE_INTEGER PCountBuff;  HCRYPTPROV hProvider = 0;#endif /*defined _WIN32 && defined _MSC_VER? */  if ((Seedbytes = (UCHAR*)malloc(LenSeedbytes)) == NULL)    {      return E_CLINT_MAL;    }  if (RndStr != NULL && LenRndStr > 0)    {      memcpy (Seedbytes, RndStr, LenRndStr);#ifdef FLINT_TEST      printf("\nRndStr in Seedbytes = ");        for (i = 0 ; i < LenRndStr; i++)       printf("%.2x ",(unsigned char)Seedbytes[nextfree+i]);#endif /* FLINT_TEST */      nextfree = LenRndStr;    }         SeedTime = (time_t)time(NULL);  /* System time in Seed */  for (i = 0; i < sizeof(time_t); i++)     {      j = i << 3;      /* right shift of signed SeedTime doesn't matter, turn lint off */      Seedbytes[nextfree+i] = (UCHAR)((SeedTime >> j) & (time_t)0xff); /*lint !e704, !e713 */    }#ifdef FLINT_TEST  printf("\nWert Time in Seedbytes = ");  for (i = 0 ; i < sizeof (time_t); i++)     printf("%.2x ",(unsigned char)Seedbytes[nextfree+i]);#endif /* FLINT_TEST */  nextfree += sizeof (time_t);  MissingEntropy -= sizeof (time_t);#if defined _WIN32 && defined _MSC_VER   /* Get Win32-generated Entropy */  if (MissingEntropy)    {  /* Chaining with 64-bit-value QueryPerformanceCounter() (Win32-Function) */      QueryPerformanceCounter (&PCountBuff);      for (i = 0; i < sizeof (DWORD); i++)        {          j = i << 3;          Seedbytes[nextfree + i] =             (char)((PCountBuff.HighPart >> j) & (DWORD)0xff);           Seedbytes[nextfree + sizeof (DWORD) + i] =             (char)((PCountBuff.LowPart >> j) & (DWORD)0xff);         }#ifdef FLINT_TEST      printf("\nWert PerformanceCounter in Seedbytes = ");      for (i = 0; i < 2*sizeof (DWORD); i++)         printf("%.2x ",(unsigned char)Seedbytes[nextfree+i]);#endif      nextfree += 2*sizeof (DWORD);      MissingEntropy -= 2*sizeof (DWORD);    }  /* Chaining with output from CryptGenRandom() (Win32-Function) */  if (CryptAcquireContext(&hProvider,       NULL,       NULL,       PROV_RSA_FULL,       CRYPT_VERIFYCONTEXT))    {      if (CryptGenRandom (hProvider,                           MissingEntropy,                           &Seedbytes[nextfree]))        {#ifdef FLINT_TEST          printf("\nWert CryptGenRandom in Seedbytes = ");          for (i = 0 ; i < MissingEntropy; i++)             printf("%.2x ",(unsigned char)Seedbytes[nextfree+i]);          printf("\n");#endif /* FLINT_TEST */          nextfree += MissingEntropy;          MissingEntropy = 0;        }    }  if (hProvider)    {      CryptReleaseContext (hProvider, 0);    }#endif  /* defined _WIN32 && _MSC_VER *//* Get entropy from /dev/urandom if available */  if ((fp = fopen("/dev/urandom", "r")) != NULL)     {      BytesRead = fread(&Seedbytes[nextfree], sizeof (UCHAR), MissingEntropy, fp);#ifdef FLINT_TEST      printf("\nWert aus /dev/urandom in Seedbytes = ");      for (i = 0; i < BytesRead; i++)         printf("%.2x ",(unsigned char)Seedbytes[nextfree+i]);      printf("\n");#endif /* FLINT_TEST */      nextfree += BytesRead;      MissingEntropy -= BytesRead;      fclose (fp);    }  /* Hashing of chained entropy-values */  if (Hashres != NULL)    {      ripeinit (&hws);      ripefinish (Hashres, &hws, Seedbytes, nextfree);#ifdef FLINT_TEST      printf("\nHashwert in Hashres = ");      for (i = 0; i < 20; i++) printf("%.2x ", (unsigned char)Hashres[i]);      printf("\n");#endif /* FLINT_TEST */    }  /* Seed as CLINT-values */  if (Seed_l != NULL)    {      byte2clint_l (Seed_l, Seedbytes, nextfree);#ifdef FLINT_TEST      disp_l ("Random Seed in Seed_l = ", Seed_l);#endif /* FLINT_TEST */    }  /* Security: Purge Seed by overwriting with 0 */  SeedTime = 0;  local_memset (Seedbytes, 0, LenSeedbytes);  local_memset (&hws, 0, sizeof (hws));  free (Seedbytes);  return MissingEntropy;}/******************************************************************************//*                                                                            *//*  Function:   Calculation of the entropy of a password from the             *//*              number of characters of the underlying alphabet and number    *//*              of characters of the password itself, using the formular      *//*                        Entropie = log2 (n^m)                               *//*              with n the size of the alphabet and m the size of the         *//*              password in characters.                                       *//*              This value is important for the calculation of a              *//*              cryptographic key from a password. If all printable ASCII-    *//*              characters can be used for a password (93 characters), then   *//*              the password should have                                      *//*               - 20 characters for generating a key of 128-bit length       *//*               - 30 characters for generating a key of 192-bit length       *//*               - 40 characters for generating a key of 256-bit length.      *//*  Syntax:     int PWDQual_l (char *pwd, int len_pwd, int len_alpha);        *//*  Input:      char *PWD (Password, RFU, not beeing evaluated here)          *//*              int LenPWD (Length of the password in characters)             *//*              int LenAlpha (Size of the alphabet in characters)             *//*  Output:     -                                                             *//*  Returns:    Entropy of password                                           *//*                                                                            *//******************************************************************************/int __FLINT_APIPWDQual_l (char *PWD, int LenPWD, int LenAlpha){  return (int)((double)LenAlpha * log10 (LenPWD) / log10 (2));}/******************************************************************************//*                                                                            *//* Local memset-Function, does the same as memset()                           *//* Needed to make compiler purge variables in spite of optimization.          *//*                                                                            *//******************************************************************************/static void *local_memset (void *ptr, int val, size_t len){    return memset (ptr, val, len);}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品一二三四在线| 精品伊人久久久久7777人| 欧美日韩在线免费视频| 偷拍自拍另类欧美| 国产精品乱码人人做人人爱| 欧美在线观看视频一区二区| 精品一区二区三区在线视频| 亚洲老司机在线| 日本一区二区综合亚洲| 日韩午夜三级在线| 欧美在线免费播放| 欧美午夜一区二区| 一本色道亚洲精品aⅴ| 国产xxx精品视频大全| 久久97超碰色| 伦理电影国产精品| 一区二区三区影院| 亚洲美女在线国产| 亚洲精品中文字幕乱码三区| 国产精品女人毛片| 国产精品久久精品日日| 国产亚洲精久久久久久| 国产亚洲一区二区三区在线观看 | 精东粉嫩av免费一区二区三区| 日本91福利区| 精品一区二区三区在线视频| 狠狠色丁香婷婷综合| 国产最新精品精品你懂的| 国产精品99久久久久久有的能看| 久久国产精品第一页| 国产成人在线视频播放| zzijzzij亚洲日本少妇熟睡| 91麻豆免费在线观看| 欧美久久一区二区| 国产亚洲短视频| 亚洲国产毛片aaaaa无费看| 日韩成人精品在线观看| 精品一区二区三区久久| aaa亚洲精品| 欧美一区二区三区白人| 国产日产亚洲精品系列| 亚洲女同ⅹxx女同tv| 久久国产精品露脸对白| 91欧美一区二区| 精品免费一区二区三区| 日韩理论片中文av| 国产麻豆91精品| 制服丝袜在线91| 日韩一区有码在线| 国产一区二区三区免费观看| 欧美在线你懂得| 国产精品久久久久久久久免费樱桃| 亚洲一卡二卡三卡四卡无卡久久| 老司机精品视频一区二区三区| 97超碰欧美中文字幕| 精品久久免费看| 日本va欧美va欧美va精品| 一本色道a无线码一区v| 国产精品人妖ts系列视频| 麻豆精品久久精品色综合| 色婷婷一区二区三区四区| 国产精品视频线看| 国产精品综合一区二区| 久久亚洲一级片| 精品一区二区久久久| 欧美一卡二卡在线| 免费精品视频最新在线| 欧美一区2区视频在线观看| 日一区二区三区| 日韩一区二区免费在线电影| 午夜久久久久久电影| 欧美一区二区三区男人的天堂| 亚洲国产sm捆绑调教视频| 在线视频国内自拍亚洲视频| 亚洲女子a中天字幕| 在线观看亚洲一区| 亚洲va欧美va国产va天堂影院| 欧美日韩精品系列| 久久 天天综合| 国产精品三级在线观看| 99久久婷婷国产| 亚洲伊人色欲综合网| 欧美日韩免费观看一区三区| 视频一区在线视频| 26uuu成人网一区二区三区| 国产成人午夜视频| 综合色中文字幕| 欧美日韩视频第一区| 精东粉嫩av免费一区二区三区| 国产女人18毛片水真多成人如厕 | 亚洲一区二区在线免费观看视频 | 国产午夜精品久久久久久久| 91香蕉视频污在线| 日韩专区一卡二卡| 国产精品拍天天在线| 欧美人与禽zozo性伦| 国产成人在线观看免费网站| 亚洲精选免费视频| 精品国偷自产国产一区| 色婷婷综合久久久久中文 | 91久久精品网| 国产精品自拍网站| 午夜欧美视频在线观看| 国产精品国产三级国产三级人妇| 欧美日韩一区二区在线观看| 不卡av在线网| 国产精品综合二区| 亚洲视频综合在线| 99久免费精品视频在线观看| 国产欧美日韩另类视频免费观看| 日本亚洲最大的色成网站www| 久久看人人爽人人| 欧美一级电影网站| 欧美精品丝袜中出| 91蜜桃网址入口| 成人性生交大片免费看中文网站| 麻豆成人91精品二区三区| 午夜精品aaa| 视频精品一区二区| 午夜视黄欧洲亚洲| 看国产成人h片视频| 日日噜噜夜夜狠狠视频欧美人 | 国产精品美女一区二区三区 | 国产传媒一区在线| 在线观看免费成人| 精品对白一区国产伦| 日韩专区在线视频| 欧美日韩免费观看一区二区三区 | 国产麻豆成人传媒免费观看| 欧美一区二区三级| 首页亚洲欧美制服丝腿| 日韩欧美成人一区| 久久精品999| 精品国产91亚洲一区二区三区婷婷 | 欧美日韩国产一二三| 日韩成人一区二区| 4438成人网| 成人晚上爱看视频| 亚洲人成影院在线观看| 欧美亚洲综合久久| 久久机这里只有精品| 亚洲欧洲av在线| 欧美视频自拍偷拍| 激情综合网天天干| 中文字幕视频一区二区三区久| 欧美午夜不卡在线观看免费| 日本大胆欧美人术艺术动态| 久久久久国产精品麻豆ai换脸| av爱爱亚洲一区| 午夜久久久久久久久| 久久综合丝袜日本网| 欧美色手机在线观看| 麻豆国产欧美日韩综合精品二区 | 国产91精品精华液一区二区三区| 精品国产污网站| 一本一道久久a久久精品| 五月婷婷色综合| 久久蜜桃香蕉精品一区二区三区| 99久久精品免费看国产免费软件| 亚洲成人免费影院| 久久人人97超碰com| 一本一道久久a久久精品| 理论电影国产精品| 国产精品欧美一区二区三区| 94-欧美-setu| 日本aⅴ精品一区二区三区| 国产精品区一区二区三区 | 最新热久久免费视频| 日韩在线卡一卡二| 91在线视频官网| 日韩亚洲欧美成人一区| 亚洲激情图片qvod| 亚洲天堂精品在线观看| 一级日本不卡的影视| 久久99久久99| av电影在线观看完整版一区二区| 欧美亚洲精品一区| 亚洲欧美日韩在线不卡| 亚洲一区二区三区四区的| 狠狠色狠狠色综合系列| 91成人网在线| 亚洲成人激情综合网| 色欧美片视频在线观看| 国产精品国产三级国产aⅴ入口| 亚洲 欧美综合在线网络| 成人高清免费在线播放| 国产精品免费观看视频| 国产精品一区不卡| 中文字幕一区二| av一本久道久久综合久久鬼色| 国产欧美一区二区精品久导航| 美女爽到高潮91| 精品伦理精品一区| 成人国产精品视频| 亚洲欧美日本韩国| 欧美日韩国产三级| 国产在线播精品第三| 欧美xxxxx牲另类人与| 国产乱码精品一区二区三区忘忧草 | 久久精品人人做人人综合|