Discussion:
Password test
Jean-Luc Arnaud
2016-08-23 08:09:17 UTC
Permalink
Hi all,

What's the simplest way to compare a string to a password (another
string, of course), respecting Upper- and Lowercases?
So TOTO is not equal to TOTo.

My first idea is to simply compare strings (If "TOTO"="TOTo") and then,
if true, to compare each character using Asc function.
As soon as a difference appears, the test returns false.

Another idea(s)?

TIA
--
Jean-Luc Arnaud


_______________________________________________
Unsubscribe by sending a message to:
<nug-***@lists.xojo.com>

List Help: <***@xojo.com>
Bernd Fröhlich
2016-08-23 08:21:21 UTC
Permalink
Post by Jean-Luc Arnaud
What's the simplest way to compare a string to a password (another
string, of course), respecting Upper- and Lowercases?
So TOTO is not equal to TOTo.
My first idea is to simply compare strings (If "TOTO"="TOTo") and then,
if true, to compare each character using Asc function.
As soon as a difference appears, the test returns false.
Another idea(s)?
Maybe create a hash of the string and the password.
If the hashes match, then they are equal.

(Just an untested idea).

Greetings from Germany,
Bernd Fröhlich

_______________________________________________
Unsubscribe by sending a message to:
<nug-***@lists.xojo.com>

List Help: <***@xojo.com>
Jean-Luc Arnaud
2016-08-23 09:04:27 UTC
Permalink
Thanks, Bernd.

Arnaud's solution is the best for me.

Jean-Luc Arnaud
Post by Bernd Fröhlich
Post by Jean-Luc Arnaud
What's the simplest way to compare a string to a password (another
string, of course), respecting Upper- and Lowercases?
So TOTO is not equal to TOTo.
My first idea is to simply compare strings (If "TOTO"="TOTo") and then,
if true, to compare each character using Asc function.
As soon as a difference appears, the test returns false.
Another idea(s)?
Maybe create a hash of the string and the password.
If the hashes match, then they are equal.
(Just an untested idea).
Greetings from Germany,
Bernd Fröhlich
_______________________________________________
_______________________________________________
Unsubscribe by sending a message to:
<nug-***@lists.xojo.
Markus Winter
2016-08-23 09:27:54 UTC
Permalink
Post by Jean-Luc Arnaud
Arnaud's solution is the best for me.
NEVER save the passwords!

To save passwords always "salt" the passwords, hash them, and save the hash.

When a password is entered, salt it, hash it, and compare it with the saved hash.

See https://www.addedbytes.com/blog/why-you-should-always-salt-your-hashes/

Take care

MfG

Markus

Sent from my iPad


_______________________________________________
Unsubscribe by sending a message to:
<nug-***@lists.xojo.com>

List Help: <***@xojo.com>
Jean-Luc Arnaud
2016-08-23 13:05:30 UTC
Permalink
Thanks for the alert, Markus.

In fact, I didn't give all details. My passport is AES128 encrypted! ;-)

Jean-Luc Arnaud
Post by Markus Winter
Post by Jean-Luc Arnaud
Arnaud's solution is the best for me.
NEVER save the passwords!
To save passwords always "salt" the passwords, hash them, and save the hash.
When a password is entered, salt it, hash it, and compare it with the saved hash.
See https://www.addedbytes.com/blog/why-you-should-always-salt-your-hashes/
Take care
MfG
Markus
Sent from my iPad
_______________________________________________
_______________________________________________
Unsubscribe by sending a message to:
<nug-***@lists.xojo.com>

List Help: <***@xojo.com>
Marnaud
2016-08-23 14:12:01 UTC
Permalink
Post by Jean-Luc Arnaud
In fact, I didn't give all details. My passport is AES128 encrypted! ;-)
Shhhh… Don't give your password! Now we all know it's “AES128 encrypted” ;-)
_______________________________________________
Unsubscribe by sending a message to:
<nug-***@lists.xojo.com>

List Help: <***@xojo.com>
Jean-Luc Arnaud
2016-08-23 14:17:03 UTC
Permalink
Hoho...

Will change it, for sure. Now, it's AES256 encrypted. Hmm, I should
never have said that...:-!

Jean-Luc Arnaud
Post by Marnaud
Post by Jean-Luc Arnaud
In fact, I didn't give all details. My passport is AES128 encrypted! ;-)
Shhhh… Don't give your password! Now we all know it's “AES128 encrypted” ;-)
_______________________________________________
_______________________________________________
Unsubscribe by sending a message to:
<nug-***@lists.xojo.com>

Lis

Marnaud
2016-08-23 08:39:43 UTC
Permalink
Post by Jean-Luc Arnaud
Hi all,
What's the simplest way to compare a string to a password (another string, of course), respecting Upper- and Lowercases?
So TOTO is not equal to TOTo.
My first idea is to simply compare strings (If "TOTO"="TOTo") and then, if true, to compare each character using Asc function.
As soon as a difference appears, the test returns false.
Another idea(s)?
Hello Jean-Luc,

What about StrComp, with binary comparison?
_______________________________________________
Unsubscribe by sending a message to:
<nug-***@lists.xojo.com>

List Help: <***@xojo.com>
Jean-Luc Arnaud
2016-08-23 09:03:22 UTC
Permalink
Great ! Perfect.

I didn't know this function.

Exactly what I need.

Thanks, Arnaud.

Jean-Luc Arnaud
Post by Marnaud
Post by Jean-Luc Arnaud
Hi all,
What's the simplest way to compare a string to a password (another string, of course), respecting Upper- and Lowercases?
So TOTO is not equal to TOTo.
My first idea is to simply compare strings (If "TOTO"="TOTo") and then, if true, to compare each character using Asc function.
As soon as a difference appears, the test returns false.
Another idea(s)?
Hello Jean-Luc,
What about StrComp, with binary comparison?
_______________________________________________
_______________________________________________
Unsubscribe by sending a message to:
<nug-***@lists.xojo.com>

List Help: <lis
Loading...