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

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

?? mpi.c

?? 最新版本的加密解密算法庫
?? C
?? 第 1 頁 / 共 5 頁
字號:
 * guarantee it works. * * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org */#include <ltc_tommath.h>/* reduce "x" in place modulo "n" using the Diminished Radix algorithm. * * Based on algorithm from the paper * * "Generating Efficient Primes for Discrete Log Cryptosystems" *                 Chae Hoon Lim, Pil Loong Lee, *          POSTECH Information Research Laboratories * * The modulus must be of a special format [see manual] * * Has been modified to use algorithm 7.10 from the LTM book instead * * Input x must be in the range 0 <= x <= (n-1)**2 */intmp_dr_reduce (mp_int * x, mp_int * n, mp_digit k){  int      err, i, m;  mp_word  r;  mp_digit mu, *tmpx1, *tmpx2;  /* m = digits in modulus */  m = n->used;  /* ensure that "x" has at least 2m digits */  if (x->alloc < m + m) {    if ((err = mp_grow (x, m + m)) != MP_OKAY) {      return err;    }  }/* top of loop, this is where the code resumes if * another reduction pass is required. */top:  /* aliases for digits */  /* alias for lower half of x */  tmpx1 = x->dp;  /* alias for upper half of x, or x/B**m */  tmpx2 = x->dp + m;  /* set carry to zero */  mu = 0;  /* compute (x mod B**m) + k * [x/B**m] inline and inplace */  for (i = 0; i < m; i++) {      r         = ((mp_word)*tmpx2++) * ((mp_word)k) + *tmpx1 + mu;      *tmpx1++  = (mp_digit)(r & MP_MASK);      mu        = (mp_digit)(r >> ((mp_word)DIGIT_BIT));  }  /* set final carry */  *tmpx1++ = mu;  /* zero words above m */  for (i = m + 1; i < x->used; i++) {      *tmpx1++ = 0;  }  /* clamp, sub and return */  mp_clamp (x);  /* if x >= n then subtract and reduce again   * Each successive "recursion" makes the input smaller and smaller.   */  if (mp_cmp_mag (x, n) != MP_LT) {    s_mp_sub(x, n, x);    goto top;  }  return MP_OKAY;}/* End: bn_mp_dr_reduce.c *//* Start: bn_mp_dr_setup.c *//* LibTomMath, multiple-precision integer library -- Tom St Denis * * LibTomMath is a library that provides multiple-precision * integer arithmetic as well as number theoretic functionality. * * The library was designed directly after the MPI library by * Michael Fromberger but has been written from scratch with * additional optimizations in place. * * The library is free for all purposes without any express * guarantee it works. * * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org */#include <ltc_tommath.h>/* determines the setup value */void mp_dr_setup(mp_int *a, mp_digit *d){   /* the casts are required if DIGIT_BIT is one less than    * the number of bits in a mp_digit [e.g. DIGIT_BIT==31]    */   *d = (mp_digit)((((mp_word)1) << ((mp_word)DIGIT_BIT)) -         ((mp_word)a->dp[0]));}/* End: bn_mp_dr_setup.c *//* Start: bn_mp_exch.c *//* LibTomMath, multiple-precision integer library -- Tom St Denis * * LibTomMath is a library that provides multiple-precision * integer arithmetic as well as number theoretic functionality. * * The library was designed directly after the MPI library by * Michael Fromberger but has been written from scratch with * additional optimizations in place. * * The library is free for all purposes without any express * guarantee it works. * * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org */#include <ltc_tommath.h>/* swap the elements of two integers, for cases where you can't simply swap the  * mp_int pointers around */voidmp_exch (mp_int * a, mp_int * b){  mp_int  t;  t  = *a;  *a = *b;  *b = t;}/* End: bn_mp_exch.c *//* Start: bn_mp_expt_d.c *//* LibTomMath, multiple-precision integer library -- Tom St Denis * * LibTomMath is a library that provides multiple-precision * integer arithmetic as well as number theoretic functionality. * * The library was designed directly after the MPI library by * Michael Fromberger but has been written from scratch with * additional optimizations in place. * * The library is free for all purposes without any express * guarantee it works. * * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org */#include <ltc_tommath.h>/* calculate c = a**b  using a square-multiply algorithm */int mp_expt_d (mp_int * a, mp_digit b, mp_int * c){  int     res, x;  mp_int  g;  if ((res = mp_init_copy (&g, a)) != MP_OKAY) {    return res;  }  /* set initial result */  mp_set (c, 1);  for (x = 0; x < (int) DIGIT_BIT; x++) {    /* square */    if ((res = mp_sqr (c, c)) != MP_OKAY) {      mp_clear (&g);      return res;    }    /* if the bit is set multiply */    if ((b & (mp_digit) (((mp_digit)1) << (DIGIT_BIT - 1))) != 0) {      if ((res = mp_mul (c, &g, c)) != MP_OKAY) {         mp_clear (&g);         return res;      }    }    /* shift to next bit */    b <<= 1;  }  mp_clear (&g);  return MP_OKAY;}/* End: bn_mp_expt_d.c *//* Start: bn_mp_exptmod.c *//* LibTomMath, multiple-precision integer library -- Tom St Denis * * LibTomMath is a library that provides multiple-precision * integer arithmetic as well as number theoretic functionality. * * The library was designed directly after the MPI library by * Michael Fromberger but has been written from scratch with * additional optimizations in place. * * The library is free for all purposes without any express * guarantee it works. * * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org */#include <ltc_tommath.h>/* this is a shell function that calls either the normal or Montgomery * exptmod functions.  Originally the call to the montgomery code was * embedded in the normal function but that wasted alot of stack space * for nothing (since 99% of the time the Montgomery code would be called) */int mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y){  int dr;  /* modulus P must be positive */  if (P->sign == MP_NEG) {     return MP_VAL;  }  /* if exponent X is negative we have to recurse */  if (X->sign == MP_NEG) {     mp_int tmpG, tmpX;     int err;     /* first compute 1/G mod P */     if ((err = mp_init(&tmpG)) != MP_OKAY) {        return err;     }     if ((err = mp_invmod(G, P, &tmpG)) != MP_OKAY) {        mp_clear(&tmpG);        return err;     }     /* now get |X| */     if ((err = mp_init(&tmpX)) != MP_OKAY) {        mp_clear(&tmpG);        return err;     }     if ((err = mp_abs(X, &tmpX)) != MP_OKAY) {        mp_clear_multi(&tmpG, &tmpX, NULL);        return err;     }     /* and now compute (1/G)**|X| instead of G**X [X < 0] */     err = mp_exptmod(&tmpG, &tmpX, P, Y);     mp_clear_multi(&tmpG, &tmpX, NULL);     return err;  }  /* is it a DR modulus? */  dr = mp_dr_is_modulus(P);  /* if not, is it a uDR modulus? */  if (dr == 0) {     dr = mp_reduce_is_2k(P) << 1;  }      /* if the modulus is odd or dr != 0 use the fast method */  if (mp_isodd (P) == 1 || dr !=  0) {    return mp_exptmod_fast (G, X, P, Y, dr);  } else {    /* otherwise use the generic Barrett reduction technique */    return s_mp_exptmod (G, X, P, Y);  }}/* End: bn_mp_exptmod.c *//* Start: bn_mp_exptmod_fast.c *//* LibTomMath, multiple-precision integer library -- Tom St Denis * * LibTomMath is a library that provides multiple-precision * integer arithmetic as well as number theoretic functionality. * * The library was designed directly after the MPI library by * Michael Fromberger but has been written from scratch with * additional optimizations in place. * * The library is free for all purposes without any express * guarantee it works. * * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org */#include <ltc_tommath.h>/* computes Y == G**X mod P, HAC pp.616, Algorithm 14.85 * * Uses a left-to-right k-ary sliding window to compute the modular exponentiation. * The value of k changes based on the size of the exponent. * * Uses Montgomery or Diminished Radix reduction [whichever appropriate] */#ifdef MP_LOW_MEM   #define TAB_SIZE 32#else   #define TAB_SIZE 256#endifintmp_exptmod_fast (mp_int * G, mp_int * X, mp_int * P, mp_int * Y, int redmode){  mp_int  M[TAB_SIZE], res;  mp_digit buf, mp;  int     err, bitbuf, bitcpy, bitcnt, mode, digidx, x, y, winsize;  /* use a pointer to the reduction algorithm.  This allows us to use   * one of many reduction algorithms without modding the guts of   * the code with if statements everywhere.   */  int     (*redux)(mp_int*,mp_int*,mp_digit);  /* find window size */  x = mp_count_bits (X);  if (x <= 7) {    winsize = 2;  } else if (x <= 36) {    winsize = 3;  } else if (x <= 140) {    winsize = 4;  } else if (x <= 450) {    winsize = 5;  } else if (x <= 1303) {    winsize = 6;  } else if (x <= 3529) {    winsize = 7;  } else {    winsize = 8;  }#ifdef MP_LOW_MEM  if (winsize > 5) {     winsize = 5;  }#endif  /* init M array */  /* init first cell */  if ((err = mp_init(&M[1])) != MP_OKAY) {     return err;  }  /* now init the second half of the array */  for (x = 1<<(winsize-1); x < (1 << winsize); x++) {    if ((err = mp_init(&M[x])) != MP_OKAY) {      for (y = 1<<(winsize-1); y < x; y++) {        mp_clear (&M[y]);      }      mp_clear(&M[1]);      return err;    }  }  /* determine and setup reduction code */  if (redmode == 0) {     /* now setup montgomery  */     if ((err = mp_montgomery_setup (P, &mp)) != MP_OKAY) {        goto __M;     }     /* automatically pick the comba one if available (saves quite a few calls/ifs) */     if (((P->used * 2 + 1) < MP_WARRAY) &&          P->used < (1 << ((CHAR_BIT * sizeof (mp_word)) - (2 * DIGIT_BIT)))) {        redux = fast_mp_montgomery_reduce;     } else {        /* use slower baseline Montgomery method */        redux = mp_montgomery_reduce;     }  } else if (redmode == 1) {     /* setup DR reduction for moduli of the form B**k - b */     mp_dr_setup(P, &mp);     redux = mp_dr_reduce;  } else {     /* setup DR reduction for moduli of the form 2**k - b */     if ((err = mp_reduce_2k_setup(P, &mp)) != MP_OKAY) {        goto __M;     }     redux = mp_reduce_2k;  }  /* setup result */  if ((err = mp_init (&res)) != MP_OKAY) {    goto __M;  }  /* create M table   *   * The M table contains powers of the input base, e.g. M[x] = G^x mod P   *   * The first half of the table is not computed though accept for M[0] and M[1]   */  if (redmode == 0) {     /* now we need R mod m */     if ((err = mp_montgomery_calc_normalization (&res, P)) != MP_OKAY) {       goto __RES;     }     /* now set M[1] to G * R mod m */     if ((err = mp_mulmod (G, &res, P, &M[1])) != MP_OKAY) {       goto __RES;     }  } else {     mp_set(&res, 1);     if ((err = mp_mod(G, P, &M[1])) != MP_OKAY) {        goto __RES;     }  }  /* compute the value at M[1<<(winsize-1)] by squaring M[1] (winsize-1) times */  if ((err = mp_copy (&M[1], &M[1 << (winsize - 1)])) != MP_OKAY) {    goto __RES;  }  for (x = 0; x < (winsize - 1); x++) {    if ((err = mp_sqr (&M[1 << (winsize - 1)], &M[1 << (winsize - 1)])) != MP_OKAY) {      goto __RES;    }    if ((err = redux (&M[1 << (winsize - 1)], P, mp)) != MP_OKAY) {      goto __RES;    }  }  /* create upper table */  for (x = (1 << (winsize - 1)) + 1; x < (1 << winsize); x++) {    if ((err = mp_mul (&M[x - 1], &M[1], &M[x])) != MP_OKAY) {      goto __RES;    }    if ((err = redux (&M[x], P, mp)) != MP_OKAY) {      goto __RES;    }  }  /* set initial mode and bit cnt */  mode   = 0;  bitcnt = 1;  buf    = 0;  digidx = X->used - 1;  bitcpy = 0;  bitbuf = 0;  for (;;) {    /* grab next digit as required */    if (--bitcnt == 0) {      /* if digidx == -1 we are out of digits so break */      if (digidx == -1) {        break;      }      /* read next digit and reset bitcnt */      buf    = X->dp[digidx--];      bitcnt = (int)DIGIT_BIT;    }    /* grab the next msb from the exponent */    y     = (mp_digit)(buf >> (DIGIT_BIT - 1)) & 1;    buf <<= (mp_digit)1;    /* if the bit is zero and mode == 0 then we ignore it     * These represent the leading zero bits before the first 1 bit     * in the exponent.  Technically this opt is not required but it     * does lower the # of trivial squaring/reductions used     */    if (mode == 0 && y == 0) {      continue;    }    /* if the bit is zero and mode == 1 then we square */    if (mode == 1 && y == 0) {      if ((err = mp_sqr (&res, &res)) != MP_OKAY) {        goto __RES;      }      if ((err = redux (&res, P, mp)) != MP_OKAY) {        goto __RES;      }      continue;    }    /* else we add it to the window */    bitbuf |= (y << (winsize - ++bitcpy));    mode    = 2;    if (bitcpy == winsize) {      /* ok window is filled so square as required and multiply  */      /* square first */      for (x = 0; x < winsize; x++) {        if ((err = mp_sqr (&res, &res)) != MP_OKAY) {          goto __RES;        }        if ((err = redux (&res, P, mp)) != MP_OKAY) {          goto __RES;        }      }      /* then multiply */      if ((err = mp_mul (&res, &M[bitbuf], &res)) != MP_OKAY) {        goto __RES;      }      if ((err = redux (&res, P, mp)) != MP_OKAY) {        goto __RES;      }      /* empty window and reset */      bitcpy = 0;      bitbuf = 0;      mode   = 1;    }  }  /* if bits remain then square/multiply */  if (mode == 2 && bitcpy > 0) {

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产乱人伦偷精品视频不卡| 3d成人动漫网站| 欧美系列一区二区| 精品成人私密视频| 亚洲午夜在线视频| 不卡高清视频专区| 欧美大片日本大片免费观看| 一区二区日韩电影| 99视频在线精品| 久久天天做天天爱综合色| 日韩制服丝袜av| 91国偷自产一区二区三区成为亚洲经典| 久久先锋影音av鲁色资源网| 日韩中文字幕区一区有砖一区 | 亚洲人吸女人奶水| 国精品**一区二区三区在线蜜桃| 欧美写真视频网站| 亚洲综合自拍偷拍| 99久久精品国产网站| 久久久久久久精| 精品综合免费视频观看| 91精品国产免费久久综合| 亚洲一区二区中文在线| 91免费国产在线| 亚洲激情图片qvod| 在线看国产日韩| 亚洲综合图片区| 欧美性videosxxxxx| 亚洲一区二区三区国产| 欧美三级韩国三级日本三斤| 亚洲欧美日韩国产手机在线 | 欧美电影一区二区三区| 夜夜爽夜夜爽精品视频| 欧美日韩在线观看一区二区| 亚洲精品大片www| 欧美怡红院视频| 日韩经典一区二区| 精品久久久久久久久久久久久久久| 日韩国产精品久久| 日韩欧美一区电影| 国产一区二区三区久久久 | 一区二区三区**美女毛片| 色94色欧美sute亚洲线路一久| 亚洲精品一二三| 欧美日韩视频不卡| 日韩成人免费电影| 久久久久久久网| 91亚洲永久精品| 亚洲国产你懂的| 精品国产污网站| 成人免费三级在线| 性感美女极品91精品| 欧美电影免费观看高清完整版在线观看| 狠狠色狠狠色合久久伊人| 国产精品久久久久久久第一福利| 91猫先生在线| 日产精品久久久久久久性色| 精品福利av导航| 99re视频精品| 天堂久久久久va久久久久| 精品av综合导航| 99久久精品国产导航| 午夜精品久久久久久久99樱桃| 欧美不卡123| 91丨porny丨国产| 免费精品99久久国产综合精品| 久久这里只有精品首页| 91国偷自产一区二区使用方法| 久久精品噜噜噜成人av农村| 中文字幕在线不卡一区二区三区| 欧美人与性动xxxx| 成人免费视频播放| 毛片av中文字幕一区二区| 中文字幕永久在线不卡| 日韩一区二区三区电影| 色综合一区二区| 久久精品久久99精品久久| 亚洲三级理论片| 国产清纯白嫩初高生在线观看91 | 精品少妇一区二区三区在线播放 | 国产精品白丝jk黑袜喷水| 亚洲免费成人av| 久久这里都是精品| 7777女厕盗摄久久久| 一本大道久久a久久综合| 国产一区二区三区日韩| 天堂av在线一区| 一区二区三区中文免费| 国产农村妇女毛片精品久久麻豆| 9191久久久久久久久久久| 色网站国产精品| 不卡免费追剧大全电视剧网站| 美女免费视频一区二区| 亚洲福利国产精品| 亚洲免费电影在线| 日韩伦理电影网| 国产精品全国免费观看高清 | 成人激情小说乱人伦| 国内成人精品2018免费看| 日本伊人色综合网| 午夜精品一区二区三区电影天堂| 亚洲欧洲中文日韩久久av乱码| 国产嫩草影院久久久久| 久久精品日产第一区二区三区高清版 | 中文字幕一区二区日韩精品绯色| 精品粉嫩aⅴ一区二区三区四区| 777午夜精品免费视频| 欧美日韩一区二区在线观看视频| 91美女片黄在线观看| 91在线精品秘密一区二区| 成人午夜视频福利| 成人一区二区三区中文字幕| 国产精品一二一区| 懂色av一区二区三区蜜臀| 成人激情黄色小说| 色综合天天综合给合国产| 色综合天天性综合| 在线精品视频一区二区| 欧美色手机在线观看| 欧美精品久久久久久久多人混战 | 51久久夜色精品国产麻豆| 91麻豆精品91久久久久久清纯| 欧美日韩视频在线一区二区| 欧美精品久久99久久在免费线| 日韩一区二区免费电影| 亚洲精品在线三区| 中文字幕成人av| 综合亚洲深深色噜噜狠狠网站| 一区二区免费看| 日韩激情视频在线观看| 精品制服美女久久| 国产999精品久久| 色av一区二区| 日韩精品最新网址| 国产精品情趣视频| 亚洲成人激情社区| 激情小说欧美图片| 91在线云播放| 日韩欧美一区二区三区在线| 国产女主播在线一区二区| 亚洲精品乱码久久久久久日本蜜臀| 午夜视频在线观看一区| 国产一区二区h| 91国产福利在线| 精品久久久久久久久久久院品网 | 色婷婷亚洲综合| 欧美一区二区三区免费视频| 久久久久久99久久久精品网站| 18欧美亚洲精品| 免费成人结看片| 99久久精品国产一区二区三区| 欧美精品v国产精品v日韩精品 | 亚洲精品在线观看视频| 亚洲精品欧美专区| 激情伊人五月天久久综合| 一本到不卡免费一区二区| 日韩三级视频在线看| 成人免费在线视频| 久久精品国产久精国产| 一本大道久久a久久精品综合| 日韩免费高清视频| 亚洲综合色丁香婷婷六月图片| 精品一区二区三区欧美| 精品1区2区3区| 国产精品福利av| 国产一区视频在线看| 欧美色爱综合网| 亚洲同性同志一二三专区| 国产一区二区精品久久| 欧美绝品在线观看成人午夜影视| 国产精品蜜臀在线观看| 国产曰批免费观看久久久| 91精品蜜臀在线一区尤物| 亚洲欧美激情在线| 成人在线一区二区三区| 精品粉嫩超白一线天av| 日本伊人色综合网| 欧美日韩视频在线观看一区二区三区| 国产精品久久毛片a| 国产福利精品一区二区| 日韩免费高清电影| 亚洲成人激情自拍| 欧美无人高清视频在线观看| 中文字幕亚洲区| 成人永久aaa| 国产精品天天看| 国产精品亚洲午夜一区二区三区| 日韩欧美国产系列| 日韩在线一二三区| 欧美一区二区在线看| 午夜精品成人在线视频| 欧美日韩一区二区三区四区| 亚洲夂夂婷婷色拍ww47| 欧美日韩一区二区不卡| 亚洲午夜在线观看视频在线| 色婷婷综合久久| 亚洲国产精品视频| 欧美日韩一区在线| 日本一区中文字幕| 日韩欧美一级二级|