Using PHP to develop applications, especially Web applications, often requires the generation of random passwords, such as user registration to generate random passwords, user reset password also need to generate a random password. Rando
One of the great advantages of the Linux operating system is that you can use up to hundreds of ways to implement it for the same thing. For example, you can generate random passwords in dozens of ways. This article describes 10 ways to generate a random password.1. Use the SHA algorithm to encrypt the date and output
results: ryjwqjltlayex3j7ncbir20h1k/0cnqlneunytscfko=4. This method is similar to the previous urandom, but it is reverse-workingTR-CD ' [: alnum:] ' 5. Use the string command to output a printable string from a fileStrings/dev/urandom |Grep-o ' [[: Alnum:]] ' |Head-n 32 |Tr-d ' \ n '; The echo generates the following results: W4v1iqtkmq8sidd9jxdqnpg8hpmoz86. This is a simpler version of using Urandom7. Us
Using PHP to develop applications, especially Web applications, often requires the generation of random passwords, such as user registration to generate random passwords, user reset password also need to generate a random password. A ran
Description: I have commented on some basic code, the number of verification codes implemented here, the strings that need to be used can be set again. With my comments, you should be able to read it easily.Basic ideas:1. Use Mt_rand () randomly generated numbers to determine the string to be obtained, concatenation of the string (feel that the generated verification code is a bit too crowded, you can re-
Baidu intern recruitment pen questions:
Compile the function Foo (int x, int y, int N)
Calculation: X integers with the size of [1, y] are randomly generated. What is the sum of them and the probability of n?
Solution: use an array count [m] [k] to generate a random number for a total of m times, and calculate the number of times for K. initialize count [1] [1], count [1] [2] .. count [1] [Y] = 1
It is easy to implement asp.net to generate random password, the following code gives the complete implementation method:
Copy Code code as follows:
Publicstaticstringmakepassword (Stringpwdchars,intpwdlen)
{
Stringtmpstr= "";
Intirandnum;
Randomrnd=newrandom ();
for (inti=0; i{
Irandnum=rnd. Next (Pwdchars. Length);
Tmpstr+=pwdchars[irandnum];
}
RETURNTMPSTR;
}
Control source, talk
How to generate a random password using Python
Directly run the Code:
#-*-Coding: UTF-8 -*-
'''
Generate a random password briefly, including uppercase and lowercase letters and numbers. You can specify the password length.
'''
# Generate a
Copy Code code as follows:
Package com.test;
Import Java.util.Random;
public class Generaterandomnumber {
public static void Main (string[] args) {
System.out.println ("Generated 10 is a random number:" + GETCHARANDNUMR (10));}
/*** Java generates random numbers and letter combinations* @param length[
Using system;Using system. text;
Namespace consoleapplication{Class chinesecode{Public static void main (){// Obtain the gb2312 encoding page (table)Encoding GB = encoding. getencoding ("gb2312 ");
// Call the function to generate four random Chinese character codesObject [] bytes = createregioncode (4 );
// Decodes Chinese Characters Based on the byte array encoded by Chinese CharactersString str1 = GB. g
There are many ways to generate random passwords, the simplest is to use the PHP Mt_rand () function to generate a series of numbers directly, let me introduce you to PHP generated random password program
The simplest way to mt_rand a function
Mt_rand () returns a random int
This article describes in detail how to generate a random password using Python. interested partners can refer to the standard instance to share with you the implementation process of generating a random password using Python, for your reference, the specific content is as follows:
I wrote a program mainly used to check the empty and weak passwords of the MySQL
. Select one of them randomly.
Repeat 2 until the generated text reaches the required size.
The code is as follows:
import random class Markov(object): def __init__(self, open_file): self.cache = {} self.open_file = open_file self.words = self.file_to_words() self.word_size = len(self.words) self.database() def file_to_words(self): self.open_file.seek(0) data = self.open_file.read() words = data.split() return words def tripl
Applications that require user registration before using the provided functions
ProgramWhen a new user submits the registration information, a common practice is to generate a random password by the program, and then send the password to the e-mail address entered during user registration, the user activates the account with the received password.
It is easy to implement the ASP. NET
Now we need to randomly generate a group of RGB values, such as: # ffffff
The main point is to randomly generate 6 characters, these 6 characters from 0-9, take in the A-F. Then connect with # to form the color value. Public static string createrandomcolor ()
{
String allchar = "0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D
1PHP2 Session_Start();3 //generate a random string verification code4 $checkcode="";5 for($i= 0;$i$i++){6 $checkcode.=Dechex(Rand(0,15));//String dechex (int) returns a string that contains the hexadecimal representation of the given number parameter7 }8 //save
Phpsession_start ();//generate a random string verification code$checkcode =""; for($i =0; $i 4; $i + +) {$checkcode.=dechex (Rand (0, the));//String dechex (int) returns a string that contains the hexadecimal representation of the given number parameter}//save
Generate 6 ~ There are several 16-bit user names, mainly text operations. The premise is that there must be a string package. It mainly contains three programs. Procedure 1: Extract data randomly from the dictionary and write a new file. (1.php )? Php * extracts random values from dictionary files * $ file1.Words. dic; $ file2.common _ pass_mini.dic; $ file3 gene
blocks, and later its representation was extended to a variety of graphic forms by third parties.
For more information, refer to the following wiki links, other references are open source for each language.
Ps
Gravatar and WordPress are a company. Like my avatar.
Whenever I comment on a website that supports Gravatar (such as WordPress), I will show this avatar as long as I leave my email.
Reference:
Wikipedia:identicon
Original Identicon Java
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.