This repository has been archived by the owner on Nov 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d37d74a
commit b6249b8
Showing
7 changed files
with
98 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Security.Cryptography; | ||
|
||
namespace Xenon.Nexon | ||
{ | ||
public static class Auth | ||
{ | ||
public const string CLIENT_ID = "7853644408"; | ||
public const string SCOPE = "us.launcher.all"; | ||
|
||
public static string DeviceId = ""; // lets just make a random 64 string that we use everytime... | ||
|
||
static Auth() | ||
{ | ||
DeviceId = Properties.Settings.Default.nexonDeviceId; | ||
|
||
if (String.IsNullOrEmpty(DeviceId)) | ||
{ | ||
DeviceId = ""; | ||
|
||
var random = new Random(); | ||
for (int i = 0; i < 64; i++) | ||
DeviceId += random.Next(16).ToString("X"); | ||
|
||
Properties.Settings.Default.nexonDeviceId = DeviceId; | ||
Properties.Settings.Default.Save(); | ||
} | ||
} | ||
|
||
public static string HashHexPassword(string password) | ||
{ | ||
// hashes the password as sha-512 and hex as required by nexon | ||
// https://msdn.microsoft.com/en-us/library/s02tk69a(v=vs.110).aspx | ||
SHA512 shaM = new SHA512Managed(); | ||
byte[] shaData = shaM.ComputeHash(Encoding.UTF8.GetBytes(password)); | ||
|
||
var sb = new StringBuilder(); | ||
for (int i = 0; i < shaData.Length; i++) | ||
sb.Append(shaData[i].ToString("x2")); // hex formatted | ||
|
||
return sb.ToString(); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Xenon | ||
{ | ||
static class Util | ||
{ | ||
public static string EncodeB64(string plainText) | ||
=> System.Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(plainText)); | ||
|
||
public static string DecodeB64(string base64EncodedData) | ||
=> System.Text.Encoding.UTF8.GetString(System.Convert.FromBase64String(base64EncodedData)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters