| Author |
Topic Search Topic Options
|
pmormr
Senior Member
Joined: 06 January 2003
Location: United States
Status: Offline
Points: 1479
|
Post Options
Thanks(0)
Quote Reply
Topic: Combining a string and hex value Posted: 07 October 2003 at 1:27pm |
|
Does anyone know of a good way to combine the value "examplepasssword" with "2A1A35FC" so that the values are totally mixed?
|
|
|
 |
b_bonnett
Mod Builder Group
Joined: 16 April 2003
Location: New Zealand
Status: Offline
Points: 275
|
Post Options
Thanks(0)
Quote Reply
Posted: 08 October 2003 at 3:04am |
The following piece of code will mix them in a predictable way (I presume this is what you wanted since it appears that the two values are a password and a salt value, so it needs to be the same for each time you check it). Note that if one string is longer than the other, then not all the characters of the longer string will be used; I suggest you generate a salt value the same length as the password.
strPassword = StrReverse(strPassword)
Do Until Len(strPassword) = 0 Or Len(strSalt) = 0 strOutput = strOutput & Left(strPassword, 1) & Right(strSalt, 1) strPassword = StrReverse(Right(strPassword, Len(strPassword) - 1)) strSalt = StrReverse(Left(strSalt, Len(strSalt) - 1)) Loop |
This code turned "examplepasssword" and "2A1A35FCE1494AFB" into "dBe2rFxAoAa1w4mAs9p3s4l5s1eFaEpC".
Hope this helps, Blair
|
|
|
 |
pmormr
Senior Member
Joined: 06 January 2003
Location: United States
Status: Offline
Points: 1479
|
Post Options
Thanks(0)
Quote Reply
Posted: 08 October 2003 at 4:18pm |
it needs to always return the same value with the same password and salt in order for it to work.
|
|
|
 |
b_bonnett
Mod Builder Group
Joined: 16 April 2003
Location: New Zealand
Status: Offline
Points: 275
|
Post Options
Thanks(0)
Quote Reply
Posted: 08 October 2003 at 8:54pm |
The code I posted before will do what you want then.
Blair
|
|
|
 |
Bunce
Senior Member
Joined: 10 April 2002
Location: Australia
Status: Offline
Points: 846
|
Post Options
Thanks(0)
Quote Reply
Posted: 09 October 2003 at 5:11am |
|
ooh, i thought we were gonna get into some bit shifting and stuff then. Those were the days...
|
|
There have been many, many posts made throughout the world...
This was one of them.
|
 |
pmormr
Senior Member
Joined: 06 January 2003
Location: United States
Status: Offline
Points: 1479
|
Post Options
Thanks(0)
Quote Reply
Posted: 09 October 2003 at 1:14pm |
|
i'm thinking of pre-encrypting my salt and password together so my encryption component i'm designing is as secure as possible...
|
|
|
 |
pmormr
Senior Member
Joined: 06 January 2003
Location: United States
Status: Offline
Points: 1479
|
Post Options
Thanks(0)
Quote Reply
Posted: 09 October 2003 at 1:26pm |
|
just so you know... i can't generate a salt value with the same length as the password. If a hacker gets a hold of the database, it'll save him/her a lot of work.
|
|
|
 |
Coco Brown
Senior Member
Joined: 26 April 2002
Location: United States
Status: Offline
Points: 245
|
Post Options
Thanks(0)
Quote Reply
Posted: 09 October 2003 at 1:59pm |
Do a Google search on "rc4 encryption" for ASP. Someone posted some ASP code implementing this. It's two way, so you can use the same function to decrypt it. It's pretty difficult to crack if used correctly. The key will have to be something that is not stored in the database and that the user can remember.
I hope this helps.
|
 |