C code implementation for generating random passwords

Source: Internet
Author: User

Problem description

Some software will often require users to enter a random password (or check code) sent by a system to verify the identity of the user and prevent malicious login.

Requires C language to generate a set of 6-bit random cipher strings.

Introduction to the RAND function

The RAND function is a true random number generator, which returns a range of random values between 0 and Rand_max (2147483647).

The function is prototyped as: int rand (void);

When using this function, include the header file "Stdlib.h".

C Code Implementation

Makefile File Contents

Testrand:testrand.c

gcc-c-G TESTRAND.C

gcc-g-o RELEASE/TESTRANDTESTRAND.O

RM *.o

generation of random passwords

After executing the "make" command, go to the "release" Directory and execute the "Testrand" name, and the resulting random password is as follows:

289383

930886

692777

636915

747793

238335

885386

760492

516649

641421

202362

490027

368690

520059

897763

513926

180540

383426

089172

455736

(I Weibo: Http://weibo.com/zhouzxi?topnav=1&wvr=5, No.: 245924426, welcome attention!) )

C code implementation for generating random passwords

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.