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

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

?? aeskeypp.c

?? 該文件屬于c++運行環境下AES加密程序源碼。
?? C
字號:
/*
 -------------------------------------------------------------------------
 Copyright (c) 2001, Dr Brian Gladman <                 >, Worcester, UK.
 All rights reserved.

 LICENSE TERMS

 The free distribution and use of this software in both source and binary 
 form is allowed (with or without changes) provided that:

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

   2. distributions in binary form include the above copyright
      notice, this list of conditions and the following disclaimer
      in the documentation and/or other associated materials;

   3. the copyright holder's name 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 fitness for purpose.
 -------------------------------------------------------------------------
 Issue Date: 29/07/2002

 This file contains the code for implementing the key schedule for AES 
 (Rijndael) for block and key sizes of 16, 20, 24, 28 and 32 bytes.
*/

#include "aesopt.h"

/* Subroutine to set the block size (if variable) in bytes, legal
   values being 16, 24 and 32. 
*/

#if !defined(BLOCK_SIZE)

/* Subroutine to set the block size (if variable) in bytes, legal
   values being 16, 24 and 32. 
*/

aes_rval aes_blk_len(unsigned int blen, aes_ctx cx[1])
{
#if !defined(FIXED_TABLES)
    if(!tab_init) gen_tabs();
#endif

    if((blen & 3) || blen < 16 || blen > 32) 
    {     
        cx->n_blk = 0; return aes_bad;
    }

    cx->n_blk = blen;
    return aes_good;
}

#endif

/* Initialise the key schedule from the user supplied key. The key
   length is now specified in bytes - 16, 24 or 32 as appropriate.
   This corresponds to bit lengths of 128, 192 and 256 bits, and
   to Nk values of 4, 6 and 8 respectively.

   The following macros implement a single cycle in the key 
   schedule generation process. The number of cycles needed 
   for each cx->n_blk and nk value is:
 
    nk =             4  5  6  7  8
    ------------------------------
    cx->n_blk = 4   10  9  8  7  7
    cx->n_blk = 5   14 11 10  9  9
    cx->n_blk = 6   19 15 12 11 11
    cx->n_blk = 7   21 19 16 13 14
    cx->n_blk = 8   29 23 19 17 14
*/

/* Initialise the key schedule from the user supplied key. The key
   length is now specified in bytes - 16, 20, 24, 28 or 32 as 
   appropriate. This corresponds to bit lengths of 128, 160, 192,
   224 and 256 bits, and to Nk values of 4, 5, 6, 7 & 8 respectively.
 */

#define mx(t,f) (*t++ = inv_mcol(*f),f++)
#define cp(t,f) *t++ = *f++

#if   BLOCK_SIZE == 16
#define cpy(d,s)    cp(d,s); cp(d,s); cp(d,s); cp(d,s)
#define mix(d,s)    mx(d,s); mx(d,s); mx(d,s); mx(d,s)
#elif BLOCK_SIZE == 20
#define cpy(d,s)    cp(d,s); cp(d,s); cp(d,s); cp(d,s); \
                    cp(d,s)
#define mix(d,s)    mx(d,s); mx(d,s); mx(d,s); mx(d,s); \
                    mx(d,s)
#elif BLOCK_SIZE == 24
#define cpy(d,s)    cp(d,s); cp(d,s); cp(d,s); cp(d,s); \
                    cp(d,s); cp(d,s)
#define mix(d,s)    mx(d,s); mx(d,s); mx(d,s); mx(d,s); \
                    mx(d,s); mx(d,s)
#elif BLOCK_SIZE == 28
#define cpy(d,s)    cp(d,s); cp(d,s); cp(d,s); cp(d,s); \
                    cp(d,s); cp(d,s); cp(d,s)
#define mix(d,s)    mx(d,s); mx(d,s); mx(d,s); mx(d,s); \
                    mx(d,s); mx(d,s); mx(d,s)
