您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
23 行
661 B
23 行
661 B
using System;
|
|
using Unity.Collections.LowLevel.Unsafe;
|
|
|
|
namespace Unity.Networking.Transport.Relay
|
|
{
|
|
public unsafe struct RelayHMACKey
|
|
{
|
|
public const int k_Length = 64;
|
|
|
|
public fixed byte Value[k_Length];
|
|
|
|
// Used by Relay SDK
|
|
public static RelayHMACKey FromBytePointer(byte* data, int length)
|
|
{
|
|
if (length != k_Length)
|
|
throw new ArgumentException($"Provided byte array length is invalid, must be {k_Length} but got {length}.");
|
|
|
|
var hmacKey = new RelayHMACKey();
|
|
UnsafeUtility.MemCpy(hmacKey.Value, data, length);
|
|
return hmacKey;
|
|
}
|
|
}
|
|
}
|