Print Page | Close Window

Combining a string and hex value

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=6239
Printed Date: 31 March 2026 at 3:07pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Combining a string and hex value
Posted By: pmormr
Subject: Combining a string and hex value
Date 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?

-------------
Paul A Morgan

http://www.pmorganphoto.com/" rel="nofollow - http://www.pmorganphoto.com/



Replies:
Posted By: b_bonnett
Date 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



-------------
Webmaster, http://www.planegallery.net/ - The Plane Gallery
Greetings From Christchurch


Posted By: pmormr
Date 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.



-------------
Paul A Morgan

http://www.pmorganphoto.com/" rel="nofollow - http://www.pmorganphoto.com/


Posted By: b_bonnett
Date Posted: 08 October 2003 at 8:54pm

The code I posted before will do what you want then.

Blair



-------------
Webmaster, http://www.planegallery.net/ - The Plane Gallery
Greetings From Christchurch


Posted By: Bunce
Date 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.


Posted By: pmormr
Date 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...

-------------
Paul A Morgan

http://www.pmorganphoto.com/" rel="nofollow - http://www.pmorganphoto.com/


Posted By: pmormr
Date 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.

-------------
Paul A Morgan

http://www.pmorganphoto.com/" rel="nofollow - http://www.pmorganphoto.com/


Posted By: Coco Brown
Date 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. 



Posted By: pmormr
Date Posted: 09 October 2003 at 2:26pm

I'll look into rc4 encryption for my pre-encryption. I was looking for extra methods.



-------------
Paul A Morgan

http://www.pmorganphoto.com/" rel="nofollow - http://www.pmorganphoto.com/



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net