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

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

?? sha1.c

?? turecrypt6.0版本的源碼
?? C
字號:
/* Deprecated/legacy */

/*
 ---------------------------------------------------------------------------
 Copyright (c) 2002, Dr Brian Gladman, Worcester, UK.   All rights reserved.

 LICENSE TERMS

 The free distribution and use of this software is allowed (with or without
 changes) provided that:

  1. source code distributions include the above copyright notice, this
     list of conditions and the following disclaimer;

  2. binary distributions include the above copyright notice, this list
     of conditions and the following disclaimer in their documentation;

  3. the name of the copyright holder is not used to endorse products
     built using this software without specific written permission.

 DISCLAIMER

 This software is provided 'as is' with no explicit or implied warranties
 in respect of its properties, including, but not limited to, correctness
 and/or fitness for purpose.
 ---------------------------------------------------------------------------
 Issue Date: 18/06/2004

 This is a byte oriented version of SHA1 that operates on arrays of bytes
 stored in memory.
*/

#include <string.h>     /* for memcpy() etc.        */
#include <stdlib.h>     /* for _lrotl with VC++     */

#include "Sha1.h"

#if defined(__cplusplus)
extern "C"
{
#endif

/*
    To obtain the highest speed on processors with 32-bit words, this code
    needs to determine the order in which bytes are packed into such words.
    The following block of code is an attempt to capture the most obvious
    ways in which various environemnts specify their endian definitions.
    It may well fail, in which case the definitions will need to be set by
    editing at the points marked **** EDIT HERE IF NECESSARY **** below.
*/

/*  PLATFORM SPECIFIC INCLUDES */

/* Original byte order detection removed */
#include "../Common/Endian.h"

#define BRG_LITTLE_ENDIAN   1234 /* byte 0 is least significant (i386) */
#define BRG_BIG_ENDIAN      4321 /* byte 0 is most significant (mc68k) */

#if BYTE_ORDER == LITTLE_ENDIAN
#  define PLATFORM_BYTE_ORDER BRG_LITTLE_ENDIAN
#endif

#if BYTE_ORDER == BIG_ENDIAN
#  define PLATFORM_BYTE_ORDER BRG_BIG_ENDIAN
#endif

#ifdef _MSC_VER
#pragma intrinsic(memcpy)
#endif

#if 1 && defined(_MSC_VER) && !defined(_DEBUG)
#define rotl32  _rotl
#define rotr32  _rotr
#else
#define rotl32(x,n)   (((x) << n) | ((x) >> (32 - n)))
#define rotr32(x,n)   (((x) >> n) | ((x) << (32 - n)))
#endif

#if !defined(bswap_32)
#define bswap_32(x) (rotr32((x), 24) & 0x00ff00ff | rotr32((x), 8) & 0xff00ff00)
#endif

#if (PLATFORM_BYTE_ORDER == BRG_LITTLE_ENDIAN)
#define SWAP_BYTES
#else
#undef  SWAP_BYTES
#endif

#if defined(SWAP_BYTES)
#define bsw_32(p,n) \
    { int _i = (n); while(_i--) ((sha1_32t*)p)[_i] = bswap_32(((sha1_32t*)p)[_i]); }
#else
#define bsw_32(p,n)
#endif

#define SHA1_MASK   (SHA1_BLOCK_SIZE - 1)

#if 0

#define ch(x,y,z)       (((x) & (y)) ^ (~(x) & (z)))
#define parity(x,y,z)   ((x) ^ (y) ^ (z))
#define maj(x,y,z)      (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z)))

#else   /* Discovered by Rich Schroeppel and Colin Plumb   */

#define ch(x,y,z)       ((z) ^ ((x) & ((y) ^ (z))))
#define parity(x,y,z)   ((x) ^ (y) ^ (z))
#define maj(x,y,z)      (((x) & (y)) | ((z) & ((x) ^ (y))))

#endif

/* Compile 64 bytes of hash data into SHA1 context. Note    */
/* that this routine assumes that the byte order in the     */
/* ctx->wbuf[] at this point is in such an order that low   */
/* address bytes in the ORIGINAL byte stream will go in     */
/* this buffer to the high end of 32-bit words on BOTH big  */
/* and little endian systems                                */

#ifdef ARRAY
#define q(v,n)  v[n]
#else
#define q(v,n)  v##n
#endif

#define one_cycle(v,a,b,c,d,e,f,k,h)            \
    q(v,e) += rotr32(q(v,a),27) +               \
              f(q(v,b),q(v,c),q(v,d)) + k + h;  \
    q(v,b)  = rotr32(q(v,b), 2)

#define five_cycle(v,f,k,i)                 \
    one_cycle(v, 0,1,2,3,4, f,k,hf(i  ));   \
    one_cycle(v, 4,0,1,2,3, f,k,hf(i+1));   \
    one_cycle(v, 3,4,0,1,2, f,k,hf(i+2));   \
    one_cycle(v, 2,3,4,0,1, f,k,hf(i+3));   \
    one_cycle(v, 1,2,3,4,0, f,k,hf(i+4))

void sha1_compile(sha1_ctx ctx[1])
{   sha1_32t    *w = ctx->wbuf;

#ifdef ARRAY
    sha1_32t    v[5];
    memcpy(v, ctx->hash, 5 * sizeof(sha1_32t));
#else
    sha1_32t    v0, v1, v2, v3, v4;
    v0 = ctx->hash[0]; v1 = ctx->hash[1];
    v2 = ctx->hash[2]; v3 = ctx->hash[3];
    v4 = ctx->hash[4];
#endif

#define hf(i)   w[i]

    five_cycle(v, ch, 0x5a827999,  0);
    five_cycle(v, ch, 0x5a827999,  5);
    five_cycle(v, ch, 0x5a827999, 10);
    one_cycle(v,0,1,2,3,4, ch, 0x5a827999, hf(15)); \

#undef  hf
#define hf(i) (w[(i) & 15] = rotl32(                    \
                 w[((i) + 13) & 15] ^ w[((i) + 8) & 15] \
               ^ w[((i) +  2) & 15] ^ w[(i) & 15], 1))

    one_cycle(v,4,0,1,2,3, ch, 0x5a827999, hf(16));
    one_cycle(v,3,4,0,1,2, ch, 0x5a827999, hf(17));
    one_cycle(v,2,3,4,0,1, ch, 0x5a827999, hf(18));
    one_cycle(v,1,2,3,4,0, ch, 0x5a827999, hf(19));

    five_cycle(v, parity, 0x6ed9eba1,  20);
    five_cycle(v, parity, 0x6ed9eba1,  25);
    five_cycle(v, parity, 0x6ed9eba1,  30);
    five_cycle(v, parity, 0x6ed9eba1,  35);

    five_cycle(v, maj, 0x8f1bbcdc,  40);
    five_cycle(v, maj, 0x8f1bbcdc,  45);
    five_cycle(v, maj, 0x8f1bbcdc,  50);
    five_cycle(v, maj, 0x8f1bbcdc,  55);

    five_cycle(v, parity, 0xca62c1d6,  60);
    five_cycle(v, parity, 0xca62c1d6,  65);
    five_cycle(v, parity, 0xca62c1d6,  70);
    five_cycle(v, parity, 0xca62c1d6,  75);

#ifdef ARRAY
    ctx->hash[0] += v[0]; ctx->hash[1] += v[1];
    ctx->hash[2] += v[2]; ctx->hash[3] += v[3];
    ctx->hash[4] += v[4];
#else
    ctx->hash[0] += v0; ctx->hash[1] += v1;
    ctx->hash[2] += v2; ctx->hash[3] += v3;
    ctx->hash[4] += v4;
#endif
}

void sha1_begin(sha1_ctx ctx[1])
{
    ctx->count[0] = ctx->count[1] = 0;
    ctx->hash[0] = 0x67452301;
    ctx->hash[1] = 0xefcdab89;
    ctx->hash[2] = 0x98badcfe;
    ctx->hash[3] = 0x10325476;
    ctx->hash[4] = 0xc3d2e1f0;
}

/* SHA1 hash data in an array of bytes into hash buffer and */
/* call the hash_compile function as required.              */

void sha1_hash(const unsigned char data[], unsigned __int32 len, sha1_ctx ctx[1])
{   sha1_32t pos = (sha1_32t)(ctx->count[0] & SHA1_MASK),
            space = SHA1_BLOCK_SIZE - pos;
    const unsigned char *sp = data;

    if((ctx->count[0] += len) < len)
        ++(ctx->count[1]);

    while(len >= space)     /* tranfer whole blocks if possible  */
    {
        memcpy(((unsigned char*)ctx->wbuf) + pos, sp, space);
        sp += space; len -= space; space = SHA1_BLOCK_SIZE; pos = 0;
        bsw_32(ctx->wbuf, SHA1_BLOCK_SIZE >> 2);
        sha1_compile(ctx);
    }

    memcpy(((unsigned char*)ctx->wbuf) + pos, sp, len);
}