#elif BLOCK_SIZE == 32
#define cpy(d,s)    cp(d,s); cp(d,s); cp(d,s); cp(d,s); \
                    cp(d,s); cp(d,s); cp(d,s); cp(d,s)
#define mix(d,s)    mx(d,s); mx(d,s); mx(d,s); mx(d,s); \
                    mx(d,s); mx(d,s); mx(d,s); mx(d,s)
#else

#define cpy(d,s) \
switch(nc) \
{   case 8: cp(d,s); \
    case 7: cp(d,s); \
    case 6: cp(d,s); \
    case 5: cp(d,s); \
    case 4: cp(d,s); cp(d,s); \
            cp(d,s); cp(d,s); \
}

#define mix(d,s) \
switch(nc) \
{   case 8: mx(d,s); \
    case 7: mx(d,s); \
    case 6: mx(d,s); \
    case 5: mx(d,s); \
    case 4: mx(d,s); mx(d,s); \
            mx(d,s); mx(d,s); \
}

#endif

/*  The following macros implement a single cycle in the key 
    schedule generation process. The number of cycles needed 
    for each cx->n_blk and nk value is:
 
    nk =      4  5  6  7  8
    -----------------------
    cx->n_blk = 4   10  9  8  7  7
    cx->n_blk = 5   14 11 10  9  9
    cx->n_blk = 6   19 15 12 11 11
    cx->n_blk = 7   21 19 16 13 14
    cx->n_blk = 8   29 23 19 17 14
*/

#define ks4(i) \
{   p ^= ls_box(s,3) ^ rcon_tab[i]; q ^= p; r ^= q; s ^= r; \
    cx->k_sch[4*(i)+4] = p; \
    cx->k_sch[4*(i)+5] = q; \
    cx->k_sch[4*(i)+6] = r; \
    cx->k_sch[4*(i)+7] = s; \
}

#define ks5(i) \
{   p ^= ls_box(t,3) ^ rcon_tab[i]; q ^= p; \
    r ^= q; s ^= r; t ^= s; \
    cx->k_sch[5*(i)+ 5] = p; \
    cx->k_sch[5*(i)+ 6] = q; \
    cx->k_sch[5*(i)+ 7] = r; \
    cx->k_sch[5*(i)+ 8] = s; \
    cx->k_sch[5*(i)+ 9] = t; \
}

#define ks6(i) \
{   p ^= ls_box(u,3) ^ rcon_tab[i]; q ^= p; \
    r ^= q; s ^= r; t ^= s; u ^= t; \
    cx->k_sch[6*(i)+ 6] = p; \
    cx->k_sch[6*(i)+ 7] = q; \
    cx->k_sch[6*(i)+ 8] = r; \
    cx->k_sch[6*(i)+ 9] = s; \
    cx->k_sch[6*(i)+10] = t; \
    cx->k_sch[6*(i)+11] = u; \
}

#define ks7(i) \
{   p ^= ls_box(v,3) ^ rcon_tab[i]; q ^= p; r ^= q; s ^= r; \
    t ^= ls_box(s,0); u ^= t; v ^= u; \
    cx->k_sch[7*(i)+ 7] = p; \
    cx->k_sch[7*(i)+ 8] = q; \
    cx->k_sch[7*(i)+ 9] = r; \
    cx->k_sch[7*(i)+10] = s; \
    cx->k_sch[7*(i)+11] = t; \
    cx->k_sch[7*(i)+12] = u; \
    cx->k_sch[7*(i)+13] = v; \
}

#define ks8(i) \
{   p ^= ls_box(w,3) ^ rcon_tab[i]; q ^= p; r ^= q; s ^= r; \
    t ^= ls_box(s,0); u ^= t; v ^= u; w ^= v; \
    cx->k_sch[8*(i)+ 8] = p; \
    cx->k_sch[8*(i)+ 9] = q; \
    cx->k_sch[8*(i)+10] = r; \
    cx->k_sch[8*(i)+11] = s; \
    cx->k_sch[8*(i)+12] = t; \
    cx->k_sch[8*(i)+13] = u; \
    cx->k_sch[8*(i)+14] = v; \
    cx->k_sch[8*(i)+15] = w; \
}

