96 var buf = ArrayPool<byte>.Shared.Rent(str.Length * 3 + 1);
101 for (
int i = 0, e = str.Length; i < e; i++)
104 if ((ch != 0) && (ch <= 0x7f))
108 else if (ch <= 0x7FF)
111 var high_five = (byte)(ch >> 6);
112 var low_six = (byte)(ch & 0x3F);
113 buf[j++] = (byte)(high_five | 0xC0);
114 buf[j++] = (byte)(low_six | 0x80);
119 var high_four = (byte)(ch >> 12);
120 var mid_six = (byte)((ch >> 6) & 0x3F);
121 var low_six = (byte)(ch & 0x3f);
122 buf[j++] = (byte)(high_four | 0xE0);
123 buf[j++] = (byte)(mid_six | 0x80);
124 buf[j++] = (byte)(low_six | 0x80);
129 hash.AppendData(buf, 0, j);
133 ArrayPool<byte>.Shared.Return(buf);