MD5, SHA1 and SHA256 don't work on some MOV files

Advanced Renamer forum
#1 : 27/07-21 19:48
Axel Mertes
Posts: 8
Hi Kim, David,

I am using Advanced Renamer 3.87, Windows 10 x64...

I am trying to write a script to sort photos and videos to uniquie but standardized folders and names as follows:

YYYY // YYYY-MM-YY // YYYY-MM-DD hh-mm-ss Country State City CamerMake CameraModel MD5[...hash...].EXT

The idea is to clean up doublets this way. All works pretty fine, but some MOV files have problems creating a MD5, SHA1 or SHA256 hash checksum.

I do get a "Ungültiger tag" error, which translates to "invalid tag" error.

// Add MD5 hash code to fileName
if ( app.parseTags( '<MD5>' ) ) {
// if ( item.md5Exists == true ) {
fileName = fileName + " MD5[" + app.parseTags( '<MD5>' ) + "]";
}

Unfortunately the error handling does not work at this point and I really don't see ANY reason why a file should not have a hash checksum at all?

I also tried using item.md5 but it seems to end in an error too.

I also tried adding the MD5, SHA1 and SHA256 tags using the GUI only, but the result is identical.

Is that a bug?
Any idea how to work around this?

Cheers
Axel


edited: 27/07-21 21:20
#2 : 27/07-21 20:20
David Lee
Posts: 1125
Hi Axel,
Just to be clear: Kim is the developer - I'm just an ordinary user who happens to enjoy solving other people's puzzles. It's a great way to polish up my JavaScript and regular expression skills!
#3 : 27/07-21 21:22
Axel Mertes
Posts: 8
Reply to #2:

David,

ok, thanks, good to know. You are VERY WELCOME in this case.

You seem to be a deep resource here in the forum!

Back to the topic, any idea on your side what is going on here?

Cheers,
Axel
#4 : 28/07-21 16:56
David Lee
Posts: 1125
Reply to #3:
I can't comment on the problem in ARen. However PowerShell has a utility for generating checksums - Get-FileHash so it would be worth trying this on one of your problem files to see whether it is a more general issue.

See: https://docs.microsoft.com/en-us/powershell/modu le/microsoft.powershell.utility/get-file hash

Simply type 'Get-FileHash into a PowerShell window and drag in a file to enter the full path. By default it will return a SHA256 hash but you can change the algorithm by appending "-Algorithm <type>".

eg Get-FileHash C:\path\filename -Algorithm MD5
#5 : 28/07-21 19:11
Axel Mertes
Posts: 8
Reply to #4:

Hi David,

I'll give it a try and will get back here soon.
Thanks for the idea.

Cheers
Axel
#6 : 29/07-21 01:25
Axel Mertes
Posts: 8
Reply to #5:
Apparently the creation of the MD5 hash is possible without any issue on these files, see here:

PS C:\Users\Admin> Get-FileHash D:\Fotos\BatchMethods\TEST\Schattensprung.mov -Algorithm MD5

Algorithm Hash Path
--------- ---- ----
MD5 A0AB6F201412DDD06E6355EDB89114F1 D:\Fotos\BatchMethods\TEST\Sc...



It would not make sense for a hash function to fail on any file.

So this must be a bug.

At first I thought it may be a limitation in size, not to bulk process thousands of GBytes, which could freeze ARen quite a bit. But some MOVs of larger size work, while smaller ones don't.

Kim, any idea?
Do you need a sample file to track this down?

Cheers
Axel

edited: 21/01-22 04:38
#7 : 29/07-21 18:52
Axel Mertes
Posts: 8
Reply to #6:
Hi Kim,

In the meantime I found other files like .CR2 that don't work for hashing inside ARen.
I'd be happy to provide sample files if needed.

Please let me know.

Cheers
Axel
#8 : 14/08-21 23:45
Axel Mertes
Posts: 8
Has anyone an idea if I can run a DOS or PowerShell command within a script?
I might use external and working hash creation tools instead and revert back to the results I can get from these. But I am unsure if I can do this from within the script itself.

I want to skip any two-step renaming processes. The goal is to make ONE script that does the job of rename and moving files into a folder structure.

By using at least parts of hash codes within the names, I want to find doublets and filter them out.

Any help would be highly appreciated.