mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-01-03 14:23:40 +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);
|
||||
|
||||
Span<byte> keyBytes = stackalloc byte[8];
|
||||
|
||||
var keyCandicate = keyFragment;
|
||||
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
|
||||
{
|
||||
keyCandicate = checked(keyCandicate + step);
|
||||
|
|
@ -82,12 +101,8 @@ namespace Dalamud.Bootstrap.SqexArg
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="keyFragment"></param>
|
||||
/// <param name="step"></param>
|
||||
/// <returns></returns>
|
||||
private static bool CreateKey(Span<byte> destination, uint key) => Utf8Formatter.TryFormat(key, destination, out var _, new StandardFormat('X', 8));
|
||||
|
||||
private static (uint keyFragment, uint step) RecoverKeyFragmentFromChecksum(char checksum)
|
||||
{
|
||||
if (checksum == NoChecksumMarker)
|
||||
|
|
@ -103,7 +118,7 @@ namespace Dalamud.Bootstrap.SqexArg
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts url safe variant of base64 string to bytes.
|
||||
/// Converts the url-safe variant of base64 string to bytes.
|
||||
/// </summary>
|
||||
/// <param name="payload">A url-safe variant of base64 string.</param>
|
||||
private static byte[] DecodeUrlSafeBase64(string payload)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Nuke.Common;
|
||||
using Nuke.Common.Execution;
|
||||
|
|
@ -13,6 +14,7 @@ using static Nuke.Common.EnvironmentInfo;
|
|||
using static Nuke.Common.IO.FileSystemTasks;
|
||||
using static Nuke.Common.IO.PathConstruction;
|
||||
using static Nuke.Common.Tools.DotNet.DotNetTasks;
|
||||
using static Nuke.Common.Logger;
|
||||
|
||||
[CheckBuildProjectConfigurations]
|
||||
[UnsetVisualStudioEnvironmentVariables]
|
||||
|
|
@ -35,7 +37,7 @@ class DalamudBuild : NukeBuild
|
|||
|
||||
AbsolutePath OutputDirectory => RootDirectory / "output";
|
||||
|
||||
//AbsolutePath DefaultDalamudRoot =>
|
||||
AbsolutePath DefaultInstallDirectory => (AbsolutePath)Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) / "Dalamud" / "bin" / GitVersion.SemVer;
|
||||
|
||||
Target Clean => _ => _
|
||||
.Before(Restore)
|
||||
|
|
@ -68,7 +70,7 @@ class DalamudBuild : NukeBuild
|
|||
.DependsOn(Compile)
|
||||
.Executes(() =>
|
||||
{
|
||||
Info($"Installing Dalamud to {DefaultInstallDirectory}");
|
||||
// TODO
|
||||
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue