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

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

?? mpi.c

?? 常用的64位密碼加密算法
?? C
?? 第 1 頁 / 共 5 頁
字號:
/* Start: bn_error.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>static const struct {     int code;     char *msg;} msgs[] = {     { MP_OKAY, "Successful" },     { MP_MEM,  "Out of heap" },     { MP_VAL,  "Value out of range" }};/* return a char * string for a given code */char *mp_error_to_string(int code){   int x;   /* scan the lookup table for the given message */   for (x = 0; x < (int)(sizeof(msgs) / sizeof(msgs[0])); x++) {       if (msgs[x].code == code) {          return msgs[x].msg;       }   }   /* generic reply for invalid code */   return "Invalid error code";}/* End: bn_error.c *//* Start: bn_fast_mp_invmod.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 the modular inverse via binary extended euclidean algorithm,  * that is c = 1/a mod b  * * Based on mp_invmod except this is optimized for the case where b is  * odd as per HAC Note 14.64 on pp. 610 */intfast_mp_invmod (mp_int * a, mp_int * b, mp_int * c){  mp_int  x, y, u, v, B, D;  int     res, neg;  /* 2. [modified] b must be odd   */  if (mp_iseven (b) == 1) {    return MP_VAL;  }  /* init all our temps */  if ((res = mp_init_multi(&x, &y, &u, &v, &B, &D, NULL)) != MP_OKAY) {     return res;  }  /* x == modulus, y == value to invert */  if ((res = mp_copy (b, &x)) != MP_OKAY) {    goto __ERR;  }  /* we need y = |a| */  if ((res = mp_abs (a, &y)) != MP_OKAY) {    goto __ERR;  }  /* 3. u=x, v=y, A=1, B=0, C=0,D=1 */  if ((res = mp_copy (&x, &u)) != MP_OKAY) {    goto __ERR;  }  if ((res = mp_copy (&y, &v)) != MP_OKAY) {    goto __ERR;  }  mp_set (&D, 1);top:  /* 4.  while u is even do */  while (mp_iseven (&u) == 1) {    /* 4.1 u = u/2 */    if ((res = mp_div_2 (&u, &u)) != MP_OKAY) {      goto __ERR;    }    /* 4.2 if B is odd then */    if (mp_isodd (&B) == 1) {      if ((res = mp_sub (&B, &x, &B)) != MP_OKAY) {        goto __ERR;      }    }    /* B = B/2 */    if ((res = mp_div_2 (&B, &B)) != MP_OKAY) {      goto __ERR;    }  }  /* 5.  while v is even do */  while (mp_iseven (&v) == 1) {    /* 5.1 v = v/2 */    if ((res = mp_div_2 (&v, &v)) != MP_OKAY) {      goto __ERR;    }    /* 5.2 if D is odd then */    if (mp_isodd (&D) == 1) {      /* D = (D-x)/2 */      if ((res = mp_sub (&D, &x, &D)) != MP_OKAY) {        goto __ERR;      }    }    /* D = D/2 */    if ((res = mp_div_2 (&D, &D)) != MP_OKAY) {      goto __ERR;    }  }  /* 6.  if u >= v then */  if (mp_cmp (&u, &v) != MP_LT) {    /* u = u - v, B = B - D */    if ((res = mp_sub (&u, &v, &u)) != MP_OKAY) {      goto __ERR;    }    if ((res = mp_sub (&B, &D, &B)) != MP_OKAY) {      goto __ERR;    }  } else {    /* v - v - u, D = D - B */    if ((res = mp_sub (&v, &u, &v)) != MP_OKAY) {      goto __ERR;    }    if ((res = mp_sub (&D, &B, &D)) != MP_OKAY) {      goto __ERR;    }  }  /* if not zero goto step 4 */  if (mp_iszero (&u) == 0) {    goto top;  }  /* now a = C, b = D, gcd == g*v */  /* if v != 1 then there is no inverse */  if (mp_cmp_d (&v, 1) != MP_EQ) {    res = MP_VAL;    goto __ERR;  }  /* b is now the inverse */  neg = a->sign;  while (D.sign == MP_NEG) {    if ((res = mp_add (&D, b, &D)) != MP_OKAY) {      goto __ERR;    }  }  mp_exch (&D, c);  c->sign = neg;  res = MP_OKAY;__ERR:mp_clear_multi (&x, &y, &u, &v, &B, &D, NULL);  return res;}/* End: bn_fast_mp_invmod.c *//* Start: bn_fast_mp_montgomery_reduce.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 xR**-1 == x (mod N) via Montgomery Reduction * * This is an optimized implementation of mp_montgomery_reduce * which uses the comba method to quickly calculate the columns of the * reduction. * * Based on Algorithm 14.32 on pp.601 of HAC.*/intfast_mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho){  int     ix, res, olduse;  mp_word W[MP_WARRAY];  /* get old used count */  olduse = x->used;  /* grow a as required */  if (x->alloc < n->used + 1) {    if ((res = mp_grow (x, n->used + 1)) != MP_OKAY) {      return res;    }  }  /* first we have to get the digits of the input into   * an array of double precision words W[...]   */  {    register mp_word *_W;    register mp_digit *tmpx;    /* alias for the W[] array */    _W   = W;    /* alias for the digits of  x*/    tmpx = x->dp;    /* copy the digits of a into W[0..a->used-1] */    for (ix = 0; ix < x->used; ix++) {      *_W++ = *tmpx++;    }    /* zero the high words of W[a->used..m->used*2] */    for (; ix < n->used * 2 + 1; ix++) {      *_W++ = 0;    }  }  /* now we proceed to zero successive digits   * from the least significant upwards   */  for (ix = 0; ix < n->used; ix++) {    /* mu = ai * m' mod b     *     * We avoid a double precision multiplication (which isn't required)     * by casting the value down to a mp_digit.  Note this requires     * that W[ix-1] have  the carry cleared (see after the inner loop)     */    register mp_digit mu;    mu = (mp_digit) (((W[ix] & MP_MASK) * rho) & MP_MASK);    /* a = a + mu * m * b**i     *     * This is computed in place and on the fly.  The multiplication     * by b**i is handled by offseting which columns the results     * are added to.     *     * Note the comba method normally doesn't handle carries in the     * inner loop In this case we fix the carry from the previous     * column since the Montgomery reduction requires digits of the     * result (so far) [see above] to work.  This is     * handled by fixing up one carry after the inner loop.  The     * carry fixups are done in order so after these loops the     * first m->used words of W[] have the carries fixed     */    {      register int iy;      register mp_digit *tmpn;      register mp_word *_W;      /* alias for the digits of the modulus */      tmpn = n->dp;      /* Alias for the columns set by an offset of ix */      _W = W + ix;      /* inner loop */      for (iy = 0; iy < n->used; iy++) {          *_W++ += ((mp_word)mu) * ((mp_word)*tmpn++);      }    }    /* now fix carry for next digit, W[ix+1] */    W[ix + 1] += W[ix] >> ((mp_word) DIGIT_BIT);  }  /* now we have to propagate the carries and   * shift the words downward [all those least   * significant digits we zeroed].   */  {    register mp_digit *tmpx;    register mp_word *_W, *_W1;    /* nox fix rest of carries */    /* alias for current word */    _W1 = W + ix;    /* alias for next word, where the carry goes */    _W = W + ++ix;    for (; ix <= n->used * 2 + 1; ix++) {      *_W++ += *_W1++ >> ((mp_word) DIGIT_BIT);    }    /* copy out, A = A/b**n     *     * The result is A/b**n but instead of converting from an     * array of mp_word to mp_digit than calling mp_rshd     * we just copy them in the right order     */    /* alias for destination word */    tmpx = x->dp;    /* alias for shifted double precision result */    _W = W + n->used;    for (ix = 0; ix < n->used + 1; ix++) {      *tmpx++ = (mp_digit)(*_W++ & ((mp_word) MP_MASK));    }    /* zero oldused digits, if the input a was larger than     * m->used+1 we'll have to clear the digits     */    for (; ix < olduse; ix++) {      *tmpx++ = 0;    }  }  /* set the max used and clamp */  x->used = n->used + 1;  mp_clamp (x);  /* if A >= m then A = A - m */  if (mp_cmp_mag (x, n) != MP_LT) {    return s_mp_sub (x, n, x);  }  return MP_OKAY;}/* End: bn_fast_mp_montgomery_reduce.c *//* Start: bn_fast_s_mp_mul_digs.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>/* Fast (comba) multiplier * * This is the fast column-array [comba] multiplier.  It is  * designed to compute the columns of the product first  * then handle the carries afterwards.  This has the effect  * of making the nested loops that compute the columns very * simple and schedulable on super-scalar processors. * * This has been modified to produce a variable number of  * digits of output so if say only a half-product is required  * you don't have to compute the upper half (a feature  * required for fast Barrett reduction). * * Based on Algorithm 14.12 on pp.595 of HAC. * */intfast_s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs){  int     olduse, res, pa, ix;  mp_word W[MP_WARRAY];  /* grow the destination as required */  if (c->alloc < digs) {    if ((res = mp_grow (c, digs)) != MP_OKAY) {      return res;    }  }  /* clear temp buf (the columns) */  memset (W, 0, sizeof (mp_word) * digs);  /* calculate the columns */  pa = a->used;  for (ix = 0; ix < pa; ix++) {    /* this multiplier has been modified to allow you to      * control how many digits of output are produced.       * So at most we want to make upto "digs" digits of output.     *     * this adds products to distinct columns (at ix+iy) of W     * note that each step through the loop is not dependent on     * the previous which means the compiler can easily unroll     * the loop without scheduling problems     */    {      register mp_digit tmpx, *tmpy;      register mp_word *_W;      register int iy, pb;      /* alias for the the word on the left e.g. A[ix] * A[iy] */      tmpx = a->dp[ix];      /* alias for the right side */      tmpy = b->dp;      /* alias for the columns, each step through the loop adds a new         term to each column       */      _W = W + ix;      /* the number of digits is limited by their placement.  E.g.         we avoid multiplying digits that will end up above the # of         digits of precision requested       */      pb = MIN (b->used, digs - ix);      for (iy = 0; iy < pb; iy++) {        *_W++ += ((mp_word)tmpx) * ((mp_word)*tmpy++);      }    }  }  /* setup dest */  olduse  = c->used;  c->used = digs;  {    register mp_digit *tmpc;    /* At this point W[] contains the sums of each column.  To get the     * correct result we must take the extra bits from each column and     * carry them down     *     * Note that while this adds extra code to the multiplier it      * saves time since the carry propagation is removed from the      * above nested loop.This has the effect of reducing the work      * from N*(N+N*c)==N**2 + c*N**2 to N**2 + N*c where c is the      * cost of the shifting.  On very small numbers this is slower      * but on most cryptographic size numbers it is faster.     *     * In this particular implementation we feed the carries from     * behind which means when the loop terminates we still have one     * last digit to copy     */    tmpc = c->dp;    for (ix = 1; ix < digs; ix++) {      /* forward the carry from the previous temp */      W[ix] += (W[ix - 1] >> ((mp_word) DIGIT_BIT));      /* now extract the previous digit [below the carry] */      *tmpc++ = (mp_digit) (W[ix - 1] & ((mp_word) MP_MASK));    }    /* fetch the last digit */    *tmpc++ = (mp_digit) (W[digs - 1] & ((mp_word) MP_MASK));    /* clear unused digits [that existed in the old copy of c] */    for (; ix < olduse; ix++) {      *tmpc++ = 0;    }  }  mp_clamp (c);  return MP_OKAY;}/* End: bn_fast_s_mp_mul_digs.c *//* Start: bn_fast_s_mp_mul_high_digs.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 modified version of fast_s_mp_mul_digs that only produces * output digits *above* digs.  See the comments for fast_s_mp_mul_digs * to see how it works. * * This is used in the Barrett reduction since for one of the multiplications * only the higher digits were needed.  This essentially halves the work. * * Based on Algorithm 14.12 on pp.595 of HAC. */intfast_s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs)

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
av中文一区二区三区| av成人免费在线| 一区二区视频在线看| 久久伊人蜜桃av一区二区| 欧美区在线观看| 欧美综合天天夜夜久久| 91麻豆国产香蕉久久精品| 成人永久免费视频| 国产成人福利片| 国产精品一二三在| 国产精品主播直播| 国产精品亚洲第一区在线暖暖韩国| 免费在线成人网| 免费成人小视频| 久久成人免费网| 国产黄色精品网站| 国产成人精品免费视频网站| 国产精品99久久久久久久女警| 国产a视频精品免费观看| 国产精品18久久久久久久网站| 国产成人在线电影| 成人动漫精品一区二区| 成人白浆超碰人人人人| 91在线国产福利| 欧美日韩国产一区二区三区地区| 欧美三级蜜桃2在线观看| 欧美日韩成人激情| 欧美一区二区三区喷汁尤物| 日韩一区二区电影| 久久久久久久一区| 成人欧美一区二区三区在线播放| 亚洲精品va在线观看| 五月天久久比比资源色| 久久成人免费网站| 99久久99久久综合| 欧美少妇性性性| 久久综合久久综合久久| 国产精品久久看| 亚洲狠狠爱一区二区三区| 免费看黄色91| jlzzjlzz国产精品久久| 欧美日韩1234| 国产欧美日韩久久| 一区二区三区**美女毛片| 人人爽香蕉精品| www.欧美色图| 91精品国产免费| 中文字幕第一区第二区| 亚洲第一会所有码转帖| 国产在线精品免费| 在线亚洲免费视频| 精品久久五月天| 中文字幕一区二区三区精华液| 亚洲国产日韩精品| 丁香激情综合国产| 制服丝袜国产精品| 国产精品久久久久久一区二区三区| 亚洲午夜三级在线| 福利一区二区在线| 91精品国产91综合久久蜜臀| 中文字幕电影一区| 美女mm1313爽爽久久久蜜臀| 色综合久久综合网97色综合| 中日韩av电影| 亚洲动漫第一页| 99久久精品国产网站| 精品国产凹凸成av人导航| 亚洲最大色网站| av资源站一区| 国产日产亚洲精品系列| 另类小说欧美激情| 欧美日韩在线不卡| 亚洲色图都市小说| 国产成人久久精品77777最新版本| 69久久99精品久久久久婷婷| 亚洲精品成人在线| 色综合久久久久久久| 国产精品青草综合久久久久99| 久久草av在线| 日韩欧美在线一区二区三区| 亚洲成人一区二区在线观看| 色视频成人在线观看免| 中国av一区二区三区| 成人免费高清在线观看| 久久久国产精华| 国产米奇在线777精品观看| 欧美一级免费观看| 日韩电影在线一区| 7777精品伊人久久久大香线蕉最新版 | 日韩精品中文字幕一区 | 91在线观看一区二区| 国产丝袜美腿一区二区三区| 国产大陆精品国产| 久久亚洲精华国产精华液| 国产真实精品久久二三区| 欧美成人一区二区| 久久er99精品| 26uuu亚洲| 国产精华液一区二区三区| 国产日韩精品一区二区三区| 成人午夜短视频| 国产精品第13页| 91麻豆国产自产在线观看| 曰韩精品一区二区| 欧美三日本三级三级在线播放| 亚洲高清免费观看高清完整版在线观看| 91黄色免费版| 日韩成人精品在线| 久久久综合九色合综国产精品| 高清不卡一二三区| 亚洲线精品一区二区三区八戒| 7777精品久久久大香线蕉| 久久精品国产精品亚洲精品 | 亚洲精品乱码久久久久久久久| 色狠狠综合天天综合综合| 亚欧色一区w666天堂| 日韩午夜激情免费电影| 国产精品99久| 亚洲精品国产a久久久久久 | 色94色欧美sute亚洲13| 奇米一区二区三区av| 亚洲一二三专区| 91精品免费观看| 粉嫩一区二区三区在线看| 亚洲国产精品视频| 精品入口麻豆88视频| 一本色道a无线码一区v| 日韩电影网1区2区| 国产精品免费视频一区| 精品婷婷伊人一区三区三| 国内精品伊人久久久久影院对白| 亚洲欧美在线aaa| 日韩精品一区国产麻豆| 91麻豆免费看片| 精油按摩中文字幕久久| 依依成人精品视频| 久久久久久99精品| 欧美日韩国产在线播放网站| 成人avav影音| 久草热8精品视频在线观看| 亚洲欧洲99久久| 亚洲精品一区在线观看| 精品污污网站免费看| 成人黄色免费短视频| 狠狠色狠狠色合久久伊人| 午夜视频在线观看一区二区三区 | 成人免费视频免费观看| 亚洲精品乱码久久久久| 久久久久久一二三区| 7777精品伊人久久久大香线蕉| 91在线观看美女| 国产成人在线影院| 久久99久久99小草精品免视看| 亚洲精品中文在线| 国产欧美日韩激情| 精品国产欧美一区二区| 欧美美女一区二区在线观看| 99久久婷婷国产| 国产麻豆视频一区二区| 免费人成在线不卡| 首页亚洲欧美制服丝腿| 一区视频在线播放| 国产女人18毛片水真多成人如厕| 日韩三级免费观看| 欧美三级日本三级少妇99| 91麻豆免费观看| 97se狠狠狠综合亚洲狠狠| 粉嫩av一区二区三区粉嫩| 国产一区二区三区在线观看免费| 免费久久99精品国产| 丝袜亚洲精品中文字幕一区| 一区二区三区在线看| 亚洲欧美日韩中文字幕一区二区三区| 中文字幕高清不卡| 国产精品久久久99| 亚洲婷婷综合久久一本伊一区| 国产欧美日韩综合| 国产亚洲精品bt天堂精选| 337p日本欧洲亚洲大胆精品| 精品国产一区二区亚洲人成毛片| 在线播放中文一区| 91麻豆精品国产自产在线观看一区| 欧美日韩一区二区在线视频| 欧美日韩一级视频| 538在线一区二区精品国产| 欧美一区二区在线观看| 精品久久久久久久久久久院品网| 欧美成人女星排名| 久久先锋资源网| 中文字幕一区二区不卡| 一区二区三区视频在线看| 亚洲一区精品在线| 免费看欧美女人艹b| 国产经典欧美精品| 在线观看视频一区二区| 亚洲图片一区二区| 日产欧产美韩系列久久99| 精品一区二区免费视频| 成人免费av资源| 在线看日本不卡|