亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? randomguid.java

?? 基于java的組號查詢模塊
?? JAVA
字號:
package com.lily.dap.util;
/*
 * RandomGUID from http://www.javaexchange.com/aboutRandomGUID.html
 * @version 1.2.1 11/05/02
 * @author Marc A. Mnich
 *
 * From www.JavaExchange.com, Open Software licensing
 *
 * 11/05/02 -- Performance enhancement from Mike Dubman.  
 *             Moved InetAddr.getLocal to static block.  Mike has measured
 *             a 10 fold improvement in run time.
 * 01/29/02 -- Bug fix: Improper seeding of nonsecure Random object
 *             caused duplicate GUIDs to be produced.  Random object
 *             is now only created once per JVM.
 * 01/19/02 -- Modified random seeding and added new constructor
 *             to allow secure random feature.
 * 01/14/02 -- Added random function seeding with JVM run time
 *
 */

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.util.Random;

/*
 * In the multitude of java GUID generators, I found none that
 * guaranteed randomness.  GUIDs are guaranteed to be globally unique
 * by using ethernet MACs, IP addresses, time elements, and sequential
 * numbers.  GUIDs are not expected to be random and most often are
 * easy/possible to guess given a sample from a given generator.
 * SQL Server, for example generates GUID that are unique but
 * sequencial within a given instance.
 *
 * GUIDs can be used as security devices to hide things such as
 * files within a filesystem where listings are unavailable (e.g. files
 * that are served up from a Web server with indexing turned off).
 * This may be desireable in cases where standard authentication is not
 * appropriate. In this scenario, the RandomGUIDs are used as directories.
 * Another example is the use of GUIDs for primary keys in a database
 * where you want to ensure that the keys are secret.  Random GUIDs can
 * then be used in a URL to prevent hackers (or users) from accessing
 * records by guessing or simply by incrementing sequential numbers.
 *
 * There are many other possiblities of using GUIDs in the realm of
 * security and encryption where the element of randomness is important.
 * This class was written for these purposes but can also be used as a
 * general purpose GUID generator as well.
 *
 * RandomGUID generates truly random GUIDs by using the system's
 * IP address (name/IP), system time in milliseconds (as an integer),
 * and a very large random number joined together in a single String
 * that is passed through an MD5 hash.  The IP address and system time
 * make the MD5 seed globally unique and the random number guarantees
 * that the generated GUIDs will have no discernable pattern and
 * cannot be guessed given any number of previously generated GUIDs.
 * It is generally not possible to access the seed information (IP, time,
 * random number) from the resulting GUIDs as the MD5 hash algorithm
 * provides one way encryption.
 *
 * ----> Security of RandomGUID: <-----
 * RandomGUID can be called one of two ways -- with the basic java Random
 * number generator or a cryptographically strong random generator
 * (SecureRandom).  The choice is offered because the secure random
 * generator takes about 3.5 times longer to generate its random numbers
 * and this performance hit may not be worth the added security
 * especially considering the basic generator is seeded with a
 * cryptographically strong random seed.
 *
 * Seeding the basic generator in this way effectively decouples
 * the random numbers from the time component making it virtually impossible
 * to predict the random number component even if one had absolute knowledge
 * of the System time.  Thanks to Ashutosh Narhari for the suggestion
 * of using the static method to prime the basic random generator.
 *
 * Using the secure random option, this class compies with the statistical
 * random number generator tests specified in FIPS 140-2, Security
 * Requirements for Cryptographic Modules, secition 4.9.1.
 *
 * I converted all the pieces of the seed to a String before handing
 * it over to the MD5 hash so that you could print it out to make
 * sure it contains the data you expect to see and to give a nice
 * warm fuzzy.  If you need better performance, you may want to stick
 * to byte[] arrays.
 *
 * I believe that it is important that the algorithm for
 * generating random GUIDs be open for inspection and modification.
 * This class is free for all uses.
 *
 *
 * - Marc
 */

public class RandomGUID extends Object {

    public String valueBeforeMD5 = "";
    public String valueAfterMD5 = "";
    private static Random myRand;
    private static SecureRandom mySecureRand;

    private static String s_id;

    /*
     * Static block to take care of one time secureRandom seed.
     * It takes a few seconds to initialize SecureRandom.  You might
     * want to consider removing this static block or replacing
     * it with a "time since first loaded" seed to reduce this time.
     * This block will run only once per JVM instance.
     */

    static {
        mySecureRand = new SecureRandom();
        long secureInitializer = mySecureRand.nextLong();
        myRand = new Random(secureInitializer);
        try {
            s_id = InetAddress.getLocalHost().toString();
        } catch (UnknownHostException e) {
            e.printStackTrace();
        }

    }


    /*
     * Default constructor.  With no specification of security option,
     * this constructor defaults to lower security, high performance.
     */
    public RandomGUID() {
        getRandomGUID(false);
    }

