File tree 1 file changed +5
-3
lines changed
com.unity.ml-agents/Runtime/Analytics 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change 1
1
using System ;
2
+ using System . Text ;
3
+ using System . Security . Cryptography ;
2
4
using UnityEngine ;
3
5
4
6
namespace Unity . MLAgents . Analytics
@@ -13,7 +15,7 @@ internal static class AnalyticsUtils
13
15
/// <returns>A byte array to be hex encoded.</returns>
14
16
private static string ToHexString ( byte [ ] array )
15
17
{
16
- System . Text . StringBuilder hex = new System . Text . StringBuilder ( array . Length * 2 ) ;
18
+ StringBuilder hex = new StringBuilder ( array . Length * 2 ) ;
17
19
foreach ( byte b in array )
18
20
{
19
21
hex . AppendFormat ( "{0:x2}" , b ) ;
@@ -31,8 +33,8 @@ private static string ToHexString(byte[] array)
31
33
public static string Hash ( string key , string value )
32
34
{
33
35
string hash ;
34
- System . Text . UTF8Encoding encoder = new System . Text . UTF8Encoding ( ) ;
35
- using ( System . Security . Cryptography . HMACSHA256 hmac = new System . Security . Cryptography . HMACSHA256 ( encoder . GetBytes ( key ) ) )
36
+ UTF8Encoding encoder = new UTF8Encoding ( ) ;
37
+ using ( HMACSHA256 hmac = new HMACSHA256 ( encoder . GetBytes ( key ) ) )
36
38
{
37
39
Byte [ ] hmBytes = hmac . ComputeHash ( encoder . GetBytes ( value ) ) ;
38
40
hash = ToHexString ( hmBytes ) ;
You can’t perform that action at this time.
0 commit comments