Internet Security Reference

Master Key Plus Web v1.1

<% On Error Resume Next If Request.Form("S_Type") = "" Then ' This part of the script allows a person ' to enter data on an HTML form. ' If S_type is null then form is displayed, else ' the results of the search are displayed %>
Highest Master

Progression
Small Pin Detailed Pinning
Long Pin Display Style
Macs
SF

Keep checking back for new features!

<%Else If Request.Form("S_Type") = "1" Then 'Phase 1 Calculations 'Start Calculating Here! error_flg =0 np = Len(Request.Form("M1")) Dim mk(8) Dim seq(8) '********* 'Key must be either 5 or 6 pins j=0 if np<5 then j=1 end if if np>6 then j=1 end if if j=1 then TryAgain("Highest Master Key must be a 5 or 6 pin key!") end if '********* '********* 'Key Length and rotation order must be same length j=0 if (np <> Len(Request.Form("prog"))) then j=1 end if if j=1 then TryAgain("Master Key length & Progression length Differ!") if np>Len(Request.Form("prog")) then np=Len(Request.Form("prog")) End if End If '********* '********* 'Test for invalid data in Master Key or Progression test=Request.Form("M1") for i = 1 to np if mid(test,i,1) > "9" OR mid(test,i,1)<"0" then TryAgain("Invalid Data in Generation Master") Error_flg = 1 End If Next test=Request.Form("prog") for i = 1 to np if mid(test,i,1) > "9" OR mid(test,i,1)<"0" then TryAgain("Invalid Data in Progression Information") Error_flg = 1 End If Next if Error_flg = 0 then for i = 1 to np mk(i) = int(mid(Request.Form("M1"),i,1)) seq(i) = int(mid(Request.Form("prog"),i,1)) Next End If '********* 'Test for progression sequence errors tmp_tot=0 j=0 for i = 1 to np tmp_tot=tmp_tot+i j=j+seq(i) Next if tmp_tot <> j then TryAgain("Invalid Progression Sequence") Error_flg = 1 End If '********* '********* 'Test for bad LP & SP information test = Request.FOrm("LP") if test > "9" OR test < "0" then TryAgain("Invalid Data in Long Pin") Error_Flg=1 else ur = int(test) End If test = Request.Form("SP") if test > "9" OR test < "0" then TryAgain("Invalid Data in Short Pin") Error_Flg=1 else lr = int(test) End If '********* '********* 'Test MACS test = Request.Form("mac") if test > "9" OR test < "0" then TryAgain("Invalid Data in MACS") Error_Flg=1 else macs = int(test) End If '********* '********* 'Test Stepping Factor test = Request.Form("SF") if test > "9" OR test < "0" then TryAgain("Invalid Data in Stepping Factor") Error_Flg=1 else sf = int(test) End If '********* '********** 'Misc Stepping Factor Test for Error if Error_Flg = 0 then if (ur-lr < sf) then TryAgain("Invalid Stepping Factor & Small/Large Pin Relationship") Error_Flg = 1 End If End If if Error_Flg = 0 then if (sf > macs) then TryAgain("Invalid Stepping Factor / Macs Relationship") Error_Flg = 1 End If End If '********* '********* 'Error Checking Master Key for Long & Short Pin Lengths if Error_Flg = 0 then j = 0 For i = 1 to np if mk(i) > ur then j = 1 end If if mk(i) < lr then j = 1 end if Next if j=1 then TryAgain("Invalid Number's in Generation Master - Outside Specified Range") Error_Flg = 1 End If End If '********* if Error_Flg = 0 then if lr >= ur then TryAgain("Invalid small/large pin Information") Error_flg = 1 End If End if '************************* '* End Of Testing Input * '************************* 'If no errors then get on with it Dim nums(8,30) Dim Posble_nums(30) if Error_Flg <> 1 then For i = 1 to np num=0 temp=mk(i) nums(i,1)=temp Do While (temp>lr-1) temp = temp-sf if temp> lr-1 then num=num+1 nums(i,num)=temp end if Loop temp=mk(i) Do While(temp "209.30.18.137" then x4=1 x5=1 x6=1 Response.Write("
Test Drive will only Display Page #1
") End If ' Print testdrive only allows first page End If 'Following routine creates form buttons to select which page is requested for i = 1 to x6 for j = 1 to x5 %>
<% for k = 1 to x4 pg=pg+1 %>
">">">">">">">"><%if pg<10 then%>

<%else%> <% end if %>

