Base24 encoded C # class library

Source: Internet
Author: User

Base24 encoding is generally used to generate serial numbers. Base64 encoding removes special and confusing characters, such as 1 and l, 0, and O, the serial numbers of Winxp and Office are based on this encoding (expressed as 114 bits with 25 base 24 characters ). The basic principle is to use 7 base24 characters to encode 32 bits. The data range of 7 base24 characters is 24 to the power of 7, that is, 4,586,471,424, and the data range of 32bits is 4,294,967,296. It can include all data with a certain margin. The C # implementation is given below:

 

1 // file: Base24Encoding. cs
2 // Author: blueqt
3 // Date: 2010-01-17
4 // Version 1.0
5 namespace System. Text
6 {
7 /// <summary>
8 // indicates the base 24 Encoding
9 /// </summary>
10 public class Base24Encoding
11 {
12 /// <summary>
13 // represents the character ing table used by the default Implementation of the base 24 encoding: bcdfghjkmpqrtvwxy231689
14 /// </summary>
15 public const string DefaultMap = "bcdfghjkmpqrtvwxy2000089 ";
16
17 private static Base24Encoding defaultInstance;
18
19 private string map;
20
21 /// <summary>
22 // default constructor
23 /// </summary>
24 public Base24Encoding ()
25 {
26 this. map = DefaultMap;
27}
28
29 /// <summary>
30 // obtain the default Implementation of the base 24 Encoding
31 /// </summary>
32 & n

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.