Encryption algorithm using (a): using CRC32 to compress 32uuid strings

Source: Internet
Author: User
Tags crc32 repetition

CRC32 is higher than MD5 repetition rate,

However, we can still compress the 32-bit UUID string into a shorter shaped unique identity by using CRC32 and then turning the long shaping.

1 /**2      * 3 * @Title: Getcrc32value4      * @author: Liuyx5 * @date: November 6, 2015 PM 5:26:126 * @Description: Gets the string corresponding to the repetition probability of a smaller shape7      * @paramstr Incoming string8      * @return9      */Ten      Public Staticstring Getcrc32value (String str) { One          ACRC32 CRC32 =NewCRC32 (); - crc32.update (Str.getbytes ()); - System.out.println (Crc32.getvalue ()); the          -         /*str = str.replace ("-", "" "); - str = Str.replaceall ("[A-za-z]", ""); - if (str.length () >10) { + str = str.substring (Str.length () -10); - }else if (str.length () ==0) { + //string temp = long.tostring (System.currenttimemillis ()); A str = ""; at         }*/ -         returnlong.tostring (Crc32.getvalue ()); -}

Encryption algorithm using (a): using CRC32 to compress 32uuid strings

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.