It looks correct to me; that it works is of course the best test.
Charles Yeomans
On May 3, 2006, at 5:49 PM, Nils Frisch wrote:
France,
Toulouse,
Wednesday, May, 3rd, 2006,
11:48 pm.
Hi Charles,
As always, thank you very much for your help.
Here how I write the code:
UsersDB.SQLExecute( "UPDATE UserAccounts SET Password = """ +
ConvertEncoding( EncodeBase64( MD5( aPassword ), 0 ),
Encodings.UTF8 ) + """
WHERE ID = " + userID )
I hash the password with the MD5 method.
Then I encode the hashed password with EncodeBase64 which returns
an ASCII
string.
I convert this ASCII string into UTF-8 string since the
REALSQLDatabase
prefers UTF-8 encoded strings.
Is that correct ?
For the moment, that works fine and resolves my problem.
Thanks.
Have a very nice day,
Nils
----
Le 3/05/06 2:59, « [NOM] » <[ADRESSE]> a écrit :
Encode the MD5 hash using EncodeBase64, which returns an ASCII
string.
Charles Yeomans
On May 2, 2006, at 8:50 PM, Nils Frisch wrote:
Hi Everybody,
I would like to know the best way for storing passwords treated by
the MD5
function.
I noted that MD5 returns strings without text encoding:
MD5( aString ).Encoding = Nil
REALSQLDatabase usually store UTF-8 strings. So I should convert
the MD5
function's result into UTF-8 encoding. But before that I have to
define an
encoding. Is it ISOLatin1 ?
If I store the MD5 version of the password directly into the
database
(without encoding treatment), I could meet some problem. For
example, if the
password is:
aaaa
The MD5 version is (displayed by MsgBox):
t∏s7EB‘”?ăf=≈Â
This cause a database error:
error code: 1
error message: Incomplete SQL statement
It's because of the quotes generated by the MD5 function.
What is the best strategy ?
I have also an underlying question.
What is the best strategy to store data including quote symbols ?
Have I to use the ReplaceAll method to twin every quotes ?
For example:
aStringToStore = aStringToStore.ReplaceAll( """", """""" )
aStringToStore = aStringToStore.ReplaceAll( "'", "''" )
aStringToStore = aStringToStore.ReplaceAll( "‘", "‘‘" )
And so on.
Thank you for your ideas.
Have a good day,
Nils
----
Nils Frisch
http://www.nils-frisch.com/
Toulouse,
France.
----
Nils Frisch
http://www.nils-frisch.com/
Toulouse,
France.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>