#if defined(ENCRYPTION_KEY_SCHEDULE)

aes_rval aes_enc_key(const unsigned char in_key[], unsigned int klen, aes_ctx cx[1])
{   aes_32t    i,p,q,r,s,t,u,v,w;

#if !defined(FIXED_TABLES)
    if(!tab_init) gen_tabs();
#endif

#if !defined(BLOCK_SIZE)
    if(!cx->n_blk) cx->n_blk = 16;
#else
    cx->n_blk = BLOCK_SIZE;
#endif

    cx->n_blk = (cx->n_blk & ~3) | 1;
    cx->n_rnd = ((klen >> 2) > nc ? (klen >> 2) : nc) + 6;

    cx->k_sch[0] = p = word_in(in_key     );
    cx->k_sch[1] = q = word_in(in_key +  4);
    cx->k_sch[2] = r = word_in(in_key +  8);
    cx->k_sch[3] = s = word_in(in_key + 12);

#if BLOCK_SIZE == 16 && defined(UNROLL)

    switch(klen >> 2)
    {
    case 4: ks4(0); ks4(1); ks4(2); ks4(3);
            ks4(4); ks4(5); ks4(6); ks4(7);
            ks4(8); ks4(9); 
            cx->n_rnd = 10; break;
    case 5: cx->k_sch[4] = t = word_in(in_key + 16);
            ks5(0); ks5(1); ks5(2); ks5(3);
            ks5(4); ks5(5); ks5(6); ks5(7); 
            ks5(8);  
            cx->n_rnd = 11; break;
    case 6: cx->k_sch[4] = t = word_in(in_key + 16);
            cx->k_sch[5] = u = word_in(in_key + 20);
            ks6(0); ks6(1); ks6(2); ks6(3);
            ks6(4); ks6(5); ks6(6); ks6(7); 
            cx->n_rnd = 12; break;
    case 7: cx->k_sch[4] = t = word_in(in_key + 16);
            cx->k_sch[5] = u = word_in(in_key + 20);
            cx->k_sch[6] = v = word_in(in_key + 24);
            ks7(0); ks7(1); ks7(2); ks7(3);
            ks7(4); ks7(5); ks7(6); 
            cx->n_rnd = 13; break;
    case 8: cx->k_sch[4] = t = word_in(in_key + 16);
            cx->k_sch[5] = u = word_in(in_key + 20);
            cx->k_sch[6] = v = word_in(in_key + 24);
            cx->k_sch[7] = w = word_in(in_key + 28);
            ks8(0); ks8(1); ks8(2); ks8(3);
            ks8(4); ks8(5); ks8(6); 
            cx->n_rnd = 14; break;
    default:cx->n_rnd = 0; return aes_bad;
    }
#else
    cx->n_rnd = ((klen >> 2) > nc ? (klen >> 2) : nc) + 6;
    {
        aes_32t l = (nc * (cx->n_rnd + 1) - 1) / (klen >> 2);
        switch(klen >> 2)
        {
        case 4: for(i = 0; i < l; ++i)
                    ks4(i);
                break;
        case 5: cx->k_sch[4] = t = word_in(in_key + 16);
                for(i = 0; i < l; ++i)
                    ks5(i);
                break;
        case 6: cx->k_sch[4] = t = word_in(in_key + 16);
                cx->k_sch[5] = u = word_in(in_key + 20);
                for(i = 0; i < l; ++i)
                    ks6(i);
                break;
        case 7: cx->k_sch[4] = t = word_in(in_key + 16);
                cx->k_sch[5] = u = word_in(in_key + 20);
                cx->k_sch[6] = v = word_in(in_key + 24);
                for(i = 0; i < l; ++i)
                    ks7(i);
                break;
        case 8: cx->k_sch[4] = t = word_in(in_key + 16);
                cx->k_sch[5] = u = word_in(in_key + 20);
                cx->k_sch[6] = v = word_in(in_key + 24);
                cx->k_sch[7] = w = word_in(in_key + 28);
                for(i = 0; i < l; ++i)
                    ks8(i);
                break;
        }
    }
#endif

    return aes_good;
}

