mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-20 06:47:44 +01:00
WIP
This commit is contained in:
parent
707d8d4041
commit
b8db381216
2 changed files with 27 additions and 10 deletions
|
|
@ -66,11 +66,30 @@ namespace Dalamud.Bootstrap.SqexArg
|
||||||
{
|
{
|
||||||
var (keyFragment, step) = RecoverKeyFragmentFromChecksum(checksum);
|
var (keyFragment, step) = RecoverKeyFragmentFromChecksum(checksum);
|
||||||
|
|
||||||
|
Span<byte> keyBytes = stackalloc byte[8];
|
||||||
|
|
||||||
var keyCandicate = keyFragment;
|
var keyCandicate = keyFragment;
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
// try with keyCandicate
|
if (!CreateKey(keyBytes, keyCandicate))
|
||||||
|
{
|
||||||
|
var message = $"BUG";
|
||||||
|
throw new InvalidOperationException(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
var blowfish = new Blowfish(keyBytes);
|
||||||
|
blowfish.DecryptInPlace();
|
||||||
|
|
||||||
|
if (/* if data looks valid, return blowfish */)
|
||||||
|
{
|
||||||
|
// ...
|
||||||
|
// TODO: test if it's looks like valid utf8 string?
|
||||||
|
// ???
|
||||||
|
|
||||||
|
return blowfish;
|
||||||
|
}
|
||||||
|
|
||||||
|
// .. next key plz
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
keyCandicate = checked(keyCandicate + step);
|
keyCandicate = checked(keyCandicate + step);
|
||||||
|
|
@ -82,12 +101,8 @@ namespace Dalamud.Bootstrap.SqexArg
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
private static bool CreateKey(Span<byte> destination, uint key) => Utf8Formatter.TryFormat(key, destination, out var _, new StandardFormat('X', 8));
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="keyFragment"></param>
|
|
||||||
/// <param name="step"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
private static (uint keyFragment, uint step) RecoverKeyFragmentFromChecksum(char checksum)
|
private static (uint keyFragment, uint step) RecoverKeyFragmentFromChecksum(char checksum)
|
||||||
{
|
{
|
||||||
if (checksum == NoChecksumMarker)
|
if (checksum == NoChecksumMarker)
|
||||||
|
|
@ -103,7 +118,7 @@ namespace Dalamud.Bootstrap.SqexArg
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Converts url safe variant of base64 string to bytes.
|
/// Converts the url-safe variant of base64 string to bytes.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="payload">A url-safe variant of base64 string.</param>
|
/// <param name="payload">A url-safe variant of base64 string.</param>
|
||||||
private static byte[] DecodeUrlSafeBase64(string payload)
|
private static byte[] DecodeUrlSafeBase64(string payload)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Nuke.Common;
|
using Nuke.Common;
|
||||||
using Nuke.Common.Execution;
|
using Nuke.Common.Execution;
|
||||||
|
|
@ -13,6 +14,7 @@ using static Nuke.Common.EnvironmentInfo;
|
||||||
using static Nuke.Common.IO.FileSystemTasks;
|
using static Nuke.Common.IO.FileSystemTasks;
|
||||||
using static Nuke.Common.IO.PathConstruction;
|
using static Nuke.Common.IO.PathConstruction;
|
||||||
using static Nuke.Common.Tools.DotNet.DotNetTasks;
|
using static Nuke.Common.Tools.DotNet.DotNetTasks;
|
||||||
|
using static Nuke.Common.Logger;
|
||||||
|
|
||||||
[CheckBuildProjectConfigurations]
|
[CheckBuildProjectConfigurations]
|
||||||
[UnsetVisualStudioEnvironmentVariables]
|
[UnsetVisualStudioEnvironmentVariables]
|
||||||
|
|
@ -35,7 +37,7 @@ class DalamudBuild : NukeBuild
|
||||||
|
|
||||||
AbsolutePath OutputDirectory => RootDirectory / "output";
|
AbsolutePath OutputDirectory => RootDirectory / "output";
|
||||||
|
|
||||||
//AbsolutePath DefaultDalamudRoot =>
|
AbsolutePath DefaultInstallDirectory => (AbsolutePath)Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) / "Dalamud" / "bin" / GitVersion.SemVer;
|
||||||
|
|
||||||
Target Clean => _ => _
|
Target Clean => _ => _
|
||||||
.Before(Restore)
|
.Before(Restore)
|
||||||
|
|
@ -68,7 +70,7 @@ class DalamudBuild : NukeBuild
|
||||||
.DependsOn(Compile)
|
.DependsOn(Compile)
|
||||||
.Executes(() =>
|
.Executes(() =>
|
||||||
{
|
{
|
||||||
|
Info($"Installing Dalamud to {DefaultInstallDirectory}");
|
||||||
// TODO
|
// TODO
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue