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

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

?? sha256impl.c

?? IBE是一種非對(duì)稱密碼技術(shù)
?? C
字號(hào):
/* Copyright 2005-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 "sha256.h"
#include "errorctx.h"

int SHA256SetDigestInitState (
   VoltAlgorithmObject *obj,
   VtItem *newState
   )
{
  int status, index;
  UInt32 current;
  unsigned char *buffer;
  VoltDigestClassCtx *digestCtx = (VoltDigestClassCtx *)(obj->classCtx);
  VoltSHA256Ctx *sha256Ctx = (VoltSHA256Ctx *)(digestCtx->localDigestCtx);
  VOLT_DECLARE_FNCT_LINE (fnctLine)

  do
  {
    /* Make sure we have a new state and the length is correct.
     */
    VOLT_SET_FNCT_LINE (fnctLine)
    status = VT_ERROR_INVALID_ASSOCIATED_INFO;
    if ( (newState->data == (unsigned char *)0) || (newState->len != 32) )
      break;

    buffer = newState->data;
    for (index = 0; index < 8; ++index)
    {
      /* Get the next four bytes of the state as an int.
       */
      current =
        ((UInt32)(buffer[0]) << 24) +
        ((UInt32)(buffer[1]) << 16) +
        ((UInt32)(buffer[2]) <<  8) +
        ((UInt32)(buffer[3]));
      sha256Ctx->initState[index] = current;
      buffer += 4;
    }

    status = 0;

  } while (0);

  VOLT_LOG_ERROR_INFO_COMPARE (
    status, 0, obj, status, 0, VT_ERROR_TYPE_PRIMARY,
    (char *)0, "SHA256SetDigestInitState", fnctLine, (char *)0)

  return (status);
}