    /*
     * Constructor with security option.  Setting secure true
     * enables each random number generated to be cryptographically
     * strong.  Secure false defaults to the standard Random function seeded
     * with a single cryptographically strong random number.
     */
    public RandomGUID(boolean secure) {
        getRandomGUID(secure);
    }

    /*
     * Method to generate the random GUID
     */
    private void getRandomGUID(boolean secure) {
        MessageDigest md5 = null;
        StringBuffer sbValueBeforeMD5 = new StringBuffer();

        try {
            md5 = MessageDigest.getInstance("MD5");
        } catch (NoSuchAlgorithmException e) {
            System.out.println("Error: " + e);
        }

        try {
            long time = System.currentTimeMillis();
            long rand = 0;

            if (secure) {
                rand = mySecureRand.nextLong();
            } else {
                rand = myRand.nextLong();
            }

            // This StringBuffer can be a long as you need; the MD5
            // hash will always return 128 bits.  You can change
            // the seed to include anything you want here.
            // You could even stream a file through the MD5 making
            // the odds of guessing it at least as great as that
            // of guessing the contents of the file!
            sbValueBeforeMD5.append(s_id);
            sbValueBeforeMD5.append(":");
            sbValueBeforeMD5.append(Long.toString(time));
            sbValueBeforeMD5.append(":");
            sbValueBeforeMD5.append(Long.toString(rand));

            valueBeforeMD5 = sbValueBeforeMD5.toString();
            md5.update(valueBeforeMD5.getBytes());

            byte[] array = md5.digest();
            StringBuffer sb = new StringBuffer();
            for (int j = 0; j < array.length; ++j) {
                int b = array[j] & 0xFF;
                if (b < 0x10) sb.append('0');
                sb.append(Integer.toHexString(b));
            }

            valueAfterMD5 = sb.toString();

        } catch (Exception e) {
            System.out.println("Error:" + e);
        }
    }


    /*
     * Convert to the standard format for GUID
     * (Useful for SQL Server UniqueIdentifiers, etc.)
     * Example: C2FEEEAC-CFCD-11D1-8B05-00600806D9B6
     */
    public String toString() {
        String raw = valueAfterMD5.toUpperCase();
        StringBuffer sb = new StringBuffer();
        sb.append(raw.substring(0, 8));
        sb.append("-");
        sb.append(raw.substring(8, 12));
        sb.append("-");
        sb.append(raw.substring(12, 16));
        sb.append("-");
        sb.append(raw.substring(16, 20));
        sb.append("-");
        sb.append(raw.substring(20));

        return sb.toString();
    }

