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

Everything else that doesn't fall into one of the other PB categories.
swhite
Enthusiast
Enthusiast
Posts: 727
Joined: Thu May 21, 2009 6:56 pm

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

Post 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
Simon White
dCipher Computing
User avatar
NicTheQuick
Addict
Addict
Posts: 1227
Joined: Sun Jun 22, 2003 7:43 pm
Location: Germany, Saarbrücken
Contact:

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

Post by NicTheQuick »

Why is this relevant for you? I see no problem with that, just a little inconsistency.
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3870
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

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

Post 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.
Windows (x64)
Raspberry Pi OS (Arm64)
wombats
Enthusiast
Enthusiast
Posts: 664
Joined: Thu Dec 29, 2011 5:03 pm

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

Post 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")
swhite
Enthusiast
Enthusiast
Posts: 727
Joined: Thu May 21, 2009 6:56 pm

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

Post 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
Simon White
dCipher Computing
User avatar
Paul
PureBasic Expert
PureBasic Expert
Posts: 1252
Joined: Fri Apr 25, 2003 4:34 pm
Location: Canada
Contact:

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

Post 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');
Image Image
Post Reply