8000 enhance: get email hash code opimization (#1137) · sourcegit-scm/sourcegit@07d99f5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 07d99f5

Browse files
qiufengshelove-linger
authored andcommitted
enhance: get email hash code opimization (#1137)
(cherry picked from commit 839b92a)
1 parent 9ee3a00 commit 07d99f5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Models/AvatarManager.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.Globalization;
44
using System.IO;
@@ -196,8 +196,8 @@ private void LoadDefaultAvatar(string key, string img)
196196
private string GetEmailHash(string email)
197197
{
198198
var lowered = email.ToLower(CultureInfo.CurrentCulture).Trim();
199-
var hash = MD5.Create().ComputeHash(Encoding.Default.GetBytes(lowered));
200-
var builder = new StringBuilder();
199+
var hash = MD5.HashData(Encoding.Default.GetBytes(lowered).AsSpan());
200+
var builder = new StringBuilder(hash.Length * 2);
201201
foreach (var c in hash)
202202
builder.Append(c.ToString("x2"));
203203
return builder.ToString();

0 commit comments

Comments
 (0)
0