int SHA256Init (
   VoltAlgorithmObject *obj
   )
{
  VoltDigestClassCtx *digestCtx = (VoltDigestClassCtx *)(obj->classCtx);
  VoltSHA256Ctx *sha256Ctx = (VoltSHA256Ctx *)(digestCtx->localDigestCtx);

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

  return (0);
}

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

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

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

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

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

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

  /* As long as there are complete blocks in the dataToDigest, call
   * SHA256Transform on them.
   */
  while (dataToDigestLen >= 64)
  {
    sha256Ctx->SHA256Transform ((Pointer)sha256Ctx, 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 (sha256Ctx->currentBlock, dataToDigest, dataToDigestLen);
  sha256Ctx->currentBlockLen = dataToDigestLen;

  return (0);
}

int SHA256Final (
   VoltAlgorithmObject *obj,
   unsigned char *digest
   )
{
  VoltLibCtx *libCtx = (VoltLibCtx *)(obj->voltObject.libraryCtx);
  VoltDigestClassCtx *digestCtx = (VoltDigestClassCtx *)(obj->classCtx);
  VoltSHA256Ctx *sha256Ctx = (VoltSHA256Ctx *)(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 (
    sha256Ctx->currentBlock + sha256Ctx->currentBlockLen, 0,
    64 - sha256Ctx->currentBlockLen);
  sha256Ctx->currentBlock[sha256Ctx->currentBlockLen] = 0x80;
  if (sha256Ctx->currentBlockLen > 55)
  {
    sha256Ctx->SHA256Transform ((Pointer)sha256Ctx, sha256Ctx->currentBlock);
    Z2Memset (sha256Ctx->currentBlock, 0, 64);
  }

  /* 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).
   */
  sha256Ctx->countHigh <<= 3;
  sha256Ctx->countHigh |= (sha256Ctx->countLow >> 29);
  sha256Ctx->countLow <<= 3;
  sha256Ctx->currentBlock[56] = (unsigned char)(sha256Ctx->countHigh >> 24);
  sha256Ctx->currentBlock[57] = (unsigned char)(sha256Ctx->countHigh >> 16);
  sha256Ctx->currentBlock[58] = (unsigned char)(sha256Ctx->countHigh >> 8);
  sha256Ctx->currentBlock[59] = (unsigned char)(sha256Ctx->countHigh);
  sha256Ctx->currentBlock[60] = (unsigned char)(sha256Ctx->countLow >> 24);
  sha256Ctx->currentBlock[61] = (unsigned char)(sha256Ctx->countLow >> 16);
  sha256Ctx->currentBlock[62] = (unsigned char)(sha256Ctx->countLow >> 8);
  sha256Ctx->currentBlock[63] = (unsigned char)(sha256Ctx->countLow);

  sha256Ctx->SHA256Transform ((Pointer)sha256Ctx, sha256Ctx->currentBlock);

  /* The state is the digest.
   */
  digest[0]  = (unsigned char)(sha256Ctx->state[0] >> 24);
  digest[1]  = (unsigned char)(sha256Ctx->state[0] >> 16);
  digest[2]  = (unsigned char)(sha256Ctx->state[0] >> 8);
  digest[3]  = (unsigned char)(sha256Ctx->state[0]);
  digest[4]  = (unsigned char)(sha256Ctx->state[1] >> 24);
  digest[5]  = (unsigned char)(sha256Ctx->state[1] >> 16);
  digest[6]  = (unsigned char)(sha256Ctx->state[1] >> 8);
  digest[7]  = (unsigned char)(sha256Ctx->state[1]);
  digest[8]  = (unsigned char)(sha256Ctx->state[2] >> 24);
  digest[9]  = (unsigned char)(sha256Ctx->state[2] >> 16);
  digest[10] = (unsigned char)(sha256Ctx->state[2] >> 8);
  digest[11] = (unsigned char)(sha256Ctx->state[2]);
  digest[12] = (unsigned char)(sha256Ctx->state[3] >> 24);
  digest[13] = (unsigned char)(sha256Ctx->state[3] >> 16);
  digest[14] = (unsigned char)(sha256Ctx->state[3] >> 8);
  digest[15] = (unsigned char)(sha256Ctx->state[3]);
  digest[16] = (unsigned char)(sha256Ctx->state[4] >> 24);
  digest[17] = (unsigned char)(sha256Ctx->state[4] >> 16);
  digest[18] = (unsigned char)(sha256Ctx->state[4] >> 8);
  digest[19] = (unsigned char)(sha256Ctx->state[4]);
  digest[20] = (unsigned char)(sha256Ctx->state[5] >> 24);
  digest[21] = (unsigned char)(sha256Ctx->state[5] >> 16);
  digest[22] = (unsigned char)(sha256Ctx->state[5] >> 8);
  digest[23] = (unsigned char)(sha256Ctx->state[5]);
  digest[24] = (unsigned char)(sha256Ctx->state[6] >> 24);
  digest[25] = (unsigned char)(sha256Ctx->state[6] >> 16);
  digest[26] = (unsigned char)(sha256Ctx->state[6] >> 8);
  digest[27] = (unsigned char)(sha256Ctx->state[6]);
  digest[28] = (unsigned char)(sha256Ctx->state[7] >> 24);
  digest[29] = (unsigned char)(sha256Ctx->state[7] >> 16);
  digest[30] = (unsigned char)(sha256Ctx->state[7] >> 8);
  digest[31] = (unsigned char)(sha256Ctx->state[7]);

  return (0);
}

void SHA256Transform (
   Pointer ctx,
   unsigned char *block
   )
{
  int index;
  UInt32 *state = ((VoltSHA256Ctx *)ctx)->state;
  UInt32 *W = ((VoltSHA256Ctx *)ctx)->W;
  UInt32 *K = ((VoltSHA256Ctx *)ctx)->K;
  UInt32 A, B, C, D, E, F, G, H, T1, T2;

  /* Initialize the working variables.
   */
  A = state[0];
  B = state[1];
  C = state[2];
  D = state[3];
  E = state[4];
  F = state[5];
  G = state[6];
  H = state[7];

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

  /* Expand the block.
   */
  for (index = 16; index < 64; ++index)
  {
    T1 = SHA256_SIGMA_1 (W[index - 2]);
    T2 = SHA256_SIGMA_0 (W[index - 15]);
    W[index] = T1 + W[index - 7] + T2 + W[index - 16];
  }

  /* Adjust the working variables 64 times.
   */
  for (index = 0; index < 64; ++index)
  {
    T1 =
      H + SHA256_CAP_SIGMA_1 (E) + SHA256_CH (E, F, G) + K[index] + W[index];
    T2 = SHA256_CAP_SIGMA_0 (A) + SHA256_MAJ (A, B, C);
    H = G;
    G = F;
    F = E;
    E = D + T1;
    D = C;
    C = B;
    B = A;
    A = T1 + T2;
  }

  state[0] += A;
  state[1] += B;
  state[2] += C;
  state[3] += D;
  state[4] += E;
  state[5] += F;
  state[6] += G;
  state[7] += H;

  return;
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品1区2区3区在线观看| 亚洲一二三四区不卡| 国产一区二区三区黄视频 | 国产人久久人人人人爽| 高清成人在线观看| 亚洲欧洲韩国日本视频| 色欲综合视频天天天| 亚洲小说春色综合另类电影| 欧美日韩久久一区二区| 免费国产亚洲视频| 国产亚洲成av人在线观看导航 | 日本精品视频一区二区| 亚洲一区二区av在线| 91精品在线一区二区| 国内精品伊人久久久久av一坑| 国产婷婷一区二区| 一本久久精品一区二区| 天天影视网天天综合色在线播放 | 日韩黄色免费电影| 久久免费国产精品| 欧洲人成人精品| 精品一区二区久久| 一区二区三区在线不卡| 日韩视频在线你懂得| 成人污视频在线观看| 午夜在线电影亚洲一区| 欧美精品一区在线观看| 91久久香蕉国产日韩欧美9色| 久久精品理论片| 亚洲蜜臀av乱码久久精品| 在线观看91精品国产麻豆| 成人h动漫精品| 视频一区在线播放| 综合久久久久综合| 精品久久久久久无| 色屁屁一区二区| 激情五月婷婷综合网| 亚洲午夜电影网| 欧美极品少妇xxxxⅹ高跟鞋| 欧美日韩一级大片网址| 成人午夜视频在线| 麻豆专区一区二区三区四区五区| 亚洲欧美视频在线观看| 久久久久久久综合狠狠综合| 91麻豆精品国产91久久久久 | 一区二区视频在线| 久久精品免费在线观看| 91精品在线观看入口| 97久久精品人人澡人人爽| 久久成人综合网| 日韩专区在线视频| 亚洲国产一区视频| 亚洲精选免费视频| 中文字幕一区三区| 精品粉嫩aⅴ一区二区三区四区| 欧美日韩aaaaaa| 欧美在线色视频| www.亚洲精品| 成人一道本在线| 国产精品99精品久久免费| 久久99国产精品麻豆| 午夜精品福利视频网站| 亚洲午夜三级在线| 亚洲成年人影院| 亚洲一区在线观看免费观看电影高清| 国产精品不卡在线| 国产精品少妇自拍| 国产日产欧美一区二区三区 | 精品剧情v国产在线观看在线| 欧美日韩午夜在线| 欧美亚洲免费在线一区| 一本高清dvd不卡在线观看| 99久久国产综合精品色伊| www.亚洲人| 91美女视频网站| 一本大道久久精品懂色aⅴ| 成人国产在线观看| 99久久精品国产精品久久| 99re这里只有精品首页| 99久久er热在这里只有精品15| 丁香一区二区三区| www.亚洲免费av| 91免费国产视频网站| 色婷婷av一区二区三区gif| 91麻豆精品秘密| 欧洲精品一区二区| 欧美日韩久久一区| 日韩精品中文字幕一区二区三区 | 欧美xxxx老人做受| 日韩午夜在线观看| 久久蜜桃av一区二区天堂| 亚洲精品一区二区三区福利| 久久久精品国产免费观看同学| 国产日韩精品视频一区| 日韩毛片视频在线看| 亚洲va天堂va国产va久| 久久国产精品无码网站| 国产大陆亚洲精品国产| 9色porny自拍视频一区二区| 色先锋久久av资源部| 欧美视频在线播放| 精品日韩av一区二区| 久久九九久久九九| 国产精品丝袜在线| 亚洲一二三四区不卡| 青青草国产精品亚洲专区无| 国产精品综合一区二区三区| 91麻豆免费视频| 4438成人网| 欧美激情一区不卡| 亚洲成av人影院| 国产成人综合在线播放| 欧美在线制服丝袜| 久久久www免费人成精品| 亚洲精品久久7777| 美女视频黄久久| av亚洲产国偷v产偷v自拍| 日本韩国欧美一区二区三区| 日韩精品一区二区三区视频播放| 亚洲国产成人一区二区三区| 亚洲二区视频在线| 处破女av一区二区| 欧美电影一区二区| 中文字幕一区av| 狠狠色丁香九九婷婷综合五月| 91色porny| 国产视频一区二区在线观看| 亚洲一区在线观看免费| 国产999精品久久久久久绿帽| 7777精品伊人久久久大香线蕉经典版下载 | 91在线视频免费91| 精品国产伦理网| 亚洲影视资源网| 99热精品国产| 久久一区二区视频| 日韩影院精彩在线| 色综合久久中文字幕| 国产视频视频一区| 秋霞午夜av一区二区三区| 91亚洲男人天堂| 国产亚洲精品久| 麻豆成人久久精品二区三区红| 色天天综合久久久久综合片| 国产婷婷一区二区| 精品在线免费观看| 欧美一区二区观看视频| 亚洲精品高清在线| 成人精品电影在线观看| www国产精品av| 蜜臀av一级做a爰片久久| 色哟哟一区二区| 国产精品成人一区二区艾草 | 色综合夜色一区| 中文字幕中文乱码欧美一区二区| 国产一区二区三区免费看| 精品少妇一区二区三区在线视频| 亚洲动漫第一页| 欧美日韩一区在线观看| 亚洲女同女同女同女同女同69| 国产精品亚洲第一区在线暖暖韩国 | 亚洲免费三区一区二区| 国产成人高清在线| 国产欧美日韩精品在线| 韩国毛片一区二区三区| 欧美成人精品二区三区99精品| 天堂一区二区在线免费观看| 欧美日韩性生活| 日韩精品国产精品| 欧美一区二区福利在线| 久久国产人妖系列| 久久精品一区四区| 成人在线一区二区三区| 国产精品免费丝袜| 97久久超碰国产精品| 最新热久久免费视频| 色婷婷综合久久| 洋洋av久久久久久久一区| 在线观看视频91| 日本免费新一区视频| 欧美刺激午夜性久久久久久久 | 国产日韩v精品一区二区| 国产91精品免费| 亚洲同性gay激情无套| 日本高清无吗v一区| 天堂久久一区二区三区| 精品日韩在线观看| 成人激情电影免费在线观看| 一级做a爱片久久| 91精品久久久久久久久99蜜臂 | 972aa.com艺术欧美| 亚洲男同1069视频| 91麻豆精品国产91| 国产一区欧美一区| 亚洲欧美国产三级| 日韩欧美中文字幕一区| 成人av在线看| 午夜久久久久久电影| 国产日韩高清在线| 欧美美女视频在线观看| 韩日av一区二区|