Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

on the fly password encryption

Status
Not open for further replies.
Sep 5, 2004
55
0
0
CH
Hi all

I use the code below (which i found somewhere in the internet):
------------------------------------------------------------
<%
Function encrypt(x1, x2)
s = ""
t = 0
For i = 1 to len(x1)
t = t + asc(mid(x1,i,1))
Next
For i = 1 to len(x2)
y = (t + asc(mid(x2,i,1)) * asc(mid(x2,((i+1) mod len(x2)+1),1))) mod 255
s = s & chr(y)
Next
For i = (len(x2) + 1) to 10
If t>598.8 Then t = 598.8
y = t^3*i mod 255
s = s & chr(y)
Next
encrypt = s
End Function
%>
<% response.write encrypt(request.form("Passwort")) %>
------------------------------------------------------------

to encrypt passwords on the fly, as they came from a html form to write down in a .htpasswd file (which is needed to protect Folders within IIS)


now istead of calling the function above the following ASP Eror appears in the Browser:


HTTP 500.100 - Interner Serverfehler - ASP-Fehler
Internet-Informationsdienste

--------------------------------------------------------------------------------

Technische Informationen (für den Support)

Fehlertyp:
Laufzeitfehler in Microsoft VBScript (0x800A01C2)
Falsche Anzahl an Argumenten oder ungültige Eigenschaftszuweisung: 'encrypt'


on english it means the following:

"Run time error in Microsoft VBScript(0x800A01C2)
Wrong amount of arguments or invalid Type Assigment : 'encrypt'

whats wrong, doest it pay eventually a role, where i place the code inside the asp page?

many thanks for your help

best regards

E.Altherr



 
This isn't English, SecondToNone.

Your function encrypt needs 2 parameters passed to it, but your line

<% response.write encrypt(request.form("Passwort")) %>

only sends one parameter.

It appears you're sending the password to the server unencrypted, then encrypting it on the server. Wouldn't it be better (more secure) to encrypt it on the client side and then send the encrypted password to the server that way? There's been a discussion in the VB6 forum recently on using MD5 for encrypting passwords securely, and I'm sure you could adapt the code for that pretty easily.

thread222-535644

Lee
 
to all

thanks, now i found the solution:

instead of doing this funcionality by hand i use now a third party tool called IISPassword which works fine and generates also apache compatible (htpasswd and htaccess) files

very cool this tool and it's free





 
For anyone interested:

[link=http://www.troxo.com/products/iispassword]IIS Password[/url]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top