'SHA1 Hash computes differently in SQL Server and C#

My SHA1 function in C#:

  unique = $"{OpDate.Date.ToString("yyyy-MM-dd")}:{Ref}:{Type}";
            byte[] value = Encoding.UTF8.GetBytes(unique);
            using (var hash = SHA1.Create())
                unique = BitConverter.ToString(hash.ComputeHash(value)).Replace("-", "");

and in SQL Server my function:

select HASHBYTES('SHA1', (CONVERT(VARCHAR(10),'2022-02-23',126) + Str(-1) + STR(53)))

when I give same inputs these functions it gives different results. How can I get same values from these two functions?

Inputs:
OpDate:022-02-23,
Ref= -1
Type=53

Result of C# : CEB17A6DB0ACE893B48DBFCE32C19D8D8EF2F661
Result of SQL : 0xC4C81724797A5E3893DD3276515EEB1FEDDC02FD



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source