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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? sha1impl.c

?? IBE是一種非對稱密碼技術(shù)
?? C
字號:
/* Copyright 2003-2006, Voltage Security, all rights reserved.
 */
#include "vibecrypto.h"
#include "environment.h"
#include "base.h"
#include "libctx.h"
#include "algobj.h"
#include "digest.h"
#include "sha1.h"

int SHA1Init (
   VoltAlgorithmObject *obj
   )
{
  VoltDigestClassCtx *digestCtx = (VoltDigestClassCtx *)(obj->classCtx);
  VoltSHA1Ctx *sha1Ctx = (VoltSHA1Ctx *)(digestCtx->localDigestCtx);

  /* Populate the SHA-1 Ctx with the initial values.
   */
  sha1Ctx->countLow = 0;
  sha1Ctx->countHigh = 0;
  sha1Ctx->currentBlockLen = 0;
  sha1Ctx->state[0] = sha1Ctx->initState[0];
  sha1Ctx->state[1] = sha1Ctx->initState[1];
  sha1Ctx->state[2] = sha1Ctx->initState[2];
  sha1Ctx->state[3] = sha1Ctx->initState[3];
  sha1Ctx->state[4] = sha1Ctx->initState[4];

  return (0);
}

int SHA1Update (
   VoltAlgorithmObject *obj,
   unsigned char *dataToDigest,
   unsigned int dataToDigestLen
   )
{
  unsigned int copyLen;
  VoltDigestClassCtx *digestCtx = (VoltDigestClassCtx *)(obj->classCtx);
  VoltSHA1Ctx *sha1Ctx = (VoltSHA1Ctx *)(digestCtx->localDigestCtx);
  VoltLibCtx *libCtx = (VoltLibCtx *)(obj->voltObject.libraryCtx);

  if (dataToDigest == (unsigned char *)0)
    dataToDigestLen = 0;

  /* Add the input length to the running total.
   */
  sha1Ctx->countLow += dataToDigestLen;
  if (sha1Ctx->countLow < dataToDigestLen)
    sha1Ctx->countHigh++;

  /* If we have any data in the currentBlock, start there.
   */
  if (sha1Ctx->currentBlockLen != 0)
  {
    /* Copy bytes into the currentBlock. If there is enough to complete
     * a block, copy enought to complete the block and then run
     * SHA1Transform on it. If not, just copy the input into the block
     * and update currentBlockLen.
     */
    copyLen = dataToDigestLen;
    if ((dataToDigestLen + sha1Ctx->currentBlockLen) >= 64)
      copyLen = 64 - sha1Ctx->currentBlockLen;
    Z2Memcpy (
      sha1Ctx->currentBlock + sha1Ctx->currentBlockLen, dataToDigest,
      copyLen);
    sha1Ctx->currentBlockLen += copyLen;

    /* If we don't have an entire block, we're done.
     */
    if (sha1Ctx->currentBlockLen < 64)
      return (0);

    /* We have a block, process it.
     */
    sha1Ctx->SHA1Transform ((Pointer)sha1Ctx, sha1Ctx->currentBlock);
    dataToDigestLen -= copyLen;
    dataToDigest += copyLen;
    sha1Ctx->currentBlockLen = 0;
  }

  /* As long as there are complete blocks in the dataToDigest, call
   * SHA1Transform on them.
   */
  while (dataToDigestLen >= 64)
  {
    sha1Ctx->SHA1Transform ((Pointer)sha1Ctx, dataToDigest);
    dataToDigestLen -= 64;
    dataToDigest += 64;
  }

  /* If there is any data left over, copy it into the currentBlock. If
   * not, we're done.
   */
  if (dataToDigestLen == 0)
    return (0);

  Z2Memcpy (sha1Ctx->currentBlock, dataToDigest, dataToDigestLen);
  sha1Ctx->currentBlockLen = dataToDigestLen;

  return (0);
}

