示例#1
0
文件: UUIDEncoder.cs 项目: aooshi/adf
        /// <summary>
        /// 编码
        /// </summary>
        /// <param name="guid"></param>
        /// <returns>返回22位长度字符串</returns>
        public static String Encode(string guid)
        {
            var bytes = Hex2Bytes(guid);
            var r     = UUIDBase58.Encode(bytes);

            if (r.Length < 22)
            {
                r = r.PadRight(22, '0');
            }
            return(r);
        }
示例#2
0
文件: UUIDEncoder.cs 项目: aooshi/adf
        /// <summary>
        /// 编码
        /// </summary>
        /// <returns>返回22位长度字符串</returns>
        public static String NewID()
        {
            var guid  = Guid.NewGuid().ToString();
            var bytes = Hex2Bytes(guid);
            var r     = UUIDBase58.Encode(bytes);

            if (r.Length < 22)
            {
                r = r.PadRight(22, '0');
            }
            return(r);
        }