First I appologize if this post is too far off topic for this board. I am getting ready to distribute an excel vba application that I want to have unique or semi-unique passwords for each username that is defined by the users last name. I have written a routine in excel that does this. Here is the code:

Sub password_gen()
Dim tempstr As String
Dim strlen As Integer
Dim x As Integer
Dim var1 As String
Dim ivar1 As String
Dim var2 As String
Dim rCtr
Dim a

tempstr = "Testdata" 'input user last name and use as username

strlen = Len(tempstr)

For x = 1 To strlen

var1 = Mid(tempstr, x, 1)

ivar1 = Asc(var1)
ivar1 = (ivar1 * x) + x + 3
While ivar1 > 122
ivar1 = ivar1 - 100
Wend
If (ivar1 > 47 And ivar1 < 58) Or _
(ivar1 > 64 And ivar1 < 91) Or _
(ivar1 > 96 And ivar1 < 123) Then
var1 = Chr(ivar1)
Else
While ivar1 > 10
ivar1 = ivar1 - 10
Wend
End If

var2 = var2 & var1
Next x


End Sub


What my dilemna is that I want to be able to run this same routine on my website that will generate and email a username and password to someone that logs in and requests the program. I don't know much (VERRRRY LITTLE IF JUST A HARE OVER NOTHING) about cgi script or programming it. Does anyone know of something that would generate a unique password depending on username that can be run as a cgi script. I am not 100% fixed on my method of generating the password in excel. I just want the 2 methods to match so that I can distribute my excel application that will calc and check the password and the website code would generate it. Does anyone have advice on where I would look to learn about how to write some cgi scripts that would do something close to what I'm asking.

Thanks,

John