⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test_chaffing.py

📁 python的加密库
💻 PY
字号:
## Test script for Crypto.XXX#__revision__ = "$Id: test_chaffing.py,v 1.2 2003/02/28 15:23:59 akuchling Exp $"from sancho.unittest import TestScenario, parse_args, run_scenariosfrom Crypto.Protocol import Chaffingtested_modules = [ "Crypto.Protocol.Chaffing" ]text = """\When in the Course of human events, it becomes necessary for one people todissolve the political bands which have connected them with another, and toassume among the powers of the earth, the separate and equal station to whichthe Laws of Nature and of Nature's God entitle them, a decent respect to theopinions of mankind requires that they should declare the causes which impelthem to the separation.We hold these truths to be self-evident, that all men are created equal, thatthey are endowed by their Creator with certain unalienable Rights, that amongthese are Life, Liberty, and the pursuit of Happiness. That to secure theserights, Governments are instituted among Men, deriving their just powers fromthe consent of the governed. That whenever any Form of Government becomesdestructive of these ends, it is the Right of the People to alter or toabolish it, and to institute new Government, laying its foundation on suchprinciples and organizing its powers in such form, as to them shall seem mostlikely to effect their Safety and Happiness."""class ChaffingTest (TestScenario):    def setup (self):        pass    def shutdown (self):        pass    def check_chaffing (self):        "Simple tests of chaffing and winnowing"        self.test_stmt('Chaffing.Chaff()')        self.test_stmt('Chaffing.Chaff(0.5, 1)')        self.test_exc('Chaffing.Chaff(factor=-1)', ValueError)        self.test_exc('Chaffing.Chaff(blocksper=-1)', ValueError)        data = [(1, 'data1', 'data1'), (2, 'data2', 'data2')]        c = Chaffing.Chaff(1.0, 1)        self.test_stmt('c.chaff(data)')        chaff = c.chaff(data)        self.test_val('len(chaff)', 4)        c = Chaffing.Chaff(0.0, 1)        chaff = c.chaff(data)        self.test_val('len(chaff)', 2)if __name__ == "__main__":    (scenarios, options) = parse_args()    run_scenarios(scenarios, options)

⌨️ 快捷键说明

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