Page 1 of 1

Recognize checksum lines generated by OpenSSL

Posted: 2020-04-04, 23:53 UTC
by JardaSX
I have a file with checksums inside generated by openssl (one checksum per line, the command line is not included of course):

Linux/Cygwin generation relative path:

Code: Select all

$ openssl md5 bugs/video\ to\ perform\ some\ test/output.mp4
MD5(bugs/video to perform some test/output.mp4)= fe76301a5e609aae1cdb7ad60bcc424d
Linux/Cygwin generation absolute path:

Code: Select all

$ openssl md5 /cygdrive/t/bugs/video\ to\ perform\ some\ test/output.mp4
MD5(/cygdrive/t/bugs/video to perform some test/output.mp4)= fe76301a5e609aae1cdb7ad60bcc424d
WIN64 OpenSSL generation relative path:

Code: Select all

C:\>C:\Program Files\OpenSSL-Win64\bin>"C:\Program Files\OpenSSL-Win64\bin\openssl.exe" md5 "R:\bugs\video to perform some test\output.mp4"
MD5(R:\bugs\video to perform some test\output.mp4)= fe76301a5e609aae1cdb7ad60bcc424d
WIN64 OpenSSL generation absolute path:

Code: Select all

R:\>"C:\Program Files\OpenSSL-Win64\bin\openssl.exe" md5 "bugs\video to perform some test\output.mp4"
MD5(bugs\video to perform some test\output.mp4)= fe76301a5e609aae1cdb7ad60bcc424d
Would like that TC is able to work with it at Files -> Verify Checksums.

Re: Recognize checksum lines generated by OpenSSL

Posted: 2020-04-04, 23:56 UTC
by JardaSX
In case it helps, md5sum is able to handle that, provided that the checksum.md5 file is then patched by dos2linux.

Re: Recognize checksum lines generated by OpenSSL

Posted: 2020-04-09, 23:32 UTC
by JardaSX
OpenSSL supports all these digest algorithms and digest commands:

Code: Select all

openssl list -digest-algorithms
RSA-MD4 => MD4
RSA-MD5 => MD5
RSA-RIPEMD160 => RIPEMD160
RSA-SHA1 => SHA1
RSA-SHA1-2 => RSA-SHA1
RSA-SHA224 => SHA224
RSA-SHA256 => SHA256
RSA-SHA3-224 => SHA3-224
RSA-SHA3-256 => SHA3-256
RSA-SHA3-384 => SHA3-384
RSA-SHA3-512 => SHA3-512
RSA-SHA384 => SHA384
RSA-SHA512 => SHA512
RSA-SHA512/224 => SHA512-224
RSA-SHA512/256 => SHA512-256
RSA-SM3 => SM3
BLAKE2b512
BLAKE2s256
id-rsassa-pkcs1-v1_5-with-sha3-224 => SHA3-224
id-rsassa-pkcs1-v1_5-with-sha3-256 => SHA3-256
id-rsassa-pkcs1-v1_5-with-sha3-384 => SHA3-384
id-rsassa-pkcs1-v1_5-with-sha3-512 => SHA3-512
MD4
md4WithRSAEncryption => MD4
MD5
MD5-SHA1
md5WithRSAEncryption => MD5
ripemd => RIPEMD160
RIPEMD160
ripemd160WithRSA => RIPEMD160
rmd160 => RIPEMD160
SHA1
sha1WithRSAEncryption => SHA1
SHA224
sha224WithRSAEncryption => SHA224
SHA256
sha256WithRSAEncryption => SHA256
SHA3-224
SHA3-256
SHA3-384
SHA3-512
SHA384
sha384WithRSAEncryption => SHA384
SHA512
SHA512-224
sha512-224WithRSAEncryption => SHA512-224
SHA512-256
sha512-256WithRSAEncryption => SHA512-256
sha512WithRSAEncryption => SHA512
SHAKE128
SHAKE256
SM3
sm3WithRSAEncryption => SM3
ssl3-md5 => MD5
ssl3-sha1 => SHA1
whirlpool

Code: Select all

openssl list -digest-commands
blake2b512        blake2s256        gost              md2
md4               md5               rmd160            sha1
sha224            sha256            sha3-224          sha3-256
sha3-384          sha3-512          sha384            sha512
sha512-224        sha512-256        shake128          shake256
sm3
OpenSSL - Command Line Utilities

Re: Recognize checksum lines generated by OpenSSL

Posted: 2020-04-10, 08:53 UTC
by nsp
to me the easiest way is to transform your openssl file to be compliant with TC format or sfv format.

checksum TC Format
You can have multiple file , the extension is what you want,

Code: Select all

<hash> <File path>
Hash is detected automatically CRC,MD5,SHA1,SHA...

File path can be:
relative with a <*> before the path sample: *USER\passwd.txt
absolute path sample: C:/info/USER/passwd.txt

you can use unix / or windows \ folder separator
You can use ansi or UTF file with BOM..

This is quite easy to handle and probably easy to build in bash or anything else a scrip/pgm to convert your openssl file..

Once TC you cans use the File -> Checksum -> Verify from your generated list !

Re: Recognize checksum lines generated by OpenSSL

Posted: 2020-04-10, 14:08 UTC
by JardaSX
Thanks @nsp, I see your point, but consider that openssl specifies which digest algorithm you are using at the beggining of the line, because more than one algorithms can output a checksum which may look the same. I guess TC measures the length of the checksum to establish what type it is. But same length could be attributed to 2 or more digests. Obviously if you use the basics (CRC, MD5, SHA1, SHA256) that's so simple.

Anyway, it's up to the developer to make a choice.