You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

44 lines
1.1 KiB

using System;
using System.Collections.Generic;
using System.Security.Cryptography;
namespace SogClient
{
/// <summary>
/// 游客账号加密模块
/// </summary>
public static class GuestCrypto
{
enum PLATFORM {
ANDROID = 1,
IOS = 2,
WINDOWS = 3,
}
public static string GetAccountId(string deviceId)
{
return deviceId + "@" + getPlatform();
}
public static string GetAccountToken(string accountId)
{
SHA1 sha1 = new SHA1CryptoServiceProvider();
byte[] dataIn = System.Text.Encoding.UTF8.GetBytes(accountId + "-xGame");
byte[] dataOut = sha1.ComputeHash(dataIn);
string str = BitConverter.ToString(dataOut);
return str.Replace("-", "");
}
public static string getPlatform(int platformType = 1)
{
#if UNITY_5_3
string platform = AppConst.DeviceSystem();
return Enum.Parse(typeof(PLATFORM), platform, true).ToString();
#else
return Enum.GetName(typeof(PLATFORM), platformType);
#endif
}
}
}