Two functions of ASP generating random password

Source: Internet
Author: User

ASP generates two functions for random passwords:
function one

<%function Makepassword (byVal maxlen) Dim Strnewpassdim whatsnext, Upper, lower, intcounterrandomizefor intCounter = 1 To Maxlenwhatsnext = Int ((1-0 + 1) * Rnd + 0) If whatsnext = 0 Then ' characterupper = 90lower = 65Elseupper = 57lower = 48 End Ifstrnewpass = strnewpass & Chr (Int ((upper-lower + 1) * Rnd + lower) Nextmakepassword = Strnewpassend function%& Gt

bits of Makepassword (str) ' str password

function two

<% Function gen_key (digits) Dim Char_array (+) char_array (0) = "0" Char_array (1 ) = "1" char_array (2) = "2" Char_array (3) = "3" Char_array (4) = "4" Char_array (5) = "5" char_array (6) = "6" Char_array (7) = "7" C Har_array (8) = "8" Char_array (9) = "9" Char_array (Ten) = "A" Char_array (one) = "B" Char_array (All) = "C" Char_array (All) = "D" Char_ Array (+) = "E" Char_array (+) = "F" Char_array (+) = "G" Char_array (+) = "H" char_array () = "I" Char_array (+) = "J" Char_ar Ray = "K" Char_array (+) = "L" Char_array (P) = "M" Char_array (P) = "N" char_array () = "O" Char_array (+) = "P" Char_arra Y (+) = "Q" Char_array = "R" Char_array (+) = "S" Char_array = "T" Char_array (+) = "U" Char_array (+) = "V" Char_array ( = "W" Char_array = "X" Char_array (digitsnum) = "Y" Char_array (+) = "Z" Randomizedo while Len (output) < char_a Rray (Int * Rnd + 0)) output = output + Numloopgen_key = Outputend function%> 

Gen_key (str) ' STR ' is the number of password digits
This function can also be extended. If you also want to add the case sensitive case sensitivity feature, modify the array size to Char_array (50), and then list all possible lowercase characters later. For example:
Char_array (+) = "a"
Char_array (PNS) = "B"
............... Analogy

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.