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

📄 lili-ii.h

📁 lili加密算法
💻 H
字号:
/** * @file lili-ii.h * * Definitions for the LILI-II keystream generator. * * The LILI-II Keystream generator is defined in  * [CDF02]  Clark, A., Dawson, E., Fuller, J., Golic, J., Lee, H-J,  *          Millan, W., Moon, S-J., and Simpson, L. The LILI-II Keystream *          Generator, Proceedings of ACISP 2002,  Lecture Notes in  *          Computer Science 2384, Springer-Verlag, 2002, pp. 25 - 39. * * @author  Information Security Institute *          Queensland University of Technology *          Brisbane, Australia * @version 1.1 * @date    2006 */#ifndef _LILI2_H_#define _LILI2_H_#ifdef __cplusplusextern "C" {#endif/** * Type definitions */typedef unsigned char            u8;#if UINT_MAX >= 4294967295UL    typedef unsigned short        u16;    typedef unsigned int        u32;#else    typedef unsigned int        u16;    typedef unsigned long        u32;#endif/**--------------------------------------------------------------------------- * LILI-II API *--------------------------------------------------------------------------*//** * LILI-II Error codes */#define LILI2_INITIALIZATION_OK         0#define LILI2_INVALID_STATE            -1/** * The LILI-II context represents the state of the keystream generator,  * which consists of the clocking register C, and the output register D; */     #define LILI2_REG_C_LEN    16    /* 128 bits represented in 8-bit words */#define LILI2_REG_D_LEN    16    /* 127 bits represented in 8-bit words */#define LILI2_INTERNAL_STATE_SIZE (LILI2_REG_C_LEN + LILI2_REG_D_LEN)typedef struct{    u8  c[LILI2_REG_C_LEN];    u8  d[LILI2_REG_D_LEN];} LILI2Ctx;/** * LILI-II Key and IV sizes (in bytes) */#define LILI2_KEY_SIZE             16   #define LILI2_IV_SIZE              16   /** * Carry out the LILI-II resynchronization algorithm, given an 128-bit key * and 128-bit initialization vector. *  * @param    ctx  [In/Out]  LILI-II context * @param    key  [In]      128-bit key * @param    iv   [In]      128-bit IV * @returns  LILI_INITIALIZATION_OK if successful.  *           LILI_INVALID_STATE     if the all-zero state occurs. */int lili2_key_init(LILI2Ctx *ctx,                    const u8 *key,                    const u8 *iv,                    const u8  iv_length);/** * Generate keystream using the LILI-II keystream generator * * @param    ctx            [In]   initialized LILI-II context * @param    keystream      [Out]  repository for LILI-II keystream  * @param    keystream_len  [In]   number of bits of keystream requested * @returns  number of bits of keystream actually generated * @note     <keystream> must be preallocated with ceil(<keystream_len>/32) *           words of memory */u32 lili2_keystream(LILI2Ctx *ctx, u8 *keystream, const u32 keystream_len);#ifdef __cplusplus}#endif#endif

⌨️ 快捷键说明

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