#endif

#if defined(DECRYPTION_KEY_SCHEDULE)

aes_rval aes_dec_key(const unsigned char in_key[], unsigned int klen, aes_ctx cx[1])
{   aes_32t    i,p,q,r,s,t,u,v,w;
    dec_imvars

#if !defined(FIXED_TABLES)
    if(!tab_init) gen_tabs();
#endif

#if !defined(BLOCK_SIZE)
    if(!cx->n_blk) cx->n_blk = 16;
#else
    cx->n_blk = BLOCK_SIZE;
#endif

    cx->n_blk = (cx->n_blk & ~3) | 2;
    cx->n_rnd = ((klen >> 2) > nc ? (klen >> 2) : nc) + 6;

    cx->k_sch[0] = p = word_in(in_key     );
    cx->k_sch[1] = q = word_in(in_key +  4);
    cx->k_sch[2] = r = word_in(in_key +  8);
    cx->k_sch[3] = s = word_in(in_key + 12);

#if BLOCK_SIZE == 16 && defined(UNROLL)

    switch(klen >> 2)
    {
    case 4: ks4(0); ks4(1); ks4(2); ks4(3);
            ks4(4); ks4(5); ks4(6); ks4(7);
            ks4(8); ks4(9); 
            cx->n_rnd = 10; break;
    case 5: cx->k_sch[4] = t = word_in(in_key + 16);
            ks5(0); ks5(1); ks5(2); ks5(3);
            ks5(4); ks5(5); ks5(6); ks5(7); 
            ks5(8);  
            cx->n_rnd = 11; break;
    case 6: cx->k_sch[4] = t = word_in(in_key + 16);
            cx->k_sch[5] = u = word_in(in_key + 20);
            ks6(0); ks6(1); ks6(2); ks6(3);
            ks6(4); ks6(5); ks6(6); ks6(7); 
            cx->n_rnd = 12; break;
    case 7: cx->k_sch[4] = t = word_in(in_key + 16);
            cx->k_sch[5] = u = word_in(in_key + 20);
            cx->k_sch[6] = v = word_in(in_key + 24);
            ks7(0); ks7(1); ks7(2); ks7(3);
            ks7(4); ks7(5); ks7(6); 
            cx->n_rnd = 13; break;
    case 8: cx->k_sch[4] = t = word_in(in_key + 16);
            cx->k_sch[5] = u = word_in(in_key + 20);
            cx->k_sch[6] = v = word_in(in_key + 24);
            cx->k_sch[7] = w = word_in(in_key + 28);
            ks8(0); ks8(1); ks8(2); ks8(3);
            ks8(4); ks8(5); ks8(6); 
            cx->n_rnd = 14; break;
    default:cx->n_rnd = 0; return aes_bad;
    }
#else
    cx->n_rnd = ((klen >> 2) > nc ? (klen >> 2) : nc) + 6;
    {
        aes_32t l = (nc * (cx->n_rnd + 1) - 1) / (klen >> 2);
        switch(klen >> 2)
        {
        case 4: for(i = 0; i < l; ++i)
                    ks4(i);
                break;
        case 5: cx->k_sch[4] = t = word_in(in_key + 16);
                for(i = 0; i < l; ++i)
                    ks5(i);
                break;
        case 6: cx->k_sch[4] = t = word_in(in_key + 16);
                cx->k_sch[5] = u = word_in(in_key + 20);
                for(i = 0; i < l; ++i)
                    ks6(i);
                break;
        case 7: cx->k_sch[4] = t = word_in(in_key + 16);
                cx->k_sch[5] = u = word_in(in_key + 20);
                cx->k_sch[6] = v = word_in(in_key + 24);
                for(i = 0; i < l; ++i)
                    ks7(i);
                break;
        case 8: cx->k_sch[4] = t = word_in(in_key + 16);
                cx->k_sch[5] = u = word_in(in_key + 20);
                cx->k_sch[6] = v = word_in(in_key + 24);
                cx->k_sch[7] = w = word_in(in_key + 28);
                for(i = 0; i < l; ++i)
                    ks8(i);
                break;
        }
    }
#endif

#if (DEC_ROUND != NO_TABLES)
    for(i = nc; i < nc * cx->n_rnd; ++i)
        cx->k_sch[i] = inv_mcol(cx->k_sch[i]);
#endif

    return aes_good;
}

#endif

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人永久aaa| 国产精品久久久久久久久动漫| 国产午夜精品美女毛片视频| 亚洲伊人色欲综合网| 国产精品夜夜嗨| 7777精品伊人久久久大香线蕉的| 国产精品精品国产色婷婷| 麻豆一区二区三区| 欧美在线观看视频一区二区三区| 久久久美女毛片| 婷婷国产在线综合| 91视频com| 欧美韩国一区二区| 国产在线播放一区三区四| 欧美裸体bbwbbwbbw| 亚洲精品第一国产综合野| 国产91在线观看| 精品国产乱码久久久久久1区2区 | 欧美日韩aaa| 亚洲乱码中文字幕| 顶级嫩模精品视频在线看| 精品黑人一区二区三区久久 | 久久九九国产精品| 久久成人麻豆午夜电影| 555夜色666亚洲国产免| 伊人婷婷欧美激情| 91视视频在线观看入口直接观看www| 久久综合丝袜日本网| 老司机一区二区| 制服丝袜中文字幕亚洲| 亚洲18色成人| 欧美视频在线观看一区| 一区二区三区中文字幕电影| 99精品国产91久久久久久| 中文字幕av不卡| 国产suv精品一区二区6| 日本一区二区三区四区在线视频| 国产一区二区三区视频在线播放| 精品欧美一区二区三区精品久久| 男人的天堂亚洲一区| 欧美一区二区三区免费| 青青草原综合久久大伊人精品优势 | 成人免费一区二区三区在线观看| 国产精品乡下勾搭老头1| 精品成a人在线观看| 激情综合色综合久久| 精品美女在线观看| 国产一区日韩二区欧美三区| 久久丝袜美腿综合| 国产在线一区二区综合免费视频| 久久夜色精品一区| 国产成+人+日韩+欧美+亚洲| 国产精品美女久久福利网站 | 亚洲国产欧美在线人成| 欧美手机在线视频| 免费在线欧美视频| 精品国产三级a在线观看| 国产麻豆精品久久一二三| 久久九九99视频| 99久久亚洲一区二区三区青草| 中文字幕乱码久久午夜不卡| 99re这里只有精品6| 亚洲福利视频一区| 欧美一区二区三区的| 久久99国产精品久久99果冻传媒| 精品剧情v国产在线观看在线| 国产精品综合av一区二区国产馆| 日本一二三四高清不卡| 91免费版在线| 日韩国产欧美三级| 久久婷婷国产综合国色天香 | 免费在线观看视频一区| 久久免费的精品国产v∧| 亚洲精品在线观看视频| 国产一区二区精品久久| 中文字幕在线不卡一区| 欧美在线免费播放| 极品少妇一区二区三区精品视频| 国产精品麻豆久久久| 欧美日韩国产小视频在线观看| 免费在线观看成人| 国产精品乱子久久久久| 欧美视频一区在线观看| 国产一区美女在线| 亚洲女同一区二区| 91精品免费观看| 国产成人免费高清| 亚洲福利一区二区三区| 精品国产伦一区二区三区观看方式| 国产高清不卡一区二区| 亚洲国产精品精华液网站| 日韩美女一区二区三区四区| 成人国产亚洲欧美成人综合网| 亚洲国产裸拍裸体视频在线观看乱了| 欧美xxx久久| 91蜜桃网址入口| 久久成人免费网| 一区二区三国产精华液| 精品免费国产二区三区| 欧美伊人久久久久久久久影院| 久久成人综合网| 一区二区三区精密机械公司| 日韩欧美一级二级| 日本乱码高清不卡字幕| 国内成人免费视频| 亚洲国产一区二区三区| 国产婷婷色一区二区三区四区| 欧美色国产精品| 成人免费视频网站在线观看| 日韩不卡免费视频| 国产精品美女一区二区三区 | 一本在线高清不卡dvd| 欧美aa在线视频| 一区二区三区蜜桃网| 久久看人人爽人人| 91精品免费在线| 日本高清不卡aⅴ免费网站| 国产成人精品亚洲午夜麻豆| 亚洲成人先锋电影| 综合色天天鬼久久鬼色| 久久综合久久综合九色| 宅男噜噜噜66一区二区66| 97久久久精品综合88久久| 国产一区二区调教| 日本aⅴ亚洲精品中文乱码| 亚洲婷婷综合色高清在线| 久久精品综合网| 精品国产三级a在线观看| 欧美精品在线一区二区| 91九色02白丝porn| 成人avav影音| 国产麻豆精品theporn| 日本在线不卡视频一二三区| 亚洲永久精品国产| 亚洲九九爱视频| 国产精品视频一二三区| 26uuu色噜噜精品一区二区| 日韩一区二区三区视频在线观看| 欧洲精品视频在线观看| 99久久精品免费看| 波多野结衣欧美| 成人激情黄色小说| 国产高清不卡二三区| 国产一区在线不卡| 麻豆成人av在线| 免费在线视频一区| 欧美96一区二区免费视频| 五月婷婷综合在线| 亚洲国产综合91精品麻豆| 一区二区三区四区国产精品| 亚洲欧洲精品一区二区精品久久久| 日本一区二区免费在线观看视频 | 欧美一区二区视频在线观看2020 | av电影在线观看一区| 成人激情文学综合网| 国产高清一区日本| 国产精品羞羞答答xxdd| 国产黑丝在线一区二区三区| 国产一区 二区 三区一级| 六月婷婷色综合| 国产在线看一区| 韩国女主播成人在线观看| 韩国中文字幕2020精品| 国产一区二区剧情av在线| 九九热在线视频观看这里只有精品| 美国十次综合导航| 精品亚洲成a人| 国产传媒久久文化传媒| 成人午夜av在线| 99久久综合色| 91视视频在线直接观看在线看网页在线看| 99久久精品国产麻豆演员表| 色哟哟一区二区三区| 欧美日韩高清一区| 精品美女在线播放| 久久精品一区八戒影视| 中文字幕日本不卡| 一区二区免费视频| 日一区二区三区| 国内外精品视频| 丰满少妇在线播放bd日韩电影| 95精品视频在线| 欧美军同video69gay| 欧美不卡一区二区三区| 欧美国产一区二区| 亚洲精品美腿丝袜| 视频在线观看一区二区三区| 久久超碰97中文字幕| 成人午夜短视频| 欧美性猛片aaaaaaa做受| 日韩亚洲欧美中文三级| 久久精品欧美一区二区三区麻豆| 中文字幕亚洲一区二区av在线| 亚洲综合色区另类av| 免费在线看一区| 丁香六月综合激情| 欧美偷拍一区二区| 久久久91精品国产一区二区精品| 亚洲精品久久久蜜桃| 日韩av在线播放中文字幕|