Page 1 of 1

Why are Hex values in lower case in StringFingerprint()?

Posted: Mon Sep 17, 2018 3:44 pm
by swhite
Hi

When I use the StringFingerPrint() function the hexidecimal values are in lower case but if I use the Hex() function they are in upper case. Should they not both be in upper case?

Thanks,
Simon

Re: Why are Hex values in lower case in StringFingerprint()?

Posted: Mon Sep 17, 2018 4:13 pm
by NicTheQuick
Why is this relevant for you? I see no problem with that, just a little inconsistency.

Re: Why are Hex values in lower case in StringFingerprint()?

Posted: Mon Sep 17, 2018 4:14 pm
by wilbert
Most of the time hash values are written with lowercase characters but of course uppercase is also valid.
Personally I wish Hex() would also return a lowercase result.
For me lowercase hex strings are easier to read.

Re: Why are Hex values in lower case in StringFingerprint()?

Posted: Mon Sep 17, 2018 4:37 pm
by wombats
You can use the LCase and UCase functions to change the result to how you want it.

Code: Select all

UseMD5Fingerprint()

Macro MD5(string)
  UCase(StringFingerprint(string, #PB_Cipher_MD5))
EndMacro

Debug MD5("yourpassword")

Re: Why are Hex values in lower case in StringFingerprint()?

Posted: Mon Sep 17, 2018 5:20 pm
by swhite
NicTheQuick wrote:Why is this relevant for you? I see no problem with that, just a little inconsistency.
I am searching a database of hashes created by another software product and all their hashes use upper case so my sql commands from PB failed to find a match because PB used lower cases values. So I now changed my PB code so that the hashes are converted to upper case and the search works now.

Simon

Re: Why are Hex values in lower case in StringFingerprint()?

Posted: Mon Sep 17, 2018 7:21 pm
by Paul
If all your entries in the database are uppercase, you could also change your SQL statement to search them as lowercase...

Code: Select all

select * from whatever_table where lower(whatever_field) = 'a1b2c3';

Or like PB's UCASE command, you could do the same in your SQL statement..

Code: Select all

select * from whatever_table where whatever_field = upper('a1b2c3');