<%Next%>
<%Next Next End If ' This is the End If for no Error Flags End If 'Phase 1 If Request.Form("S_Type") = "2" Then 'Phase 2 Calculations 'Start Calculating Here! np = Len(Request.Form("M1")) ReDim mk(8) ReDim seq(8) if Error_flg = 0 then for i = 1 to np mk(i) = int(mid(Request.Form("M1"),i,1)) seq(i) = int(mid(Request.Form("prog"),i,1)) Next End If macs = Request.Form("mac") ur = Request.FOrm("LP") lr = Request.Form("SP") sf = Request.Form("SF") i1=Request.Form("Pagex") i2=Request.Form("Pagey") i3=Request.Form("Pagez") ReDim nums(8,30) ReDim Posble_nums(30) For i = 1 to np num=0 temp=mk(i) nums(i,1)=temp Do While (temp>lr-1) temp = temp-sf if temp> lr-1 then num=num+1 nums(i,num)=temp end if Loop temp=mk(i) Do While(temp

Results

<% 'm1 m2 m3 m4 m5 'x11 x21 x31 x41 x51 'x12 x22 x32 x42 x52 'x13 x23 x33 x43 x53 'x14 x24 x34 x44 x54 '**** ' move the created nums(i,j) into x(i,j) 'why? because!!!! Dim x(8,30) for i=1 to np for j=1 to posble_nums(i) x(i,j) = nums(i,j) Next Next Dim key(6) Dim xx(6) temp = "" For q = 1 to np temp = temp & mk(q) key(q) = mk(q) Next if NOT good_key(key,np,macs) then temp = temp & "*" end If %>
<% Response.Write("Highest Master
"&temp) For q = 1 to np if seq(q)=1 then xx(seq(q)) = mk(q) End If if seq(q)=1 then xx(seq(q)) = mk(q) End If if seq(q)=1 then xx(seq(q)) = mk(q) End If if seq(q)=2 then xx(seq(q)) = mk(q) End If if seq(q)=3 then xx(seq(q)) = mk(q) End If if seq(q)=4 then xx(seq(q)) = mk(q) End If if seq(q)=5 then xx(seq(q)) = x(q,i2) End If if seq(q)=6 then xx(seq(q)) = x(q,i3) End If Next %>
<% temp="" temp = GetMaxNums(5,np,seq,posble_nums) & " Page Master
" For q = 1 to np temp= temp & xx(seq(q)) key(q) = xx(seq(q)) Next if NOT Good_Key(key,np,macs) then temp=temp & "*" end if Response.Write(temp) '** End of Page Masters %>

<% if request.form("Style")="Matrix" then '***** 'Column Masters Start For k = 1 to GetMaxNums(3,np,seq,posble_nums) For q = 1 to np if seq(q)=1 then xx(seq(q)) = mk(q) End If if seq(q)=1 then xx(seq(q)) = mk(q) End If if seq(q)=1 then xx(seq(q)) = x(q,k) End If if seq(q)=2 then xx(seq(q)) = mk(q) End If if seq(q)=3 then xx(seq(q)) = mk(q) End If if seq(q)=4 then xx(seq(q)) = x(q,i1) End If if seq(q)=5 then xx(seq(q)) = x(q,i2) End If if seq(q)=6 then xx(seq(q)) = x(q,i3) End If Next temp = "Column " & k & " Master
" For q = 1 to np temp= temp & xx(seq(q)) key(q) = xx(seq(q)) Next if NOT Good_Key(key,np,macs) then temp=temp & "*" end if %> <% Next 'k 'End Column Masters '*** end if ' test for style=matrix %>
<% For q = 1 to np if seq(q)=1 then xx(seq(q)) = mk(q) End If if seq(q)=1 then xx(seq(q)) = mk(q) End If if seq(q)=1 then xx(seq(q)) = mk(q) End If if seq(q)=2 then xx(seq(q)) = mk(q) End If if seq(q)=3 then xx(seq(q)) = mk(q) End If if seq(q)=4 then xx(seq(q)) = x(q,i1) End If if seq(q)=5 then xx(seq(q)) = x(q,i2) End If if seq(q)=6 then xx(seq(q)) = x(q,i3) End If Next temp="" For q = 1 to np temp= temp & xx(seq(q)) key(q) = xx(seq(q)) Next if NOT Good_Key(key,np,macs) then temp=temp & "*" end if Response.Write("Page Master
" & temp) %>
<% Response.Write(temp) %>
<% '***** 'Block Masters Start For j = 1 to GetMaxNums(2,np,seq,Posble_Nums) %> <% For k = 1 to GetMaxNums(2,np,seq,Posble_Nums) For q = 1 to np if seq(q)=1 then xx(seq(q)) = mk(q) End If if seq(q)=2 then xx(seq(q)) = x(q,j) End If if seq(q)=3 then xx(seq(q)) = mk(q) End If if seq(q)=4 then xx(seq(q)) = x(q,i1) End If if seq(q)=5 then xx(seq(q)) = x(q,i2) End If if seq(q)=6 then xx(seq(q)) = x(q,i3) End If Next ' q Next 'k temp="" For q = 1 to np temp = temp & xx(seq(q)) key(q) = xx(seq(q)) Next 'q if NOT Good_Key(key,np,macs) then temp = temp & "*" End If %> <% '******* '** Block Column Master Setup For k = 1 to GetMaxNums(3,np,seq,Posble_Nums) For q = 1 to np if seq(q)=1 then xx(seq(q)) = mk(q) End If if seq(q)=2 then xx(seq(q)) = x(q,j) End If if seq(q)=3 then xx(seq(q)) = x(q,k) End If if seq(q)=4 then xx(seq(q)) = x(q,i1) End If if seq(q)=5 then xx(seq(q)) = x(q,i2) End If if seq(q)=6 then xx(seq(q)) = x(q,i3) End If Next ' q temp="" For q = 1 to np temp = temp & xx(seq(q)) key(q) = xx(seq(q)) Next if NOT Good_Key(key,np,macs) then temp = temp & "*" End If if request.form("Style") = "Matrix" then %> <% end if if request.form("Style") = "Standard" then %> <%x end if Next 'k %> <% '***** 'End of Block-Column Masters '***** '* Start Block Row Master Setup For i = 1 to GetMaxNums(1,np,seq,Posble_Nums) if Request.Form("Style")="Matrix" then %> <% End If For k = 1 to GetMaxNums(1,np,seq,Posble_Nums) For q = 1 to np if seq(q)=1 then xx(seq(q)) = x(q,i) End If if seq(q)=2 then xx(seq(q)) = x(q,j) End If if seq(q)=3 then xx(seq(q)) = mk(q) End If if seq(q)=4 then xx(seq(q)) = x(q,i1) End If if seq(q)=5 then xx(seq(q)) = x(q,i2) End If if seq(q)=6 then xx(seq(q)) = x(q,i3) End If Next ' q Next 'k temp="" For q = 1 to np temp = temp & xx(seq(q)) key(q) = xx(seq(q)) Next 'q if NOT Good_Key(key,np,macs) then temp = temp & "*" End If if Request.Form("Style")="Matrix" then %> <% End If For k = 1 to GetMaxNums(3,np,seq,Posble_Nums) For q = 1 to np if seq(q)=1 then xx(seq(q)) = x(q,i) End If if seq(q)=2 then xx(seq(q)) = x(q,j) End If if seq(q)=3 then xx(seq(q)) = x(q,k) End If if seq(q)=4 then xx(seq(q)) = x(q,i1) End If if seq(q)=5 then xx(seq(q)) = x(q,i2) End If if seq(q)=6 then xx(seq(q)) = x(q,i3) End If Next ' q '*** '* Start Change Key Routine '* '* Set up bottom pins & Master Pins '* Only if Details Needed Dim bp(8) Dim mp(8) For q = 1 to np key(q) = int(xx(seq(q))) if key(q) > int(mk(q)) then bp(q) = int(mk(q)) else bp(q) = int(key(q)) End If mp(q) = ABS(key(q)-int(mk(q))) Next if request.form("Style") = "Standard" then %> <% End If temp = "CK:" For q = 1 to np temp = temp & xx(seq(q)) key(q) = xx(seq(q)) Next 'q if NOT Good_Key(key,np,macs) then temp = temp & "*" End If if Request.Form("Style")="Standard" then %> <% End If mpt="" For q = 1 to np mpt = mpt & mp(q) Next 'q bpt = "" For q = 1 to np bpt = bpt & bp(q) Next 'q if Request.Form("Style")="Standard" then %> <% End if if Request.Form("Style")="Matrix" then if request.form("mkpdet") <> "" then temp = temp & "
MP:" & mpt temp = temp & "
BP:" & bpt End If %> <% End If if request.form("Style")="Standard" then %> <% End If Next 'k '* End of Change Key routine '**** %> <% Next 'i %>
<% Response.Write("BM: " & temp) %> <% Response.Write("BC"&k&"M: " & temp) %> <% if k=1 then Response.Write("Bottom
Pins") end if if k=2 then Response.Write("Master
Pins") end if if k=3 then Response.Write("Description") end If %>
<% Response.Write("BR" & i & "M: " & temp) %>
<%=temp%> <%=bpt%> <%=mpt%> <%response.Write(temp) %>
<% Next 'j %> <% ' End Of Loops Response.Write("Definitions: [* - indicates key not within MACS] [BM - Block Master]
") if request.form("Style")="Matrix" then Response.Write("[BRxM - Block Row (x) Master] [BCxM - Block Column (x) Master]") End If End If 'Phase 2 End If 'Test for Start at top%>
<%Sub TryAgain(error_msg) Response.Write("

- Error in Data Entry -

") Response.Write("Error Message: " & "" & error_msg & "") End Sub %> <%Function GetMaxNums(PosVal,np,seq(),posble_nums()) For k=1 to np if seq(k) = PosVal then GetMaxNums = posble_nums(k) Exit Function End If Next End Function%> <%Function Good_Key(Key(),np, macs) Good_Key = True for ii = 1 to np-1 diff = ABS(key(ii)-key(ii+1)) if diff > int(macs) then Good_Key = False Exit Function End If Next End Function %>