User Command for hashing console programs

English support forum

Moderators: white, Hacker, petermad, Stefan2

Axis
Junior Member
Junior Member
Posts: 88
Joined: 2015-07-14, 18:53 UTC

User Command for hashing console programs

Post by *Axis »

Hi to all.

Since TC10 won't have the new hashing algorithms (XXH3, Blake3) I need, I'm trying to create my own user command (to put in the start menu).

Unfortunately, the hash programs I use do not accept the %L parameter as input, so they hash the temp file (instead of hashing Its content). :mrgreen:

I would like to get a behavior like TC's native hashing, so:

- Select files, folders (with other files inside them), etc., in TC.
- Run the user command that in turn invokes the hashing program to generate the hashing of everything has been selected by the user (exactly as tc does with Its native hashing algorithms like md5, crc32, sha-x, etc.).


Any idea (yep, to me is very difficult. I was hoping for tc10)?


Many thanks.
User avatar
petermad
Power Member
Power Member
Posts: 14796
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: User Command for hashing console programs

Post by *petermad »

If your Hash program supports multiple files/dirs in the command line then you could try and use the %S parameter.
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Axis
Junior Member
Junior Member
Posts: 88
Joined: 2015-07-14, 18:53 UTC

Re: User Command for hashing console programs

Post by *Axis »

I'm trying with dirhash, it doesn't work (with %S, %L, etc.).
User avatar
Dalai
Power Member
Power Member
Posts: 9387
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: User Command for hashing console programs

Post by *Dalai »

If your hash program doesn't support list files (or multiple parameters like %S provides), you're going to need some kind of loop that calls the hash program for every file. This will impact performance a lot because the forking of processes is expensive in terms of resources (CPU load).

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6482
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: User Command for hashing console programs

Post by *Horst.Epp »

You can use the tool List To MultiInstance (Lst2Multi)
https://www.ghisler.com/dtools.htm
It will of course take some time for a large number of files.
Windows 11 Home x64 Version 23H2 (OS Build 22631.3447)
TC 11.03 x64 / x86
Everything 1.5.0.1372a (x64), Everything Toolbar 1.3.3, Listary Pro 6.3.0.73
QAP 11.6.3.2 x64
Axis
Junior Member
Junior Member
Posts: 88
Joined: 2015-07-14, 18:53 UTC

Re: User Command for hashing console programs

Post by *Axis »

The program supports stdin as input ("When no filename provided or when '-' is provided, uses stdin as input."): could it help that?
Axis
Junior Member
Junior Member
Posts: 88
Joined: 2015-07-14, 18:53 UTC

Re: User Command for hashing console programs

Post by *Axis »

