[Tasker Tips & Tricks] MishaalRahman:
If you're a user who likes to take control of your own device by flashing custom ROMs, kernels, etc then you are likely someone who downloads a lot of files off of sites like AndroidFileHost.com. You will notice that each and every file on hosting sites like this include the MD5 sum for you to compare when you finish downloading it.

It's super important that you compare the MD5 sums before flashing a critical file such as a radio or bootloader, to ensure that you aren't flashing a corrupted file. But it's a nuisance to do so on mobile, because you need to manually find the file in your file explorer app and copy/paste the MD5 sum into a text box in order to compare the sums.

I stopped and thought to myself, why not automate this with Tasker? I looked it up and was surprised to not have found this mentioned anywhere, but it's possible and actually quite easy to do!

Here's a gif of it in action: https://gfycat.com/FlusteredHardtofindAquaticleech

How it works: You copy the md5 sum to your clipboard BEFORE downloading, then when the download finishes you are prompted whether or not you want to compare values. If you press yes, then Tasker will calculate the MD5 sum of the downloaded file and compare it to what's in your clipboard.

Prerequisites

Notification Listener or AutoNotification. I personally use AutoNotification but for the sake of this tutorial I set it up using Notification Listener because it's free to use.

Snackbar Tasker Plugin. Not required (though if you import my profile it uses it) but it beats having to create a scene with buttons. I've set up the tutorial to only use the free features of the app.

Instructions

Create a new profile and name it 'Check MD5 Sums.' For the context, go to Events --> Plugins --> Notification Listener. Select "Posted" and scroll down and pick your browser app. I personally use Chrome Dev so I selected that.

Task --> If. Set it to If %nltext ~ Download complete. (Or whatever sub-text your notification says when your browser app tells you a download has been completed.) This is so the task will trigger when it detects that a download has been completed, as indicated by the browser notification.

Plugins --> Snackbar Tasker Plugin. Select "Bottom Sheet." For the title, make it something like "Check MD5 Sums?", for Items make it "Yes,No" and for commands make it "Y,N".

Task --> If. Set it to If %bs_command ~ Y.

Code --> Run Shell. For the code make it

ls /sdcard/Download

Set it to store result in %files.

(Change whatever is after /sdcard/ to the path of your download folder. /sdcard/Download is the default for most people)

Variables --> Variable Split. Split %files.

Variables --> Array Pop. Pop %files, position 1, and set it to %download.

Code --> Run Shell. For the code make it

md5sum /sdcard/Download/%download

Set it to store result in %md5. Again, change the download directory as needed.

Variables --> Variable Split. Split %md5. Don't set a splitter.

Alert --> Flash. Text: "MD5 Sums Match!" Check If and set it to If %md51 ~ %CLIP.

Alert --> Flash. Text: "MD5 Sums are Mismatched!" Check If and set it to If %md51 !~ %CLIP.

Task --> End If.

Task --> End If.

Here are screenshots of the Task:

EDIT: If you've been having issues with this profile, please see my updated profile in this post for a new XML file you can import: http://xdaforums.com/showpost.php?p=66549048&postcount=18. This one should fix all of the issues you guys have had. Plus it uses better logic now, and will only prompt you if you download a .img or .zip file.