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

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

?? aeskeypp.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一区二区三区免费野_久草精品视频
国产精品1024| 日韩免费看的电影| 日韩一区二区三区视频在线| 国产午夜精品理论片a级大结局| 日韩理论电影院| 精品午夜一区二区三区在线观看| 91官网在线观看| 国产三级精品视频| 久久精品国产一区二区三 | 在线一区二区三区| 久久美女高清视频| 日韩福利视频网| 日本久久一区二区三区| 亚洲国产高清在线| 国产在线不卡一区| 日韩欧美一卡二卡| 日韩和的一区二区| 欧美日韩一区二区三区视频| 亚洲免费色视频| 99精品黄色片免费大全| 欧美激情综合五月色丁香| 久久精品99国产精品| 在线成人午夜影院| 首页国产欧美久久| 欧美久久久影院| 午夜激情一区二区| 欧美日韩精品是欧美日韩精品| 亚洲精品你懂的| 一本大道久久a久久精品综合| 国产精品理论在线观看| www.亚洲精品| 亚洲视频在线观看三级| av一本久道久久综合久久鬼色| 中文一区在线播放| 99re66热这里只有精品3直播| 国产精品毛片高清在线完整版| 国产 日韩 欧美大片| 国产日韩亚洲欧美综合| 成人午夜视频在线观看| 亚洲欧洲日本在线| 色天天综合色天天久久| 亚洲大型综合色站| 日韩欧美中文字幕公布| 国产精品自拍av| 国产精品福利av| 欧洲一区在线观看| 日本伊人午夜精品| 久久久99久久| 91日韩精品一区| 亚洲电影在线播放| 精品少妇一区二区三区免费观看| 国产一区二区影院| 综合色中文字幕| 欧美日韩精品一区二区三区| 激情五月激情综合网| 国产精品久久久久久亚洲毛片| 色综合天天综合网天天狠天天| 亚洲一区二区三区中文字幕在线| 在线亚洲一区观看| 黄一区二区三区| 国产免费观看久久| 欧美日韩在线三区| 国产精品88av| 亚洲va中文字幕| 国产欧美精品区一区二区三区 | 欧美精彩视频一区二区三区| 99久久er热在这里只有精品66| 亚洲国产欧美日韩另类综合| 欧美成人猛片aaaaaaa| 97久久精品人人爽人人爽蜜臀| 天堂在线亚洲视频| 国产精品天干天干在线综合| 欧美日韩一区二区三区四区五区| 国产精品99久久久| 石原莉奈一区二区三区在线观看 | 一区av在线播放| 日韩精品影音先锋| 在线国产电影不卡| 国产精品一卡二| 亚洲va韩国va欧美va精品| 日本一区二区视频在线| 制服丝袜亚洲播放| 99vv1com这只有精品| 精久久久久久久久久久| 亚洲综合视频在线观看| 国产清纯白嫩初高生在线观看91 | 日韩av中文字幕一区二区| 中文字幕第一区综合| 日韩免费一区二区三区在线播放| 色天天综合久久久久综合片| 粉嫩aⅴ一区二区三区四区 | 亚洲精品国产精华液| 久久亚洲一区二区三区明星换脸| 欧美天天综合网| 97se亚洲国产综合在线| 国产成+人+日韩+欧美+亚洲| 久久99久久精品欧美| 日韩电影免费在线| 亚洲777理论| 亚洲午夜激情av| 亚洲免费在线电影| 亚洲美女电影在线| 亚洲欧美综合色| 国产精品久久久久久亚洲毛片| 久久久欧美精品sm网站| 欧美一区二区日韩| 91精品国产综合久久小美女| 欧美体内she精高潮| 欧美视频在线播放| 91极品美女在线| 在线观看中文字幕不卡| 欧美性xxxxxx少妇| 欧美亚洲动漫精品| 欧美日韩成人综合在线一区二区| 欧美亚洲一区二区在线| 欧美中文一区二区三区| 欧美三级蜜桃2在线观看| 欧美日韩一区二区三区视频| 欧美丰满嫩嫩电影| 日韩欧美色电影| 久久奇米777| 国产欧美精品一区aⅴ影院| 国产精品毛片a∨一区二区三区 | 91老师国产黑色丝袜在线| 99久久伊人精品| 日本韩国欧美三级| 欧美精品在线观看播放| 日韩精品一区在线观看| 久久九九影视网| 亚洲天堂av一区| 香蕉久久一区二区不卡无毒影院| 丝袜诱惑亚洲看片| 国产曰批免费观看久久久| 国产91富婆露脸刺激对白| 99久久夜色精品国产网站| 在线视频欧美区| 91精品国产色综合久久不卡电影| 日韩一区和二区| 日本一区二区三区四区| 亚洲黄色录像片| 美女性感视频久久| 成人综合在线观看| 欧美午夜电影在线播放| 精品久久久久久无| 亚洲天堂网中文字| 美女视频黄免费的久久| 成人aa视频在线观看| 欧美日韩一区不卡| 欧美激情综合在线| 亚洲va国产天堂va久久en| 国产激情视频一区二区三区欧美 | 亚洲人成亚洲人成在线观看图片 | 久久99国产精品麻豆| av激情综合网| 日韩精品中文字幕在线不卡尤物 | 国产午夜一区二区三区| 夜夜精品视频一区二区| 蜜乳av一区二区| 91麻豆国产精品久久| 欧美大尺度电影在线| 亚洲欧美日韩久久| 国产精一品亚洲二区在线视频| 在线一区二区三区四区五区| 久久久久久久久免费| 午夜影院在线观看欧美| 9人人澡人人爽人人精品| 欧美电影免费观看完整版| 亚洲自拍都市欧美小说| 国产麻豆成人传媒免费观看| 欧美日韩国产影片| 亚洲日本成人在线观看| 国产福利一区二区三区| 777午夜精品免费视频| 一区二区三区色| 成人av网站在线观看| 亚洲精品一区二区三区影院 | 在线观看精品一区| 欧美高清在线精品一区| 精品一区二区三区视频在线观看 | 91蜜桃视频在线| ww久久中文字幕| 蜜桃精品视频在线| 欧美精品丝袜久久久中文字幕| 亚洲人成网站影音先锋播放| 国产成人av资源| 久久久久久久久久看片| 久久爱www久久做| 欧美日韩电影一区| 亚洲午夜成aⅴ人片| 91美女视频网站| 一区视频在线播放| 99久久er热在这里只有精品66| 中文字幕av一区二区三区高| 国产在线观看一区二区| 2020国产成人综合网| 国产一区二区三区不卡在线观看| 91麻豆精品国产91久久久| 五月婷婷欧美视频| 91精品国产福利| 美腿丝袜在线亚洲一区|