㈠ 高分求高手指导密码学课程设计 使用VC++实现DES加密/解密算法的软件系统
找个DES源码,自己加入MFC的界面就可以了
㈡ 谁有密码学课程设计的仿射密码的攻击和MD5的实现的源代码,能给我邮箱发份,谢谢了
㈢ 什么是信息安全密码学在信息安全中的地位和作用如何
信息安全本身包括的范围很大,大到国家军事政治等机密安全,小范围的当然还包括如防范商业企业机密泄露,防范青少年对不良信息的浏览,个人信息的泄露等。网络环境下的信息安全体系是保证信息安全的关键,包括计算机安全操作系统、各种安全协议、安全机制(数字签名,信息认证,数据加密等),直至安全系统,其中任何一个安全漏洞便可以威胁全局安全。信息安全服务至少应该包括支持信息网络安全服务的基本理论,以及基于新一代信息网络体系结构的网络安全服务体系结构。
信息安全是指信息网络的硬件、软件及其系统中的数据受到保护,不受偶然的或者恶意的原因而遭到破坏、更改、泄露,系统连续可靠正常地运行,信息服务不中断。
信息安全是一门涉及计算机科学、网络技术、通信技术、密码技术、信息安全技术、应用数学、数论、信息论等多种学科的综合性学科。
从广义来说,凡是涉及到网络上信息的保密性、完整性、可用性、真实性和可控性的相关技术和理论都是网络安全的研究领域。
密码学是信息安全的基石.
㈣ 简述密码学在实现信息安全目标中所起的作用。
信息安全本身包括的范围很大,大到国家军事政治等机密安全,小范围的当然还包括如防范商业企业机密泄露,防范青少年对不良信息的浏览,个人信息的泄露等。网络环境下的信息安全体系是保证信息安全的关键,包括计算机安全操作系统、各种安全协议、安全机制(数字签名,信息认证,数据加密等),直至安全系统,其中任何一个安全漏洞便可以威胁全局安全。信息安全服务至少应该包括支持信息网络安全服务的基本理论,以及基于新一代信息网络体系结构的网络安全服务体系结构。
信息安全是指信息网络的硬件、软件及其系统中的数据受到保护,不受偶然的或者恶意的原因而遭到破坏、更改、泄露,系统连续可靠正常地运行,信息服务不中断。
信息安全是一门涉及计算机科学、网络技术、通信技术、密码技术、信息安全技术、应用数学、数论、信息论等多种学科的综合性学科。
从广义来说,凡是涉及到网络上信息的保密性、完整性、可用性、真实性和可控性的相关技术和理论都是网络安全的研究领域。
㈤ 有关信息安全和密码学
密码学是信息安全的基石,没有密码学就没有信息安全,我是信息安全专业的,对这个感触比较深。。。。。。
㈥ 信息安全专业有哪些特色课程
作为信息安全的一名学子。
我来谈谈我了解到的信息安全。
作为我们院的小萌新,我目前接触到的专业课是信息安全导论,信息安全心理学,JAVA,C语言,数(nan)据(de)结(yi)构(pi)。
剩下的都是基础课,比如:高数,线代,大物,英语,思政,历史(谁说理科生不用学文科!)
听起来好像很多,很难但是当你学了之后,你就会发现(真的很难)!!!
㈦ 武汉大学理工计算机系都有什么课
更多情况,可去“http://cs.whu.e.cn/cs2011/index.php”武汉大学理工计算机学院网站了解。
还望能采纳我的解答。O(∩_∩)O~
一、计算机科学与技术专业
本专业主要从事计算机软件、硬件、网络与通信、算法理论的研究,并学习和探讨这些领域的开发、应用的关键技术,是信息技术领域的关键学科。旨在培养德智体美全面发展,具有良好的科学素养和文化修养,系统地掌握本专业的基础理论、基本方法和基本技能,受过科学研究与实际应用的初步训练、具有一定的创新能力、能够从事计算机软件、硬件、网络与通信、应用技术等领域的研究、应用、开发、管理等方面的专门人才。
主要专业课程:电路与电子技术、数字逻辑、计算机组成原理、微机系统与接口技术、计算机系统结构、计算机网络与通信原理、嵌入式系统、大规模集成电路应用与设计、计算机外部设备、离散数学、数据结构、高级语言程序设计、面向对象程序设计、网络程序设计、算法设计与分析、操作系统原理、数据库原理、数据库系统实现、编译原理、软件工程、软件计划与管理、面向对象软件工程、多媒体技术、电子商务技术、计算机控制技术等。
毕业生可在国民经济各行业、计算机及相关应用领域从事计算机软件和硬件系统的研究设计、应用开发、教学和管理等工作。
二、信息安全专业
信息安全学科是综合计算机、电子、通信、数学、物理、生物、管理、法律和教育等学科发展演绎而形成的交叉学科。信息安全专业是以学习信息安全理论与技术为主,兼学通信技术,同时加强数学和物理基础。要求学生在信息安全理论基础和实际能力两个方面都得到培养提高;能熟练掌握一门外国语,阅读本专业的外文资料。本专业旨在培养能够从事计算机、通信、电子信息、电子商务技术、电子金融、电子政务、军事等领域的信息安全研究、应用、开发、管理等方面的高级技术人才。
主要专业课程:电路与电子技术、数字逻辑、信息安全数学基础、密码学、软件安全、操作系统及安全、信息系统安全、信息隐藏技术、信息内容安全、数据库系统安全、电子商务与电子政务安全、密码学课程设计、软件安全实验、网络安全、电磁防护与物理安全等。
毕业生可在国防、公安、通信、电子、金融、政府机关、高新技术公司、高等学校和科研院所从事信息安全的研究设计、应用开发、教学和管理等方面的工作。
三、仿真科学与技术专业
本专业主要从事计算机仿真、系统建模方法、数据分析理论与方法、模型效验理论与应用、虚拟现实、计算机仿真软件、通用仿真计算机、3D数据处理、计算机控制等方面的研究,并学习和探讨这些领域的开发、应用的关键技术。本专业显著特点是多学科交叉、知识更新快、社会需求量大。
本科毕业生应具有良好的科学素质,系统掌握本专业的基本理论、基本知识和基本技能;受到良好的科学思维和科学实验的基本训练;对计算机仿真的相关技术具有应用能力和初步设计能力;对计算机仿真及相关学科的新发展及应用前景有所了解;掌握系统科学研究的一般方法;熟练应用各种建模工具和实时3D数据引擎;能熟练掌握一门外国语,能阅读本专业的外文资料;毕业生具有一定的研究、应用、开发、管理及分析、解决一般实际问题的能力。
主要专业课程:计算机仿真导论、图论、计算机仿真数理基础、系统建模与仿真、离散事件系统仿真、视景仿真技术与应用、实时仿真技术、计算机仿真软件、仿真建模平台、计算机体系结构等。
毕业生可在基础电信运营企业、汽车工业、石油企业、生物工程、经济、电子商务和管理科学、航空、航天、军事部门、高等学校和科研院所从事计算机仿真方面的研究设计、应用开发、教学和管理等方面的工作。
四、物联网工程专业
本专业主要从事信息感知,异构网络互联、融合与数据传输,计算机智能控制,物联网软件设计,物联网应用技术等方面的研究,并学习和探讨这些领域的开发、应用的关键技术。本专业显著特点是多学科交叉、关联领域广、知识更新快、社会需求量大。本科毕业生应具有良好的科学素质,系统掌握本专业的基本理论、基本知识和基本技能;受到良好的科学思维和科学实验的基本训练;对物联网的相关技术具有应用能力和初步设计能力;对物联网及相关学科的新发展及应用前景有所了解;熟练应用各种感知与识别设备、物联网建网技术及数据处理技术;能熟练掌握一门外国语,能阅读本专业的外文资料;毕业生具有一定的研究、应用、开发、管理及分析、解决一般实际问题的能力。
本专业旨在培养德智体全面发展,具有良好的科学素养和文化修养,系统地掌握本专业的基础理论、基本方法和基本技能,受过科学研究与实际应用的初步训练、具有一定的创新能力,能够在物联网领域从事科学研究、工程设计、应用开发、运营管理等方面的高级复合型人才。
主要专业课程:物联网导论、C++程序设计、数据结构、计算机网络、无线通信、数据库原理、无线传感器原理与设计、RFID原理与设计、物联网软件设计、物载信息获取与识别、无线传感器网络、物联网体系结构、异构网络互联与融合、物联网中间件设计等。
毕业生可在交通、安防、物流、医疗、电网、新能源、信息安全、石油矿产等领域就业。
㈧ 求密码学课程设计 MD5的实现 源代码 高分
我有C语言的实现代码。
你把下面的代码复制下来,保存成md5lib.h,然后在C代码中:
#include "md5lib.h" 即可
其中:
char* MDString (char *string);是对字符串进行MD5
char* MDFile (char *filename);是对文件进行MD5
以下是代码
//--------------------------------
/* MD5lib.h - md5 library
*/
/* Copyright (C) 1990-2, RSA Data Security, Inc. Created 1990. All
rights reserved.
RSA Data Security, Inc. makes no representations concerning either
the merchantability of this software or the suitability of this
software for any particular purpose. It is provided "as is"
without express or implied warranty of any kind.
These notices must be retained in any copies of any part of this
documentation and/or software.
*/
/* The following makes MD default to MD5 if it has not already been
defined with C compiler flags.
*/
#include <stdio.h>
#include <time.h>
#include <string.h>
#define MD 5
/* GLOBAL.H - RSAREF types and constants
*/
/* PROTOTYPES should be set to one if and only if the compiler supports
function argument prototyping.
The following makes PROTOTYPES default to 0 if it has not already
been defined with C compiler flags.
*/
#ifndef PROTOTYPES
#define PROTOTYPES 0
#endif
/* POINTER defines a generic pointer type */
typedef unsigned char *POINTER;
/* UINT2 defines a two byte word */
typedef unsigned short int UINT2;
/* UINT4 defines a four byte word */
typedef unsigned long int UINT4;
/* PROTO_LIST is defined depending on how PROTOTYPES is defined above.
If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it
returns an empty list.
*/
#if PROTOTYPES
#define PROTO_LIST(list) list
#else
#define PROTO_LIST(list) ()
#endif
/* Length of test block, number of test blocks.
*/
#define TEST_BLOCK_LEN 1000
#define TEST_BLOCK_COUNT 1000
/* Constants for MD5Transform routine.
*/
#define S11 7
#define S12 12
#define S13 17
#define S14 22
#define S21 5
#define S22 9
#define S23 14
#define S24 20
#define S31 4
#define S32 11
#define S33 16
#define S34 23
#define S41 6
#define S42 10
#define S43 15
#define S44 21
char* MDString PROTO_LIST ((char *));
char* MDFile PROTO_LIST ((char *));
char* hmac_md5(char* text, char* key);
typedef struct {
UINT4 state[4]; /* state (ABCD) */
UINT4 count[2]; /* number of bits, molo 2^64 (lsb first) */
unsigned char buffer[64]; /* input buffer */
} MD5_CTX;
/*void MD5Init PROTO_LIST ((MD5_CTX *));
void MD5Update PROTO_LIST
((MD5_CTX *, unsigned char *, unsigned int));
void MD5Final PROTO_LIST ((unsigned char [16], MD5_CT X *));
static void MD5Transform PROTO_LIST ((UINT4 [4], unsigned char [64]));
static void Encode PROTO_LIST
((unsigned char *, UINT4 *, unsigned int));
static void Decode PROTO_LIST
((UINT4 *, unsigned char *, unsigned int));
static void MD5_memcpy PROTO_LIST ((POINTER, POINTER, unsigned int));
static void MD5_memset PROTO_LIST ((POINTER, int, unsigned int));
*/
static unsigned char PADDING[64] = {
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
/* F, G, H and I are basic MD5 functions.
*/
#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
#define H(x, y, z) ((x) ^ (y) ^ (z))
#define I(x, y, z) ((y) ^ ((x) | (~z)))
/* ROTATE_LEFT rotates x left n bits.
*/
#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4.
Rotation is separate from addition to prevent recomputation.
*/
#define FF(a, b, c, d, x, s, ac) {(a) += F ((b), (c), (d)) + (x) + (UINT4)(ac); (a) = ROTATE_LEFT ((a), (s)); (a) += (b);}
#define GG(a, b, c, d, x, s, ac) {(a) += G ((b), (c), (d)) + (x) + (UINT4)(ac); (a) = ROTATE_LEFT ((a), (s)); (a) += (b);}
#define HH(a, b, c, d, x, s, ac) {(a) += H ((b), (c), (d)) + (x) + (UINT4)(ac); (a) = ROTATE_LEFT ((a), (s)); (a) += (b);}
#define II(a, b, c, d, x, s, ac) {(a) += I ((b), (c), (d)) + (x) + (UINT4)(ac); (a) = ROTATE_LEFT ((a), (s)); (a) += (b);}
void MD5Init (MD5_CTX *context);
void MD5Update(MD5_CTX *context, unsigned char *input,unsigned int inputLen);
void MD5Final (unsigned char digest[16], MD5_CTX *context);
static void MD5Transform (UINT4 [4], unsigned char [64]) ;
static void Encode(unsigned char *, UINT4 *, unsigned int);
static void Decode (UINT4 *, unsigned char *, unsigned int);
static void MD5_memcpy(POINTER, POINTER, unsigned int);
static void MD5_memset(POINTER, int, unsigned int);
/* MD5 initialization. Begins an MD5 operation, writing a new context.
*/
void MD5Init (MD5_CTX *context)
/* context */
{
context->count[0] = context->count[1] = 0;
/* Load magic initialization constants.
*/
context->state[0] = 0x67452301;
context->state[1] = 0xefcdab89;
context->state[2] = 0x98badcfe;
context->state[3] = 0x10325476;
}
/* MD5 block update operation. Continues an MD5 message-digest
operation, processing another message block, and updating the
context.
*/
void MD5Update (MD5_CTX *context, unsigned char *input,unsigned int inputLen )
/* context */
/* input block */
/* length of input block */
{
unsigned int i, index, partLen;
/* Compute number of bytes mod 64 */
index = (unsigned int)((context->count[0] >> 3) & 0x3F);
/* Update number of bits */
if ((context->count[0] += ((UINT4)inputLen << 3))
< ((UINT4)inputLen << 3))
context->count[1]++;
context->count[1] += ((UINT4)inputLen >> 29);
partLen = 64 - index;
/* Transform as many times as possible.
*/
if (inputLen >= partLen) {
MD5_memcpy
((POINTER)&context->buffer[index], (POINTER)input, partLen);
MD5Transform (context->state, context->buffer);
for (i = partLen; i + 63 < inputLen; i += 64)
MD5Transform (context->state, &input[i]);
index = 0;
}
else
i = 0;
/* Buffer remaining input */
MD5_memcpy
((POINTER)&context->buffer[index], (POINTER)&input[i],
inputLen-i);
}
/* MD5 finalization. Ends an MD5 message-digest operation, writing the
the message digest and zeroizing the context.
*/
void MD5Final (unsigned char digest[16], MD5_CTX *context)
/* message digest */
/* context */
{
unsigned char bits[8];
unsigned int index, padLen;
/* Save number of bits */
Encode (bits, context->count, 8);
/* Pad out to 56 mod 64.
*/
index = (unsigned int)((context->count[0] >> 3) & 0x3f);
padLen = (index < 56) ? (56 - index) : (120 - index);
MD5Update (context,(unsigned char*) PADDING, padLen);
/* Append length (before padding) */
MD5Update (context, bits, 8);
/* Store state in digest */
Encode (digest, context->state, 16);
/* Zeroize sensitive information.
*/
MD5_memset ((POINTER)context, 0, sizeof (*context));
}
/* MD5 basic transformation. Transforms state based on block.
*/
static void MD5Transform (UINT4 state[4],
unsigned char block[64])
{
int i=0;
UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16];
Decode (x, block, 64);
/* Round 1 */
FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */
FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */
FF (c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */
FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */
FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */
FF (d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */
FF (c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */
FF (b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */
FF (a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */
FF (d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */
FF (c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */
FF (b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */
FF (a, b, c, d, x[12], S11, 0x6b901122); /* 13 */
FF (d, a, b, c, x[13], S12, 0xfd987193); /* 14 */
FF (c, d, a, b, x[14], S13, 0xa679438e); /* 15 */
FF (b, c, d, a, x[15], S14, 0x49b40821); /* 16 */
/* Round 2 */
GG (a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */
GG (d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */
GG (c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */
GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */
GG (a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */
GG (d, a, b, c, x[10], S22, 0x2441453); /* 22 */
GG (c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */
GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */
GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */
GG (d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */
GG (c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */
GG (b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */
GG (a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */
GG (d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */
GG (c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */
GG (b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */
/* Round 3 */
HH (a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */
HH (d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */
HH (c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */
HH (b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */
HH (a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */
HH (d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */
HH (c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */
HH (b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */
HH (a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */
HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */
HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */
HH (b, c, d, a, x[ 6], S34, 0x4881d05); /* 44 */
HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */
HH (d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */
HH (c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */
HH (b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */
/* Round 4 */
II (a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */
II (d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */
II (c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */
II (b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */
II (a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */
II (d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */
II (c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */
II (b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */
II (a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */
II (d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */
II (c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */
II (b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */
II (a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */
II (d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */
II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */
II (b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */
state[0] += a;
state[1] += b;
state[2] += c;
state[3] += d;
/* Zeroize sensitive information.
*/
MD5_memset ((POINTER)x, 0, sizeof (x));
}
/* Encodes input (UINT4) into output (unsigned char). Assumes len is
a multiple of 4.
*/
static void Encode (unsigned char *output,
UINT4 *input,
unsigned int len)
{
unsigned int i, j;
for (i = 0, j = 0; j < len; i++, j += 4) {
output[j] = (unsigned char)(input[i] & 0xff);
output[j+1] = (unsigned char)((input[i] >> 8) & 0xff);
output[j+2] = (unsigned char)((input[i] >> 16) & 0xff);
output[j+3] = (unsigned char)((input[i] >> 24) & 0xff);
}
}
/* Decodes input (unsigned char) into output (UINT4). Assumes len is
a multiple of 4.
*/
static void Decode (UINT4 *output,
unsigned char *input,
unsigned int len)
{
unsigned int i, j;
for (i = 0, j = 0; j < len; i++, j += 4)
output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) |
(((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24);
}
/* Note: Replace "for loop" with standard memcpy if possible.
*/
static void MD5_memcpy (POINTER output,
POINTER input,
unsigned int len)
{
unsigned int i;
for (i = 0; i < len; i++)
output[i] = input[i];
}
/* Note: Replace "for loop" with standard memset if possible.
*/
static void MD5_memset (POINTER output,
int value,
unsigned int len)
{
unsigned int i;
for (i = 0; i < len; i++)
((char *)output)[i] = (char)value;
}
/* Digests a string and prints the result.
*/
char* MDString (char *string)
{
MD5_CTX context;
unsigned char digest[16];
char output1[32];
static char output[33]={""};
unsigned int len = strlen (string);
int i;
MD5Init (&context);
MD5Update (&context, (unsigned char*)string, len);
MD5Final (digest, &context);
for (i = 0; i < 16; i++)
{sprintf(&(output1[2*i]),"%02x",(unsigned char)digest[i]);
sprintf(&(output1[2*i+1]),"%02x",(unsigned char)(digest[i]<<4));
}
for(i=0;i<32;i++)
output[i]=output1[i];
return output;
}
/* Digests a file and prints the result.
*/
char* MDFile (char *filename)
{ static char output[33]={""};
FILE *file;
MD5_CTX context;
int len;
unsigned char buffer[1024], digest[16];
int i;
char output1[32];
if ((file = fopen (filename, "rb")) == NULL)
{ printf ("%s can't be openedn", filename);
return 0;
}
else {
MD5Init (&context);
while (len = fread (buffer, 1, 1024, file))
MD5Update (&context, buffer, len);
MD5Final (digest, &context);
fclose (file);
for (i = 0; i < 16; i++)
{sprintf(&(output1[2*i]),"%02x",(unsigned char)digest[i]);
sprintf(&(output1[2*i+1]),"%02x",(unsigned char)(digest[i]<<4));
}
for(i=0;i<32;i++)
output[i]=output1[i];
return output;
}
}
char* hmac_md5(char* text,char* key)
{
char digest[16];
char output1[32];
static char output[33]={""};
MD5_CTX context;
unsigned char k_ipad[65]; /* inner padding -
* key XORd with ipad
*/
unsigned char k_opad[65]; /* outer padding -
* key XORd with opad
*/
unsigned char tk[16];
int i;
int text_len = strlen (text);
int key_len=strlen(key);
/* if key is longer than 64 bytes reset it to key=MD5(key) */
if (key_len > 64) {
MD5_CTX tctx;
MD5Init(&tctx);
MD5Update(&tctx,(unsigned char*) key, key_len);
MD5Final(tk, &tctx);
key = (char*)tk;
key_len = 16;
}
/*
* the HMAC_MD5 transform looks like:
*
* MD5(K XOR opad, MD5(K XOR ipad, text))
*
* where K is an n byte key
* ipad is the byte 0x36 repeated 64 times
* opad is the byte 0x5c repeated 64 times
* and text is the data being protected
*/
/* start out by storing key in pads */
/*bzero( k_ipad, sizeof k_ipad);
bzero( k_opad, sizeof k_opad);
*/
for(i=0;i<65;i++)
k_ipad[i]=(unsigned char)0;
for(i=0;i<65;i++)
k_opad[i]=(unsigned char)0;
/*b( key, k_ipad, key_len);
b( key, k_opad, key_len);
*/
for(i=0;i<key_len;i++)
{k_ipad[i]=(unsigned char)key[i];
k_opad[i]=(unsigned char)key[i];
}
/* XOR key with ipad and opad values */
for (i=0; i<64; i++) {
k_ipad[i] ^= 0x36;
k_opad[i] ^= 0x5c;
}
/*
* perform inner MD5
*/
MD5Init(&context); /* init context for 1st
* pass */
MD5Update(&context, k_ipad, 64); /* start with inner pad */
MD5Update(&context, (unsigned char*)text, text_len); /* then text of datagram
*/
MD5Final((unsigned char*)digest, &context); /* finish up 1st pass */
/*
* perform outer MD5
*/
MD5Init(&context); /* init context for 2nd
* pass */
MD5Update(&context, k_opad, 64); /* start with outer pad */
MD5Update(&context,(unsigned char*) digest, 16); /* then results of 1st
* hash */
MD5Final((unsigned char*)digest, &context); /* finish up 2nd pass */
for (i = 0; i < 16; i++)
{sprintf(&(output1[2*i]),"%02x",(unsigned char)digest[i]);
sprintf(&(output1[2*i+1]),"%02x",(unsigned char)(digest[i]<<4));
}
for(i=0;i<32;i++)
output[i]=output1[i];
return output;
}
㈨ 密码学课程设计啊。大整数的设计和实现,求大神。发邮箱[email protected] 能通过的话继续加分
“一般的语言不支持。”是什么意思?
你说的大整数512、1024、2048这些integer类型就支持啊。
㈩ 学信息安全网络安全一定要学习密码学吗
是要学的,信息与网络安全是建立在密码学与网络基础之上的,密码学的发展比网络的发展来得早,密码学在二战时期发展很迅速,复杂度大幅度的提高,网络安全的维护需要使用到密码学知识,你自己应该也有体会,现在想要执行一个程序都要密码,例如:登qq要密码,银行取钱要密码才能取,应该说网络安全是信息安全的一个领域,网络安全把密码学充分利用起来了.所以你还是好好学吧,密码学都是有数学知识转化过来的,运算量可能很大,从小到大一直在学数学.密码学也就不难学,就是需要多点耐心~~~