⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mks_aes.h

📁 xtunnel nat/fw traversal source code
💻 H
字号:
/*	File:       MKS_AES.h	Contains:   Mok-Kong Shen's byte-oriented AES implementation	            http://home.t-online.de/home/mok-kong.shen/#paper1	            "Several readers of sci.crypt have verified that the package runs correctly on big-endian machines as well"	Copyright:  (c) 2003 by Xten Networks, Inc., all rights reserved.*//* ----------------------------------------------------------//// An AES implementation for 32-bit platforms//// Release 1.4  //// Release date: 10th October 2003//// Consisting of a principal part (this file) and a (separate) // Supplement. //// Author: Mok-Kong Shen, Munich, Germany//// Last date of site modification: (currently empty)////// Design assumptions: Size of unsigned int 32 bits.//                     Size of unsigned char 8 bits.//                     Sequential processing model.//// See copyright notice further below.//// For application runs, include the package as header file// and invoke in the main program://// (a) one call of aessetup(keylength), where keylength is //     one of 128, 192 and 256.//// (b) after placing the user-given key in the byte-array //     ukey.b[16], one call of aeskeyschedule(encrypt) or //     aeskeyschedule(decrypt), depending on whether //     encryption or decryption is to be done.//// (c) one call of aesprocess() for processing each input //     block provided in the byte-array aesin.b[16] to result //     in the output block in the byte-array aesout.b[16].//// Redo (a), if a different keylength is to be used. Redo // (b), if one changes key or switches from encryption to // decryption (or vice versa).//// For a demonstration with the example vectors of FIPS-197,// Appendix C, and benchmarking of the individual functions// mentioned in (a), (b) and (c) above, include the package // as header file and invoke in a main program the function// call aesdemo(). Check carefully with FIPS-197 that the // results (ciphertexts and recovered plaintexts) are indeed // correct before any practical applications of the package.//// The Supplement is informative only and is intended for // rendering easier the understanding or checking of certain // functions and for benchmark comparisons with other AES // implementations.//// Release 1.4, as originally issued, is available at // http://home.t-online.de/home/mok-kong.shen.//------------------------------------------------------------- */#ifndef _MKS_AES_H__250882B7_305F_44D1_8CF3_EC535AACF256_#define _MKS_AES_H__250882B7_305F_44D1_8CF3_EC535AACF256_ 1#ifdef __MWERKS__#pragma once#endif // __MWERKS__typedef unsigned char byte;typedef unsigned int word;// keylength = { 128, 192, 256 }void aessetup(int keylength);// user provided keytypedef union { byte b[32];  byte bm[8][4];  word w[8];} USERKEY;extern USERKEY ukey;// call after key is set up -- added 'nocrypt' for caller state infotypedef enum { encrypt, decrypt, nocrypt } PROCESS;void aeskeyschedule(PROCESS kind);// i/o data blockstypedef union { byte b[16];  byte bm[4][4];  word w[4];} BLOCK;extern BLOCK aesin;extern BLOCK aesout;// aesin --> aesoutvoid aesprocess();// command line correctness demo function -- verified on OS X & RedHat 9void aesdemo();#endif // ndef _MKS_AES_H__250882B7_305F_44D1_8CF3_EC535AACF256_

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -