aesaux.h

来自「escription: The Rijndael Encryption algo」· C头文件 代码 · 共 48 行

H
48
字号

// Copyright in this code is held by Dr B. R. Gladman but free direct or
// derivative use is permitted subject to acknowledgement of its origin.
// Dr B. R. Gladman <brg@gladman.uk.net> 1st June 2001.

#include <iostream>
#include <fstream>
#include <strstream>
#include <iomanip>
#include <cctype>

typedef unsigned char   byte;
typedef unsigned long   word;

const enum line_type { bad_line = 0, block_len, key_len, test_no, iv_val, key_val, pt_val, ct_val };
#define NO_LTYPES   8
#define BADL_STR    "BADLINE="
#define BLEN_STR    "BLOCKSIZE="
#define KLEN_STR    "KEYSIZE=  "
#define TEST_STR    "TEST= "
#define IV_STR      "IV=   "
#define KEY_STR     "KEY=  "
#define PT_STR      "PT=   "
#define CT_STR      "CT=   "

char      *file_name(char* buf, const word type, const word blen, const word klen);
char      *copy_str(char *s, const char *fstr);
bool      get_line(std::ifstream& inf, char s[]);
void      block_out(const line_type ty, const byte b[], std::ofstream& outf, const word len);

int       find_string(const char *s1, const char s2[]);
line_type find_line(std::ifstream& inf, char str[]);

word    rand32(void);
byte    rand8(void);
int     block_in(byte l[], const char *p);
void    block_clear(byte l[], const word len);
void    block_reverse(byte l[], const word len);
void    block_copy(byte l[], const byte r[], const word len);
void    block_xor(byte l[], const byte r[], const word len);
bool    block_cmp(const byte l[], const byte r[], const word len);
void    block_rndfill(byte l[], word len);

void    put_dec(char *s, int val);
int     get_dec(const char *s);
int     cmp_nocase(const char *s1, const char *s2);
bool    test_args(int argc, char *argv[], char des_chr, char tst_chr);

⌨️ 快捷键说明

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