/// <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); }
/// <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); }