【正文】
加密測試 將測試數(shù)據(jù)加密后的數(shù)據(jù)解密后得原測試數(shù)據(jù): tangyang,如圖 所示: 圖 Vigenere 加密法解密測試 Hill 加密算法測試 Hill 加密法的密鑰為 m m 的可逆矩陣。 測試數(shù)據(jù): tangyang 陜西理工學院畢業(yè)設計 第 20 頁 共 45 頁 密鑰: 4 4 可逆矩陣 ?????????????4116109485105965968k 根據(jù)給定測試數(shù)據(jù)得加密后的數(shù)據(jù)為: =$v|eB0O,如圖 所示: 圖 Hill 加密法加密測試 將測試數(shù)據(jù)加密后的數(shù)據(jù)解密后得原測試數(shù)據(jù): tangyang,如圖 所示: 圖 Hill 加密法解密測試 經(jīng)測試,系統(tǒng)已達到設計要求。 陜西理工學院畢業(yè)設計 第 21 頁 共 45 頁 總 結(jié) 針對密碼學教學過程中不能形象展示加密解密這一過程的缺陷,設計實現(xiàn)了一款經(jīng)典加密解密教學演示軟件。研究分析并實現(xiàn)了仿射加密法,多文字加密法, Vigenere 加密法以及 Hill 加密法四種加密法的加 密與解密算法。 在分析研究的基礎上做了一定的改進,其改進主要體現(xiàn)為: 仿射加密算法及 Hill 加密算法中將模 26 改為模 95。由于傳統(tǒng)仿射加密算法及 Hill 加密算法僅對 26 個英文字母進行了加密解密,因此采用模 26 加密解密算法,為了解決這一局限,對常用符號也能進行加密,從而采用 ASCII 碼表作為加密參考,最終采用模 95 實現(xiàn)加密算法(注: ASCII 碼值有 128 個,由于前 33 個為不可顯示字符,因此在加密的過程中排除,故將模改為 95)。 此軟件也存在一些弊端,比如,如果能將所有加密算法 進行 動態(tài)演示 將 會得到更好的教學效果 。 陜西理工學院畢業(yè)設計 第 22 頁 共 45 頁 致 謝 在本次畢業(yè)設計完成論文的過程中,我得到了許多老師和同學的關懷和幫助,使我能夠順利完成畢業(yè)設計和論文 ,在此我向他們表示衷心的感謝! 我的 論文從選題、算法實現(xiàn)到最后畢業(yè)論文的撰寫都得到了李老師的專業(yè)指導和嚴格要求。李老師嚴謹求實的學風、實事求是的工作作風、淵博的專業(yè)知識、敏銳的洞察力以及對專業(yè)孜孜不倦的追求,給我深深的教益和啟迪,是我今后工作和學習的楷模。在此論文完成之際,謹向李老師致以最誠摯的感謝和敬意。 感謝我的同學和朋友們在我課題開發(fā)和論文撰寫的過程中,在技術上都給予了我很大的幫助,感謝我的 老師、同學給了我不懈的支持與鼓勵。 祝愿他們在今后的生活、學習、事業(yè)中,一切順利,勇攀高峰。 陜西理工學院畢業(yè)設計 第 23 頁 共 45 頁 參考文獻 [1] Richard Spillman. 經(jīng)典密碼學與現(xiàn)代密碼學 [M]. 葉阮健 ,曹英 ,張長富譯 . 北京 :清華大學出版社 ,. [2] 邵珠艷 ,岳麗 . 線性代數(shù) [M].北京市 :北京大學出版社 , . [3] 譚浩強 . C程序設計(第三版) [M]. 北京 :清華大學出版社 , 20xx. [4] Stanley Josee Lagole Barbara E. Moo 著 . C++ Primer 中文版 [M].李師賢 ,蔣愛軍 ,梅曉勇 ,林瑛譯 . 人民郵電出版社 . [5] 錢能 . C++程序設計教程 [M]. 北京 :清華大學出版社 , . 陜西理工學院畢業(yè)設計 第 24 頁 共 45 頁 科技外文文獻 3 Classes and objects ObjectiveC is an objectoriented language: it manages classes and objects. ObjectiveC uses astrict ob ject mo del, unlike C++ which has many discrepancies against the ideal object model. Forinstance, in ObjectiveC, classes are objects and can be dynamically managed: it is possible to addclasses at runtime, create instances based on the name of the class, ask a class for its methods,and so on. This is much more powerful than C++ RTTI (cf. section on page 62), which havebeen added to a very “static” language. Discouraging RTTI use is mon since the results maydepend on the piler itself and lack portability. Root class, type id, nil and Nil values In an objectoriented language, each program makes use of a set of classes. Unlike C++, ObjectiveCdefines a root class. Every new class should be a descendant of the root class. In Cocoa, that classis NSObject, and it provides a huge number of facilities for the runtime system. The root classnotion is not specific to ObjectiveC。 it’s related to the object model. Smalltalk and Java makeuse of a root class, while C++ does not.. Strictly speaking, every object should be of type NSObject, and every pointer to an object could be declared as NSObject*. In fact, one can use the type id instead. This is a short and handy way to declare a pointer to any object, and provides dynamic typechecking instead of static typechecking. It is very useful for some weak typing on generic methods. Please note that a null pointer to an object should be set to nil, not NULL. These values are not interchangeable. A normal C pointer can be set to NULL, but nil was introduced in ObjectiveC for pointers to objects. In ObjectiveC, classes are also objects (metaclass instances), and it is possible to declare a pointer to a class. Their null value is Nil. Class declaration It is hard to show with a single example all the differences between ObjectiveC and C++ for classdeclaration and implementation. Syntax and concepts are interleaved and require explanation. Inthe following, the differences are exposed sequentially and specifically. Attributes and methods In ObjectiveC, attributes are called instance data, and member functions are called methods. C++ ObjectiveC class Foo { double x。 public: int f(int x)。 float g(int x, int y)。 }。 int Foo::f(int x) {...} float Foo::g(int x, int y) {...} @interface Foo : NSObject { double x。 } (int) f:(int)x。 (float) g:(int)x :(int)y。 @end @implementation Foo (int) f:(int)x {...} (float) g:(int)x :(int)y {...} @end In C++, attributes and methods are declared together inside the braces of the class. 陜西理工學院畢業(yè)設計 第 25 頁 共 45 頁 Methodimplementation syntax is similar to C, with the addition of the scope resolution operator (Foo :: ). In ObjectiveC, attributes and methods cannot be mixed. The attributes are declared in braces,the methods follow. Their implementation lies in an @implementation block. This is a major difference with C++, since some methods can be implemented without beingexposed in the interface. This is detailed later. Briefly, this is a way to clean up header files byremoving unnecessary declarations (“private” methods, and silently redefined virtual methods likedestructors). Please see Section on page 21 for further explanations. Instance methods are prefixed by the minus symbol “”, and class methods by the plus symbol“+”(cf. section on page 18)。 this symbol has nothing to do with the UML notation andthe meaning public or private. The type of the parameters are enclosed in parenthesis, and theparameters are separated by the symbol “:”. Please see Section on the next page for furtherexplanations on the syntax of prototypes. In ObjectiveC, there is no need for a semicolon at the end of a class declaration. Also notethat the keyword to declare a class is @interface and not @class. The keyword @class is onlyused in forward declarations (cf. section on the current page). Finally, if there is no instancedata in a class, the braces, which would enclose nothing, can be ommitted. Forward declarations: @class, @protocol To avoid cyclic dependencies in header files, the C language supports the forward declaration,that allows the coder to