Horst.Epp wrote: 2021-05-31, 15:22 UTC You can use the tool List To MultiInstance (Lst2Multi)
https://www.ghisler.com/dtools.htm
It will of course take some time for a large number of files.
Thanks, I'll try
(but it's a pain in the ass: tc really starts to irritate me)
User avatar
solid
Power Member
Power Member
Posts: 747
Joined: 2004-08-09, 11:20 UTC

Re: User Command for hashing console programs

Post by *solid »

As i can see, the program (if it is this one https://github.com/idrassi/DirHash/releases/tag/DirHash_1.18.0) only supports one parametar as the name of the file or dir. It doesn't even support wildcards.

It is a limitation of the program, not TC.

For handling such situation there is Lst2Multi as @Horst.Epp suggested. Use it to send all the filenames to it and the Lst2Multi will run the external program as many times as necessary, each time with another single filename.

F4Menu has the same functionality, although it is not its main purpose.
Axis
Junior Member
Junior Member
Posts: 88
Joined: 2015-07-14, 18:53 UTC

Re: User Command for hashing console programs

Post by *Axis »

solid wrote: 2021-06-01, 09:42 UTC It is a limitation of the program, not TC.
I was referring ("tc really starts to irritate me") to being forced to non-native solutions for something that could be quickly (maybe) inserted into TC (at least put one between Blake3 or Xxh3).
solid wrote: 2021-06-01, 09:42 UTCFor handling such situation there is Lst2Multi as @Horst.Epp suggested.
It doesn't support Internal TC variables (I tried with %commander_path% and %commander_drive%), so goodbye tc's portability :?
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6482
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: User Command for hashing console programs

Post by *Horst.Epp »

Axis wrote: 2021-06-04, 16:08 UTC It doesn't support Internal TC variables (I tried with %commander_path% and %commander_drive%), so goodbye tc's portability :?
Sorry thats nonsense.
TC starts the lst2mlt.exe with a button you define
and of course TC knows about %COMMANDER_PATH% and its other variables.
Windows 11 Home x64 Version 23H2 (OS Build 22631.3447)
TC 11.03 x64 / x86
Everything 1.5.0.1372a (x64), Everything Toolbar 1.3.3, Listary Pro 6.3.0.73
QAP 11.6.3.2 x64
Axis
Junior Member
Junior Member
Posts: 88
Joined: 2015-07-14, 18:53 UTC

Re: User Command for hashing console programs

Post by *Axis »

Horst.Epp wrote: 2021-06-04, 16:22 UTC TC starts the lst2mlt.exe with a button you define
and of course TC knows about %COMMANDER_PATH% and its other variables.
TC 9.22 x64, Start menu:

Command: "%commander_path%\utils\lst2mlt\lst2mlt.exe"

Parameters: /X:"%commander_path%\utils\DirHash\DirHash.exe" /L:"%L"

https://imgur.com/uBZQ7tS
User avatar
Dalai
Power Member
Power Member
Posts: 9387
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: User Command for hashing console programs

Post by *Dalai »

2Axis
You have to double the percent signs (of environment variables) in the Parameters field because letters prefixed by a single percent sign are considered placeholders by TC, like %C, %P, %N and so on. When supplying the parameters within the Command field, the percent signs don't need to be doubled.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Axis
Junior Member
Junior Member
Posts: 88
Joined: 2015-07-14, 18:53 UTC

Re: User Command for hashing console programs

Post by *Axis »

Dalai wrote: 2021-06-04, 16:53 UTC 2Axis
You have to double the percent signs (of environment variables) in the Parameters field because letters prefixed by a single percent sign are considered placeholders by TC, like %C, %P, %N and so on. When supplying the parameters within the Command field, the percent signs don't need to be doubled.
I tried
-------------------
Command: "%commander_path%\utils\lst2mlt\lst2mlt.exe"

Parameters: /X:"%%commander_path%%\utils\DirHash\DirHash.exe" /L:"%L"
-------------------
Not working ("Windows cannot find '%commander_path%\utils\DirHash\DirHash.exe'. Make sure you typed the name correctly, and then try again.").

Thanks
hi5
Power Member
Power Member
Posts: 551
Joined: 2012-11-03, 11:35 UTC
Contact:

Re: User Command for hashing console programs

Post by *hi5 »

Try
Command: utils\lst2multi\lst2mlt.exe
parameters: /X:"utils\DirHash\DirHash.exe" /L:"%L"
you probably don't need %commander_path% is it is relative to the TC anyway. (works here)
F4MiniMenu (Forum) - Open selected file(s) from TC in defined editor(s) - A (minimalistic) clone of F4Menu
Source at GitHub (AutoHotkey). TCSyncComments (copy file comments)
Axis
Junior Member
Junior Member
Posts: 88
Joined: 2015-07-14, 18:53 UTC

Re: User Command for hashing console programs

Post by *Axis »

hi5 wrote: 2021-06-04, 20:43 UTC Try
Command: utils\lst2multi\lst2mlt.exe
parameters: /X:"utils\DirHash\DirHash.exe" /L:"%L"
you probably don't need %commander_path% is it is relative to the TC anyway. (works here)
It doesn't work: "Windows cannot find 'utils\lst2mlt\lst2mlt.exe'. Make sure you typed the name correctly, and then try again." :cry:

Thanks

Edit: replace "lst2multi" with "lst2mlt"
Post Reply