2023-02-08 23:53:42 +00:00
|
|
|
|
using System.Text;
|
2022-08-30 15:00:58 +00:00
|
|
|
|
|
|
|
|
|
namespace SharpChat {
|
|
|
|
|
public static class Extensions {
|
|
|
|
|
public static string GetIdString(this byte[] buffer) {
|
2023-02-08 03:17:07 +00:00
|
|
|
|
const string id_chars = "abcdefghijklmnopqrstuvwxyz0123456789-_ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
2023-02-07 15:01:56 +00:00
|
|
|
|
StringBuilder sb = new();
|
2022-08-30 15:00:58 +00:00
|
|
|
|
foreach(byte b in buffer)
|
|
|
|
|
sb.Append(id_chars[b % id_chars.Length]);
|
|
|
|
|
return sb.ToString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|