/* SHA1 final padding and digest calculation  */

void sha1_end(unsigned char hval[], sha1_ctx ctx[1])
{   sha1_32t    i = (sha1_32t)(ctx->count[0] & SHA1_MASK);

    /* put bytes in the buffer in an order in which references to   */
    /* 32-bit words will put bytes with lower addresses into the    */
    /* top of 32 bit words on BOTH big and little endian machines   */
    bsw_32(ctx->wbuf, (i + 3) >> 2);

    /* we now need to mask valid bytes and add the padding which is */
    /* a single 1 bit and as many zero bits as necessary. Note that */
    /* we can always add the first padding byte here because the    */
    /* buffer always has at least one empty slot                    */
    ctx->wbuf[i >> 2] &= 0xffffff80 << 8 * (~i & 3);
    ctx->wbuf[i >> 2] |= 0x00000080 << 8 * (~i & 3);

    /* we need 9 or more empty positions, one for the padding byte  */
    /* (above) and eight for the length count. If there is not      */
    /* enough space, pad and empty the buffer                       */
    if(i > SHA1_BLOCK_SIZE - 9)
    {
        if(i < 60) ctx->wbuf[15] = 0;
        sha1_compile(ctx);
        i = 0;
    }
    else    /* compute a word index for the empty buffer positions  */
        i = (i >> 2) + 1;

    while(i < 14) /* and zero pad all but last two positions        */
        ctx->wbuf[i++] = 0;

    /* the following 32-bit length fields are assembled in the      */
    /* wrong byte order on little endian machines but this is       */
    /* corrected later since they are only ever used as 32-bit      */
    /* word values.                                                 */
    ctx->wbuf[14] = (ctx->count[1] << 3) | (ctx->count[0] >> 29);
    ctx->wbuf[15] = ctx->count[0] << 3;
    sha1_compile(ctx);

    /* extract the hash value as bytes in case the hash buffer is   */
    /* misaligned for 32-bit words                                  */
    for(i = 0; i < SHA1_DIGEST_SIZE; ++i)
        hval[i] = (unsigned char)(ctx->hash[i >> 2] >> (8 * (~i & 3)));
}

void sha1(unsigned char hval[], const unsigned char data[], unsigned __int32 len)
{   sha1_ctx    cx[1];

    sha1_begin(cx); sha1_hash(data, len, cx); sha1_end(hval, cx);
}

