The method of generating random numbers in Shell series

Source: Internet
Author: User
Tags base64 openssl uuid

One: RANDOM

Echo $RANDOM

Random number is a range of 1--32767, generally used it can be cracked

1.2 Generate a eight-digit random password:

echo $ (($RANDOM +11111111))

Two: Md5sum random encryption method generates a longer password

Take 9-digit password:

echo $RADDOM |md5sum|cut-c 2-9

III: Generate random numbers through OpenSSL

[Email protected] tmp]# OpenSSL rand-base64 8

hinfivtfosk=

[Email protected] tmp]# OpenSSL rand-base64

t67tcwo4dqufja==

[Email protected] tmp]#

Four: Get random numbers by time

Date +%s%n (S-S N)

[Email protected] tmp]# date +%s%n

1494493822328919977

[Email protected] tmp]#

V: mkpasswd

To use mkpasswd first download expect

Yum Install Expect-y

[Email protected] scripts]# mkpasswd-l

\DHR (v56zpt

[Email protected] scripts]# mkpasswd-l 18

Uxtxtiluk09wzdd[ga

[Email protected] scripts]#

Six: Equipment:/dev/urandom|cksum

[Email protected] scripts]# head/dev/urandom|cksum

3839730751 3262

[Email protected] scripts]#

Seven: The UUID code is the universal unique identification code:

[Email protected] scripts]# cat/proc/sys/kernel/random/uuid

dbe7d254-11c2-42cc-b541-3f2a990daa8e

[Email protected] scripts]#

Eight: Generally use two methods to encrypt the more secure




The method of generating random numbers in Shell series

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.