Ejemplo n.º 1
0
	def testBinasciiCRC_2(self):
		'''
		testo il metodo crc32
		test 2 http://www.febooti.com/products/filetweak/members/hash-and-crc/test-vectors/
		'''
		mexStr = "Test vector from febooti.com"
		crc32 = binascii.crc32(mexStr)
		resultStr = wep.tupleToString((0x0c,0x87,0x7f,0x61))
		expectedResult = struct.unpack('>I',resultStr)[0]
		self.assertEqual(crc32,expectedResult) 
Ejemplo n.º 2
0
	def testCrc32_3(self):
		'''
		testo il metodo crc32 + il passaggio da tupla a stringa	
		'''
		mexTuple = (0xaa,0xaa,0x03,0x00,0x00,0x00,0x08,0x00,0x45,0x00,0x00,0x4e,0x66,0x1a,0x00,0x00,0x80,0x11,0xbe,0x64,0x0a,0x00,0x01,0x22,0x0a,0xff,0xff,0xff,0x00,0x89,0x00,0x89,0x00,0x3a,0x00,0x00,0x80,0xa6,0x01,0x10,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x45,0x43,0x45,0x4a,0x45,0x48,0x45,0x43,0x46,0x43,0x45,0x50,0x46,0x45,0x45,0x49,0x45,0x46,0x46,0x43,0x43,0x41,0x43,0x41,0x43,0x41,0x43,0x41,0x43,0x41,0x41,0x41,0x00,0x00,0x20,0x00,0x01)

		crc32 = wep.crc32Value(mexTuple)
		resultStr = wep.tupleToString((0x1b,0xd0,0xb6,0x04))
		expectedResult = struct.unpack('I',resultStr)[0]
	
		self.assertEqual(crc32,expectedResult) 	
Ejemplo n.º 3
0
	def testCrc32_2(self):
		'''
		testo il metodo crc32 + il passaggio da tupla a stringa
		test 2 http://www.febooti.com/products/filetweak/members/hash-and-crc/test-vectors/
		'''
		mexStr = "Test vector from febooti.com"
		mexTuple = struct.unpack('28B',mexStr)

		crc32 = wep.crc32Value(mexTuple)
		resultStr = wep.tupleToString((0x0c,0x87,0x7f,0x61))
		expectedResult = struct.unpack('>I',resultStr)[0]

		self.assertEqual(crc32,expectedResult)