#if defined(__cplusplus)
}
#endif

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
中文字幕一区不卡| 极品尤物av久久免费看| 亚洲人成精品久久久久久| 久久尤物电影视频在线观看| 欧美日韩国产精选| 8v天堂国产在线一区二区| 欧美日本高清视频在线观看| 欧美日韩黄色一区二区| 欧美日本一道本| 欧美日本视频在线| 日韩一区二区三区视频在线 | 久久九九久久九九| 久久久久九九视频| 中文幕一区二区三区久久蜜桃| 久久久精品免费免费| 日本一二三四高清不卡| 亚洲欧洲色图综合| 亚洲一区二区精品久久av| 性久久久久久久久| 免费成人在线观看视频| 看国产成人h片视频| 国产激情精品久久久第一区二区| 国产一区二区导航在线播放| 国产激情视频一区二区在线观看 | 免费av网站大全久久| 激情深爱一区二区| 成人免费视频一区二区| 91美女蜜桃在线| 欧美高清www午色夜在线视频| 日韩色视频在线观看| 中文字幕不卡一区| 亚洲18影院在线观看| 国产麻豆成人传媒免费观看| av中文字幕不卡| 一本一道久久a久久精品综合蜜臀| 91久久精品网| 欧美肥大bbwbbw高潮| 欧美成人官网二区| 欧美激情一区在线| 亚洲欧美色图小说| 日日欢夜夜爽一区| 天堂av在线一区| 国产综合色产在线精品| 99精品黄色片免费大全| 欧美日韩视频在线第一区 | 亚洲欧美日韩国产成人精品影院| 一区二区三区在线高清| 午夜欧美视频在线观看| 水蜜桃久久夜色精品一区的特点 | 欧美性色黄大片手机版| 欧美一区二区免费| 欧美激情一区二区三区| 亚洲一区二区四区蜜桃| 另类小说一区二区三区| 成人av午夜电影| 欧美视频一区二区三区| 久久久久久久综合| 亚洲另类在线视频| 日本欧美大码aⅴ在线播放| 国产成人精品免费一区二区| 欧美羞羞免费网站| 久久色中文字幕| 亚洲国产另类精品专区| 男人的j进女人的j一区| 另类成人小视频在线| 高清不卡在线观看av| 欧美性色黄大片| 国产三级三级三级精品8ⅰ区| 一区二区欧美视频| 韩国精品一区二区| 欧美日韩一区不卡| 国产精品日韩成人| 琪琪久久久久日韩精品| 波多野结衣中文一区| 欧美精品电影在线播放| 欧美国产精品专区| 男人的天堂久久精品| 色先锋资源久久综合| 制服丝袜亚洲网站| 日本一区二区三区免费乱视频| 亚洲丰满少妇videoshd| 成人综合婷婷国产精品久久蜜臀| 欧美丰满一区二区免费视频| 国产精品毛片久久久久久久| 男男视频亚洲欧美| 91福利视频久久久久| 国产女同性恋一区二区| 青青草原综合久久大伊人精品优势| 91麻豆福利精品推荐| 国产亚洲欧美在线| 久久精品久久久精品美女| 91国产精品成人| 国产精品久久毛片a| 精品在线播放免费| 欧美系列日韩一区| 中文字幕一区二区三区色视频| 精品一区中文字幕| 91精品久久久久久久99蜜桃 | 成人动漫一区二区| 26uuu国产电影一区二区| 五月婷婷综合激情| 91福利视频久久久久| 亚洲日本免费电影| 成人av在线一区二区| 国产日韩欧美一区二区三区综合| 久久精品国产在热久久| 欧美二区在线观看| 亚洲第一久久影院| 一本大道久久精品懂色aⅴ| 欧美国产精品一区二区三区| 精品一区二区久久久| 欧美一级欧美三级在线观看| 午夜精品视频一区| 欧美日本在线播放| 五月天丁香久久| 欧美精品在线观看播放| 亚洲国产欧美在线| 欧美日韩午夜精品| 同产精品九九九| 欧美美女bb生活片| 丝袜诱惑制服诱惑色一区在线观看| 精品视频全国免费看| 亚洲午夜精品在线| 欧美日韩精品一区二区天天拍小说 | 成人va在线观看| 亚洲欧洲日本在线| 91福利资源站| 亚洲成人av一区二区三区| 欧美色大人视频| 三级在线观看一区二区| 91精品婷婷国产综合久久性色| 日韩av电影免费观看高清完整版在线观看| 欧美优质美女网站| 天堂精品中文字幕在线| 欧美一级搡bbbb搡bbbb| 国内外成人在线| 欧美mv日韩mv| 成人激情动漫在线观看| 亚洲色图19p| 欧美精品色综合| 国内精品视频666| 中文在线一区二区| 色一情一乱一乱一91av| 天堂在线一区二区| 久久日韩精品一区二区五区| 国产成人8x视频一区二区| 综合欧美亚洲日本| 欧美麻豆精品久久久久久| 国产成人av在线影院| 亚洲美女少妇撒尿| 欧美一区二区三区免费观看视频| 国产一区二区三区黄视频| 国产精品对白交换视频| 91成人在线观看喷潮| 欧美a一区二区| 国产精品久久网站| 欧美日韩亚洲高清一区二区| 韩国欧美一区二区| 国产精品不卡在线| 69精品人人人人| 波多野结衣亚洲| 日韩二区在线观看| 国产视频一区二区在线| 欧美性一级生活| 国产在线不卡视频| 亚洲自拍与偷拍| 精品美女在线观看| 色视频成人在线观看免| 老司机午夜精品| 亚洲三级电影网站| 8v天堂国产在线一区二区| aaa亚洲精品一二三区| 天堂va蜜桃一区二区三区| 日本一区二区三区四区在线视频| 欧美日韩久久一区二区| 毛片av一区二区| 午夜精品123| 国产精品黄色在线观看| 欧美一区二区三区思思人| 波多野结衣的一区二区三区| 蜜桃免费网站一区二区三区| 中文字幕视频一区| 久久色在线视频| 欧美日韩美女一区二区| 不卡一区二区三区四区| 天天影视网天天综合色在线播放 | 国产日韩欧美精品电影三级在线| 911精品产国品一二三产区| 99国产精品国产精品久久| 免费成人你懂的| 亚洲综合色视频| 国产精品三级在线观看| 欧美一区二区久久| 色综合av在线| 国产成人av自拍| 韩国毛片一区二区三区| 日韩精品一二三四| 亚洲精品一二三| 久久精品综合网| 精品国产伦一区二区三区观看方式|