    /*
     * Demonstraton and self test of class
     */
    public static void main(String args[]) {
        for (int i=0; i< 100; i++) {
            RandomGUID myGUID = new RandomGUID();
            System.out.println("Seeding String=" + myGUID.valueBeforeMD5);
            System.out.println("rawGUID=" + myGUID.valueAfterMD5);
            System.out.println("RandomGUID=" + myGUID.toString());
        }
    }
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区二区三区中文字幕电影 | 欧美成人精品福利| 国产偷国产偷亚洲高清人白洁| 亚洲视频一区在线观看| 久久国产精品第一页| 91成人国产精品| 国产欧美日韩视频一区二区| 丝袜美腿亚洲综合| 色噜噜夜夜夜综合网| 国产欧美精品一区| 国产在线视频一区二区三区| 欧美午夜在线一二页| 中文字幕中文字幕一区二区| 国产九色精品成人porny| 欧美美女喷水视频| 亚洲免费看黄网站| 成人免费视频网站在线观看| 欧美r级电影在线观看| 日韩成人免费看| 欧美三级韩国三级日本三斤| 亚洲精品水蜜桃| 成人91在线观看| 日本一二三不卡| 国产精品小仙女| 精品卡一卡二卡三卡四在线| 免费观看在线色综合| 欧美一区二区美女| 日韩专区一卡二卡| 欧美一区二区三区影视| 午夜伊人狠狠久久| 欧美男生操女生| 日产欧产美韩系列久久99| 在线成人午夜影院| 日韩国产高清在线| 日韩一级精品视频在线观看| 奇米色一区二区三区四区| 欧美老年两性高潮| 日本欧美久久久久免费播放网| 9191久久久久久久久久久| 午夜久久久久久| 欧美精品精品一区| 美女视频第一区二区三区免费观看网站| 欧美日韩国产影片| 日本一区中文字幕| 精品国产凹凸成av人导航| 国产美女精品一区二区三区| 久久久久国产一区二区三区四区| 国产高清视频一区| 亚洲欧美日韩国产成人精品影院| 91福利社在线观看| 奇米精品一区二区三区在线观看一| 欧美电视剧免费观看| 国产精品一二三四| 蜜臀精品久久久久久蜜臀| 7777精品伊人久久久大香线蕉最新版 | 成人av网址在线| 亚洲综合色自拍一区| 在线综合+亚洲+欧美中文字幕| 九九九精品视频| 亚洲欧洲日韩女同| 欧美精品自拍偷拍动漫精品| 精品无人区卡一卡二卡三乱码免费卡 | 91极品视觉盛宴| 免费欧美高清视频| 国产日产精品一区| 欧美伊人久久久久久久久影院 | 日韩av一级电影| 国产亚洲一区二区三区四区| 91尤物视频在线观看| 日本午夜一本久久久综合| 日本一区二区三区四区| 欧美日韩综合不卡| 国产精品香蕉一区二区三区| 一区二区三区四区视频精品免费 | 欧美电影免费观看高清完整版在| 国产成人午夜99999| 亚洲最新视频在线播放| 国产精品久久久久aaaa樱花| 欧美性感一区二区三区| 国产福利一区二区三区视频 | 97久久超碰国产精品| 午夜久久久久久| 国产精品久久久久精k8| 欧美成人一区二区三区| 欧美优质美女网站| 国产.欧美.日韩| 久久综合综合久久综合| 亚洲午夜电影在线观看| 国产精品网友自拍| 久久综合色8888| 91精品国产综合久久精品app| 91女人视频在线观看| 国产乱码精品一区二区三区忘忧草| 亚洲国产精品久久艾草纯爱| 国产精品拍天天在线| 久久亚洲二区三区| 91精品国产色综合久久ai换脸 | 91福利国产精品| 99久久夜色精品国产网站| 久久99热狠狠色一区二区| 亚洲高清一区二区三区| 亚洲欧美综合在线精品| 日本一区二区三级电影在线观看| 91精品视频网| 欧美电影在线免费观看| 欧美三级在线看| 欧美在线观看视频在线| 91麻豆swag| 色婷婷狠狠综合| 91蜜桃视频在线| 99精品视频在线免费观看| 成人一区二区三区视频 | 91精彩视频在线| 91麻豆国产精品久久| 成人激情电影免费在线观看| 成人午夜电影小说| 成人丝袜18视频在线观看| 国产成人免费视频网站高清观看视频| 黄色精品一二区| 国产成人啪免费观看软件 | 欧美a一区二区| 日本欧洲一区二区| 紧缚奴在线一区二区三区| 激情文学综合丁香| 国产不卡视频一区二区三区| 成人午夜电影久久影院| www.欧美.com| 在线观看视频一区| 欧美女孩性生活视频| 日韩欧美成人一区| 国产性做久久久久久| 国产精品日日摸夜夜摸av| 亚洲免费高清视频在线| 亚洲国产婷婷综合在线精品| 日本伊人色综合网| 国产精品一二三四| 91丨九色丨蝌蚪丨老版| 欧美精品欧美精品系列| 日韩精品一区二区三区四区| 国产欧美一区二区精品仙草咪| 亚洲欧洲av色图| 日精品一区二区三区| 国产精品自产自拍| 色狠狠一区二区三区香蕉| 7777精品伊人久久久大香线蕉| 日韩精品一区二区三区三区免费| 国产性做久久久久久| 亚洲精品ww久久久久久p站| 奇米一区二区三区| 成人动漫一区二区| 欧美精品第一页| 欧美激情一区三区| 视频在线观看国产精品| 高清久久久久久| 欧美精品一级二级三级| 国产三级精品三级在线专区| 亚洲一区二区三区中文字幕 | 亚洲美女免费视频| 美女视频网站久久| 色综合咪咪久久| 26uuu色噜噜精品一区| 亚洲欧美激情一区二区| 麻豆免费看一区二区三区| 99国产精品国产精品久久| 欧美成人免费网站| 亚洲激情av在线| 国产高清不卡二三区| 欧美卡1卡2卡| 国产精品午夜在线| 卡一卡二国产精品| 欧美性色综合网| 国产精品久久久久久户外露出| 肉色丝袜一区二区| 在线视频国内自拍亚洲视频| 国产日韩亚洲欧美综合| 蜜臀久久99精品久久久画质超高清| 91女神在线视频| 国产精品毛片高清在线完整版| 日日夜夜精品免费视频| 欧美性欧美巨大黑白大战| 国产精品国产精品国产专区不片| 美女视频网站黄色亚洲| 538prom精品视频线放| 亚洲最大色网站| 99re这里都是精品| 国产精品狼人久久影院观看方式| 精久久久久久久久久久| 日韩欧美123| 日韩成人免费在线| 337p亚洲精品色噜噜| 亚洲高清免费视频| 欧美天堂一区二区三区| 亚洲黄色免费网站| 色婷婷国产精品久久包臀| 1024精品合集| 91偷拍与自偷拍精品| 一区二区三区中文字幕精品精品 | 中文字幕av一区二区三区| 久久99久久久欧美国产| 欧美电视剧免费观看|