int SHA1Final (
   VoltAlgorithmObject *obj,
   unsigned char *digest
   )
{
  VoltLibCtx *libCtx = (VoltLibCtx *)(obj->voltObject.libraryCtx);
  VoltDigestClassCtx *digestCtx = (VoltDigestClassCtx *)(obj->classCtx);
  VoltSHA1Ctx *sha1Ctx = (VoltSHA1Ctx *)(digestCtx->localDigestCtx);

  /* Perform padding.
   * currentBlock | 0x80 | 0x00 00 ... 00 | length
   * The length is 8 bytes, the length, in bits, of the input.
   * If there is not enough space left in currentBlock to hold the 0x80
   * byte and the 8 length bytes, finish up the current block with 0x80
   * and 0x00 00 00 ... Then create a new block of all 00's except for
   * the last 8 bytes, the length.
   */
  Z2Memset (
    sha1Ctx->currentBlock + sha1Ctx->currentBlockLen, 0,
    64 - sha1Ctx->currentBlockLen);
  if (sha1Ctx->padding == VT_SHA1_STD_PAD)
    sha1Ctx->currentBlock[sha1Ctx->currentBlockLen] = 0x80;
  if (sha1Ctx->currentBlockLen > 55)
  {
    sha1Ctx->SHA1Transform ((Pointer)sha1Ctx, sha1Ctx->currentBlock);
    Z2Memset (sha1Ctx->currentBlock, 0, 64);
  }

  /* If padding following the SHA-1 standard (as opposed to FIPS 186),
   * set the last 8 bytes to be the length. We added number of bytes,
   * we want bits, so multiply by 8 (a left-shift by 3).
   */
  if (sha1Ctx->padding == VT_SHA1_STD_PAD)
  {
    sha1Ctx->countHigh <<= 3;
    sha1Ctx->countHigh |= (sha1Ctx->countLow >> 29);
    sha1Ctx->countLow <<= 3;
    sha1Ctx->currentBlock[56] = (unsigned char)(sha1Ctx->countHigh >> 24);
    sha1Ctx->currentBlock[57] = (unsigned char)(sha1Ctx->countHigh >> 16);
    sha1Ctx->currentBlock[58] = (unsigned char)(sha1Ctx->countHigh >> 8);
    sha1Ctx->currentBlock[59] = (unsigned char)sha1Ctx->countHigh;
    sha1Ctx->currentBlock[60] = (unsigned char)(sha1Ctx->countLow >> 24);
    sha1Ctx->currentBlock[61] = (unsigned char)(sha1Ctx->countLow >> 16);
    sha1Ctx->currentBlock[62] = (unsigned char)(sha1Ctx->countLow >> 8);
    sha1Ctx->currentBlock[63] = (unsigned char)(sha1Ctx->countLow);
  }

  sha1Ctx->SHA1Transform ((Pointer)sha1Ctx, sha1Ctx->currentBlock);

  /* The state is the digest.
   */
  digest[0] = (unsigned char)(sha1Ctx->state[0] >> 24);
  digest[1] = (unsigned char)(sha1Ctx->state[0] >> 16);
  digest[2] = (unsigned char)(sha1Ctx->state[0] >> 8);
  digest[3] = (unsigned char)(sha1Ctx->state[0]);
  digest[4] = (unsigned char)(sha1Ctx->state[1] >> 24);
  digest[5] = (unsigned char)(sha1Ctx->state[1] >> 16);
  digest[6] = (unsigned char)(sha1Ctx->state[1] >> 8);
  digest[7] = (unsigned char)(sha1Ctx->state[1]);
  digest[8] = (unsigned char)(sha1Ctx->state[2] >> 24);
  digest[9] = (unsigned char)(sha1Ctx->state[2] >> 16);
  digest[10] = (unsigned char)(sha1Ctx->state[2] >> 8);
  digest[11] = (unsigned char)(sha1Ctx->state[2]);
  digest[12] = (unsigned char)(sha1Ctx->state[3] >> 24);
  digest[13] = (unsigned char)(sha1Ctx->state[3] >> 16);
  digest[14] = (unsigned char)(sha1Ctx->state[3] >> 8);
  digest[15] = (unsigned char)(sha1Ctx->state[3]);
  digest[16] = (unsigned char)(sha1Ctx->state[4] >> 24);
  digest[17] = (unsigned char)(sha1Ctx->state[4] >> 16);
  digest[18] = (unsigned char)(sha1Ctx->state[4] >> 8);
  digest[19] = (unsigned char)(sha1Ctx->state[4]);

  return (0);
}

