Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


VBScript PIN validator

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,197
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> VBScript PIN validator
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 VBScript PIN validator - 6/21/2001 6:31:51 AM   
  anton

 

Posts: 11
Score: 0
Joined: 6/9/2001
From: USA
Status: offline
Hi,

I have a script that produces random numbers between an upper and
lower bound value.

My random numbers can be between 4 and 8 digits long. I pass in
how many digits the length has to be into the function.

Basically i need to write a function that checks that my PIN's are not
things like 1234, 1111, 2222, 3333, 9876 that kinda thing. Basically
any numbers that would be easy to think of to try and hack into an
account i want to preven being used, if this is the case then return
false.

Obviously if there are more than 4 digits then the same applies for >
4 . i.e. 12345, 54321, 11111, 22222, 123456, etc etc.

Any suggestions appreciated!!
 
 
Post #: 1
 
 Re: VBScript PIN validator - 6/21/2001 6:33:33 AM   
  compugenie

 

Posts: 9
Score: 0
Joined: 6/9/2001
From: USA
Status: offline
You really only need one function (it is below)
To check for 56789 do CheckSEQ(var, 1)
To check for 98765 do CheckSEQ(var, -1)
to check for 11111 do CheckSEQ(var, 0)

It won't work for values over 9 (9012 for instance) but
it wouldn't be hard to modify it to do so..


function CheckSEQ(var, increment_by)
for i = 2 to len(var) -1
if clng(mid(var,i,1)) <> clng(mid(var,i-1,1)) + increment_by then
exit sub
end if
next

if i = len(var) + 1 then
CheckSEQ = false 'SEQ failed, easy to guess
else
CheckSEQ = true
end if
end function

(in reply to anton)
 
 
Post #: 2
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> VBScript PIN validator Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts