Rev 64 | Blame | Compare with Previous | Last modification | View Log | RSS feed
<%'******************************' KeyGeN.asp'******************************Const g_KeyLocation = "c:\key.txt"Const g_KeyLen = 512On Error Resume NextCall WriteKeyToFile(KeyGeN(g_KeyLen),g_KeyLocation)if Err <> 0 ThenResponse.Write "ERROR GENERATING KEY" & "<P>"Response.Write Err.Number & "<BR>"Response.Write Err.Description & "<BR>"ElseResponse.Write "KEY SUCCESSFULLY GENERATED"End IfSub WriteKeyToFile(MyKeyString,strFileName)Dim keyFile, fsoset fso = Server.CreateObject("scripting.FileSystemObject")set keyFile = fso.CreateTextFile(strFileName, true)keyFile.WriteLine(MyKeyString)keyFile.CloseEnd SubFunction KeyGeN(iKeyLength)Dim k, iCount, strMyKeylowerbound = 35 ' 35upperbound = 96 ' 96Randomize ' Initialize random-number generator.for i = 1 to iKeyLengths = 255k = Int(((upperbound - lowerbound) + 1) * Rnd + lowerbound)strMyKey = strMyKey & Chr(k) & ""nextstrMyKey = Replace(strMyKey, "'", "|")strMyKey = Replace(strMyKey, VBNewLine, "|")strMyKey = Replace(strMyKey, VBTab, "|")strMyKey = Replace(strMyKey, VBFormFeed, "|")strMyKey = Replace(strMyKey, VBVerticalTab, "|")strMyKey = Replace(strMyKey, VBNullChar, "|")KeyGeN = strMyKeyEnd Function%>