㈠ 高分求高手指導密碼學課程設計 使用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要密碼,銀行取錢要密碼才能取,應該說網路安全是信息安全的一個領域,網路安全把密碼學充分利用起來了.所以你還是好好學吧,密碼學都是有數學知識轉化過來的,運算量可能很大,從小到大一直在學數學.密碼學也就不難學,就是需要多點耐心~~~