void SHA1Transform (
   Pointer ctx,
   unsigned char *block
   )
{
  int index;
  UInt32 *state = ((VoltSHA1Ctx *)ctx)->state;
  UInt32 *W = ((VoltSHA1Ctx *)ctx)->W;
  UInt32 A, B, C, D, E, temp;

  A = state[0];
  B = state[1];
  C = state[2];
  D = state[3];
  E = state[4];

  /* Get the block as 16 words.
   */
  for (index = 0; index < 16; ++index, block += 4)
    SHA1_GET_UINT32 (block, W[index])

  /* Expand the block.
   */
  for (index = 16; index < 80; ++index)
  {
    temp = W[index - 3] ^ W[index - 8] ^ W[index - 14] ^ W[index - 16]; 
    W[index] = SHA1_ROTL (temp, 1);
  }

  /* The real work of SHA1Transform.
   */
  /* Rounds 0 - 19
   */
  for (index = 0;  index < 20; ++index)
  {
    temp = SHA1_ROTL (A, 5) + F0 (B, C, D) + E + W[index] + SHA1_K0;
    E = D;
    D = C;
    C = SHA1_ROTL (B, 30);
    B = A;
    A = temp;
  }

  /* Rounds 20 - 39
   */
  for (index = 20; index < 40; ++index)
  {
    temp = SHA1_ROTL (A, 5) + F2 (B, C, D) + E + W[index] + SHA1_K2;
    E = D;
    D = C;
    C = SHA1_ROTL (B, 30);
    B = A;
    A = temp; 
  }

  /* Rounds 40 - 59
   */
  for (index = 40; index < 60; ++index)
  {
    temp = SHA1_ROTL (A, 5) + F4 (B, C, D) + E + W[index] + SHA1_K4;
    E = D;
    D = C;
    C = SHA1_ROTL (B, 30);
    B = A;
    A = temp;
  }

  /* Rounds 60 - 79
   */
  for (index = 60; index < 80; ++index)
  {
    temp = SHA1_ROTL (A, 5) + F6 (B, C, D) + E + W[index] + SHA1_K6;
    E = D;
    D = C;
    C = SHA1_ROTL (B, 30);
    B = A;
    A = temp;
  }

  /* Add the results of the rounds to the state.
   */
  state[0] += A;
  state[1] += B;
  state[2] += C;
  state[3] += D;
  state[4] += E;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩一级片在线播放| 国产精品看片你懂得| 久久免费偷拍视频| 亚洲高清在线精品| 国产成人精品免费在线| 51精品久久久久久久蜜臀| 欧美国产亚洲另类动漫| 久久精品国产亚洲5555| 欧美亚洲综合网| 国产精品伦理一区二区| 麻豆91免费观看| 欧美日韩在线观看一区二区 | 日韩福利视频导航| av影院午夜一区| 日韩精品久久久久久| 成人午夜私人影院| 久久精品人人做人人爽97 | 国产欧美va欧美不卡在线| 日本亚洲免费观看| 欧美日韩中文一区| 亚洲一区免费在线观看| 91天堂素人约啪| 亚洲天堂2014| 波波电影院一区二区三区| 欧美成人猛片aaaaaaa| 青青草原综合久久大伊人精品 | 欧美精品少妇一区二区三区| 一区二区三区自拍| 91麻豆国产福利在线观看| 中文字幕在线免费不卡| 国产精品18久久久久| 久久综合九色综合97婷婷女人| 日韩av成人高清| 欧美成人精品3d动漫h| 麻豆成人av在线| 精品国产一区a| 国产在线国偷精品产拍免费yy | 国产欧美精品一区二区色综合朱莉| 久久精品久久99精品久久| 日韩一区二区在线免费观看| 日本午夜精品一区二区三区电影| 欧美另类高清zo欧美| 亚洲一区二区av电影| 欧美日韩一区高清| 奇米影视7777精品一区二区| 日韩亚洲欧美一区二区三区| 蜜乳av一区二区| 久久综合久色欧美综合狠狠| 久久电影网站中文字幕| 国产日韩欧美制服另类| 99久久综合色| 亚洲国产裸拍裸体视频在线观看乱了| 欧美色视频一区| 久久丁香综合五月国产三级网站| 久久亚洲精精品中文字幕早川悠里 | bt欧美亚洲午夜电影天堂| 亚洲视频图片小说| 欧洲视频一区二区| 日本va欧美va精品| 国产欧美精品日韩区二区麻豆天美| 成人h精品动漫一区二区三区| 伊人色综合久久天天人手人婷| 欧美日韩一区二区三区高清 | 亚洲韩国一区二区三区| 精品国产一区二区精华| 99久久99久久综合| 日本视频在线一区| 久久蜜臀中文字幕| 欧美亚洲综合在线| 国产成人一区在线| 亚洲国产日韩一级| 国产欧美精品一区二区色综合| 91麻豆国产香蕉久久精品| 日韩1区2区3区| 中文字幕亚洲区| 欧美一区二区精品在线| 成人激情开心网| 另类成人小视频在线| 亚洲欧美偷拍三级| 欧美不卡一二三| 色偷偷久久人人79超碰人人澡| 美女视频一区在线观看| 亚洲欧美日韩小说| 久久久综合精品| 欧美久久久久久久久中文字幕| 国产+成+人+亚洲欧洲自线| 午夜免费久久看| 综合久久给合久久狠狠狠97色 | 欧美视频在线观看一区二区| 精品一区二区在线观看| 亚洲va欧美va人人爽| 国产精品美女一区二区三区 | 91色porny在线视频| 精一区二区三区| 亚洲一线二线三线视频| 亚洲国产精品黑人久久久| 日韩一区二区三区四区五区六区 | 国产精品国产三级国产普通话99 | 亚洲婷婷在线视频| 久久久精品综合| 日韩欧美国产精品一区| 欧美日韩国产另类不卡| 日本精品视频一区二区三区| 国产真实乱偷精品视频免| 美女网站一区二区| 日韩专区在线视频| 亚洲成人动漫一区| 亚洲在线免费播放| 亚洲精品乱码久久久久| 国产精品理伦片| 国产精品久久三| 久久久不卡网国产精品一区| 精品久久久久av影院| 日韩视频一区二区在线观看| 欧美日韩国产在线观看| 欧美午夜寂寞影院| 欧美私人免费视频| 欧美三区免费完整视频在线观看| 在线一区二区三区做爰视频网站| 91免费版在线| 欧洲精品视频在线观看| 91国偷自产一区二区三区观看 | 国产69精品久久久久毛片| 精彩视频一区二区三区| 狠狠色丁香久久婷婷综| 青娱乐精品在线视频| 欧美96一区二区免费视频| 老司机一区二区| 国产一区二区美女| 不卡视频一二三| 欧美午夜片在线看| 日韩色在线观看| 久久久五月婷婷| 亚洲日本中文字幕区| 亚洲夂夂婷婷色拍ww47| 免费成人在线视频观看| 国产精品主播直播| 成人a免费在线看| 欧美色视频在线| 欧美一级在线免费| 久久久久99精品国产片| 17c精品麻豆一区二区免费| 亚洲影视在线播放| 麻豆国产精品官网| 成人免费高清视频| 欧美日韩国产一级二级| 日韩精品最新网址| 1024成人网| 奇米一区二区三区av| 成人黄色软件下载| 欧美精品 日韩| 欧美激情自拍偷拍| 天天av天天翘天天综合网 | 亚洲成人久久影院| 国内精品伊人久久久久av一坑| 99久久久精品| 日韩久久精品一区| 亚洲色图制服诱惑| 经典一区二区三区| 在线免费一区三区| 国产肉丝袜一区二区| 亚洲一级二级三级| 国产成人免费视频一区| 91精品国产综合久久久蜜臀粉嫩| 中文字幕免费观看一区| 天天免费综合色| 91麻豆免费在线观看| 日韩欧美不卡一区| 亚洲午夜在线观看视频在线| 国产精品一级黄| 91精品国产91热久久久做人人 | 91免费看视频| 久久久久久久性| 日韩**一区毛片| 在线免费亚洲电影| 国产精品无圣光一区二区| 日本91福利区| 欧美日韩亚洲综合一区| 亚洲私人黄色宅男| 国产在线播精品第三| 在线不卡的av| 亚洲二区在线观看| 在线观看国产91| 中文字幕亚洲电影| 国产精品18久久久久久久久 | 国产精品理伦片| 国产在线不卡一卡二卡三卡四卡| 欧美电影在线免费观看| 亚洲国产日韩精品| 欧美性生活影院| 亚洲精品免费播放| 色悠悠久久综合| 成人免费在线视频| 99天天综合性| 国产精品成人网| 不卡一区二区中文字幕| 中文字幕在线观看不卡视频| 岛国一区二区在线观看| 国产精品视频免费看| 国产91在线观看|