def decrypt(self,scandir,outfile, msgtype, cypherkey='VignereCypher'):	
		""" Decrypts the message stores in the file. It inherits most of its functionality from the parents class. It checks if we are storing an image or a text file. It appends .txt or .tif to the file accordingly. It just returns the message if its a text file. If its an image, grayscale value are appended to the array and image is then saved in the output files. The user also sends the file type, "I" for image and "T" for text.

Examples: a.decrypt("H", outfile, "I"), a.decrypt("V", outfile, "T", "KEY"),

 """	
		embedata = Steganography.decrypt(self, scandir, cypherkey)
		ftype = ""
		for i in range(0, 3):
			ftype = ftype + embedata[i]
		if((ftype == "msg" and msgtype != 'T') or (ftype == "img" and msgtype != 'I')):
			raise ValueError("The type of file that was provided does not match the data embedded")
		if ftype == "msg":
			data = ''
			for i in range(3, len(embedata)):
				data = data + embedata[i]
			if not(re.search(".txt$", outfile)):
				outfile = outfile + ".txt"
			try:
				fh = open(outfile,"w")
				fh.write(data)
				fh.close()
				
			except:
				raise ValueError("Path provided to the output file does not exist.")

		if ftype == "img":
			a = re.search("[(](?P<hor>[\d]+), (?P<ver>[\d]+)[)]", embedata)
			hor = a.group("hor")
			ver = a.group("ver")
			omitstrlen = 4 + 3 + len(hor) + len(ver)
			newstr = ""
			for i in range(omitstrlen, len(embedata)):
				newstr = newstr + embedata[i]
			hor = int(hor)
			ver = int(ver)
			count = 0

			picarray = []
			for x in range(0, hor):
				for y in range(0, ver):
					picarray.append(ord(newstr[count]))		
					count += 1
			im = Image.new('L', (hor,ver))
			im.putdata(picarray)
			if not(re.search(".tif$", outfile)):
				outfile = outfile + ".tif"
			try:
				im.save(outfile)
			except:
				raise ValueError("Path provided to the output file does not exist.")

		return True