【正文】
驗(yàn)的角度直觀理解,具體到一次密鑰生成的運(yùn)算,所需要的時(shí)間是很不確定的,比如,一次 512 位的密鑰生成,需要的時(shí)間完全可能比一次256 位的密鑰生成時(shí)間短,由于素?cái)?shù)分布規(guī)律非常奧妙,加上測(cè)試運(yùn)算需要的時(shí)間頗長(zhǎng),這里很難給出對(duì)于一個(gè)具體位數(shù)的密鑰生成所需時(shí)間的統(tǒng)計(jì)模型。對(duì)于 100 字節(jié)的文件來(lái)說(shuō), 1024bit 的公鑰加密比 512bit 的耗時(shí)多 倍左右; 1024bit 的私鑰解密比 512bit 的耗時(shí)多 以上。 性能分析與改進(jìn)優(yōu)化 經(jīng)過(guò)一系列的 RSA 密鑰生成、文件輸入輸出和蒙哥馬利加密解密測(cè)試,做簡(jiǎn)要的性能分析如下。 ① 在要對(duì)文件進(jìn)行加密解密的時(shí)候,先將文件按一定的數(shù)據(jù)結(jié)構(gòu)讀入內(nèi)存,然后進(jìn)行加密或解密操作。 由于開發(fā)時(shí)間 倉(cāng)促等因素,在書寫本文時(shí),軟件并未完成全面細(xì)致的優(yōu)化。 本文是在吳震老師的熱情關(guān)心和指導(dǎo)下完成的,他淵博的知識(shí)和嚴(yán)謹(jǐn)?shù)闹螌W(xué)作風(fēng)使我受益匪淺,對(duì)順利完成本課題起到了極大的作用。 m_TM+= 毫秒 。 strset(data,0)。 3. 加密解密測(cè)試時(shí)使用的兩組密鑰 512 位: 3C54793AA7186DEFFD54A9352E929F5A6A78034F2133D367965467322585D2B2537DED86DAB9A6A0E162A2B80A377CCDE790F221D15C917F9F821BDCBF71D045 34F7A974006EA75F1418F77274D0504E2EB9ED95D4BDCEB6DCBA7FDBFC2BB11EC3315F0177DD500463E2F44535324BDF3CC25053E5BF38F74570A9A8A2CBF4A5 1024 位: B3839FCFB21E7B916B62C20B79075C549BD558465F66C9BC5682DCFDE7818C1504D0D14AECEF1B1254C54CE36D7737EB34248E5F62B0FC4E34DA7C54AAC50CECBC9F3BF5C8C40503E4DD67A6744E0E022B995128D3F8EB9DBCB9E8EF1A5CF48B9D3D601D25850307BFE0AA83E6CDBB4FA765BB0FE7880908A3B48A2956F12FA5 25DF04DE0A53C7F9DBCFCFE41FBA5FCE31BA068F821CEB3E6279E52963A7BEE7C8464D81230F2684ED815A41389CC81D44B8D99861F7B8A2BF1FC0CF13DFD263DBF146D654370D17869452FD010E2A63F21EBF7C5FCC8F77DD2807977F1B6ACF447A7277B76D13819494EB6A892B0F7745D6215E5F08AB9D114749276AF51D19 算法可行性的證明 求證: 命題 11 若 p, q 是相異素?cái)?shù) , e d = 1 mod (p1) (q1), a 是任意一個(gè)正整數(shù) , )m o d (),m o d ( qpbcqpab de ???? 則有 c = a mod (p q) 證明: ∵ d e = 1 mod (p1) (q1) ∴ d e = k (p1) (q1) + 1, 其中 k 是整數(shù) ∵ 在 mod 中是 preserve 乘法的 (x = y mod z and u = v mod z x u = y v mod z), ∴ )m o d ()( )1)1()1(()( qpaaabc qpkedded ????? ?????? 首先,素?cái)?shù) p、 q要么能整除 a,要么與 a 互素。 (2) 學(xué)??梢圆捎糜坝?、縮印或其他復(fù)制方式保存學(xué)位論文。t believe that part. Well, anyway, my docent said you wouldn39。t you tell me there was blood involved, Mother? I had, but I felt it wiser to keep silent. And you didn39。s height, since she like a big, soft asteroid. The analogy pleased her. Extending it, she watched the terminator line crawl around her to bring the hills and valleys of her front into sunlight. Cirocco liked space, reading, and sex, not necessarily in that order. She had never been able to satisfactorily bine all three, but two was not bad. New games were possible in freefall, like the one they had been playing, no hands. T hey could use feet, mouths, knees, or shoulders to position each other . One had to be gentle and careful, but with slow bites and nips anything could be done, and in such an interesting way. All of them came to the hydroponics room from time to time. Ringmaster had seven private rooms, and they were as necessary as oxygen. But even Cirocco39。d still get to name it. Discovering a et or an asteroid is one thing but only a couple people each century ge t to name a moon. Cirocco released her toehold on the holo tank strut and twisted toward the corridor entr The gunner fired the second harpoon. The whale gave a convulsive shudder. His life was nearly over. A life that had begun thirty years ago as a tiny calf in the s parkling Indian Ocean. At the age of f ive he had left his mother and joined other young males in a bachelor group. When his blubber thickened, he migrated to colder waters where food was more plentiful. At 25 he became master of a pod of twelve cows which remained with their calves in tropical seas. Although he was dwarfed by the hundredfoot blue whale, could not sing like the sweetvoiced humpback whaleboth of which fed on planktonhis sort were the largest of the toothed whales, the same majestic breed as Moby Dick. Each year he made the long journey back from the Antarctic to mate. But not this year. For three decades, the bull had eluded harpoons. Now he died, spouting thick blood. The gunner nodded w ith satisfaction. Soon the vast corpse was w inched alongside. Then, swinging slowly, the catcher boat chugged towards the factory ship whose stern gaped open like a mouth to swallow the whale. Once inside, it was hauled up a ramp. The whale was efficiently disposed of. Its domed head yielded fifteen barrels of spermaceti oil for use in cosmetics。t poisoned by swallowing oil after preening, they would probably die of pneumonia. Singly or in small groups the bedraggled creatures stumbled to land. A threefoot gan, normally brilliant white, pecked feverishl。 its belly, ambergris (the residue of squids39。Why don39。t seem to care about sex at all, and Cirocco had been irresistibly drawn to Calvin Greene. Her persistence was such that Calvin eventually went to bed with her, not just once, but three times. It didn39。What are cramps?39。 (4) 學(xué)??稍试S學(xué)位論文被查閱或借閱。 命題 11 說(shuō)明 a 經(jīng)過(guò)編碼為 b 再經(jīng)過(guò)解碼為 c 時(shí) , a = c mod n (n = p q),但在做編碼解碼時(shí) , 由于限制 0 = a n, 0 = c n, 此時(shí)顯然 a = c, 所以這個(gè)過(guò)程能做到編碼解碼的功能。 fileRead(data, flen)。 CFile *file。 for(int j=1。而要實(shí)現(xiàn)較為快速的RSA 文件加密系統(tǒng),對(duì)冪模運(yùn)算的優(yōu)化是核心,只要充分利用蒙哥馬利冪模運(yùn)算原理,對(duì) RSA 加密算法進(jìn)行適當(dāng)?shù)母倪M(jìn), RSA文件加密將通過(guò)瓶頸,在小型文件加密上有著巨大的發(fā)展空間。 ② 在對(duì)加密或解密完成的數(shù)據(jù)進(jìn)行寫出的時(shí)候,都是將其直接寫到指定好的文件,即直接寫入磁盤。其中,冪模運(yùn)算和尋找素?cái)?shù)對(duì)時(shí)間的消耗最大,在核心優(yōu)化時(shí)應(yīng)優(yōu)先考慮。對(duì)于一定大小的文件,使用 512bit 的密鑰,私有密鑰解密需要的時(shí)間是公開密鑰加密需要時(shí)間的 3倍左右;而如果使用 1024bit 的密鑰,私有密鑰解密需要的時(shí)間是公開密鑰加密需要時(shí)間的 倍以上。這里給出幾組不同角度進(jìn)行測(cè) 試的數(shù)據(jù)。測(cè)試 PC 配置為 CPU 奔騰 4 845 UltraAD 芯片組,下文測(cè)試中,未說(shuō)明 PC 配置的也都在同一 PC 完成,不再重復(fù)。 表 21: RSA加密算法的 C++類庫(kù)中的類 CBigInt 主要包含大數(shù)四則運(yùn)算,素?cái)?shù)生成,檢測(cè),密鑰生成,存儲(chǔ), RSA 核心算法等。類中各成員頻繁的用到字符串和 vlong 類型的轉(zhuǎn)換,因?yàn)榇髷?shù)是用字符串置入的,而把大數(shù)讀出,也是保存在字符指針指向的一段內(nèi)存空間里,所以也是字符串。用來(lái)完成這種算法。 開始 利用 Bits 初始化 m_ulValue[i] m_ulValue[i]=rand()*0x10000+rand()。 } } 接下來(lái),對(duì)可能為素?cái)?shù)的數(shù)用拉賓米勒算法進(jìn)行測(cè)試,測(cè)試通過(guò),程序就判定這個(gè)數(shù)為找到的素?cái)?shù),將找到的素?cái)?shù)返回給上層程序使用。 for(i=0。 } m_ulValue[0]=m_ulValue[0]1。im_nLength。 經(jīng)過(guò) 和 小節(jié),所有的大數(shù)運(yùn)算功能都準(zhǔn)備完畢,在此基礎(chǔ)上,本工程將尋找素?cái)?shù)的功能置于類 CBigint 之中。 //A=A1,X=(X*N) MOD B ((Y))。 ( 5)此時(shí)的 X即為所求結(jié)果 。為 r在模 m 下的逆元,那么運(yùn)算 mm( a,b,m) =a*b*R39。 如 果 要 計(jì) 算1844674407370955161618446744073709551615,就類似于 10099: 00000001 00000000 00000000