Replace BitConverter.ToString(bytes).Replace("-", "") with Convert.ToHexString(bytes) (#4382)

This commit is contained in:
Berkan Diler 2023-02-08 14:54:58 +01:00 committed by GitHub
parent f6d5499a16
commit 99fc4fa61b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 7 deletions

View File

@ -229,7 +229,7 @@ namespace Ryujinx.HLE.FileSystem
continue; continue;
} }
string ncaId = BitConverter.ToString(cnmt.ContentEntries[0].NcaId).Replace("-", "").ToLower(); string ncaId = Convert.ToHexString(cnmt.ContentEntries[0].NcaId).ToLower();
AddAocItem(cnmt.TitleId, containerPath, $"{ncaId}.nca", true); AddAocItem(cnmt.TitleId, containerPath, $"{ncaId}.nca", true);
} }

View File

@ -696,8 +696,8 @@ namespace Ryujinx.HLE.HOS
var buildIds = programs.Select(p => p switch var buildIds = programs.Select(p => p switch
{ {
NsoExecutable nso => BitConverter.ToString(nso.BuildId.ItemsRo.ToArray()).Replace("-", "").TrimEnd('0'), NsoExecutable nso => Convert.ToHexString(nso.BuildId.ItemsRo.ToArray()).TrimEnd('0'),
NroExecutable nro => BitConverter.ToString(nro.Header.BuildId).Replace("-", "").TrimEnd('0'), NroExecutable nro => Convert.ToHexString(nro.Header.BuildId).TrimEnd('0'),
_ => string.Empty _ => string.Empty
}).ToList(); }).ToList();

View File

@ -51,11 +51,11 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc.AccountService
var payload = new JwtPayload var payload = new JwtPayload
{ {
{ "sub", BitConverter.ToString(rawUserId).Replace("-", "").ToLower() }, { "sub", Convert.ToHexString(rawUserId).ToLower() },
{ "aud", "ed9e2f05d286f7b8" }, { "aud", "ed9e2f05d286f7b8" },
{ "di", BitConverter.ToString(deviceId).Replace("-", "").ToLower() }, { "di", Convert.ToHexString(deviceId).ToLower() },
{ "sn", "XAW10000000000" }, { "sn", "XAW10000000000" },
{ "bs:did", BitConverter.ToString(deviceAccountId).Replace("-", "").ToLower() }, { "bs:did", Convert.ToHexString(deviceAccountId).ToLower() },
{ "iss", "https://e0d67c509fb203858ebcb2fe3f88c2aa.baas.nintendo.com" }, { "iss", "https://e0d67c509fb203858ebcb2fe3f88c2aa.baas.nintendo.com" },
{ "typ", "id_token" }, { "typ", "id_token" },
{ "iat", DateTimeOffset.UtcNow.ToUnixTimeSeconds() }, { "iat", DateTimeOffset.UtcNow.ToUnixTimeSeconds() },

View File

@ -101,7 +101,7 @@ namespace Ryujinx.HLE.HOS.Services.Caps
}; };
// NOTE: The hex hash is a HMAC-SHA256 (first 32 bytes) using a hardcoded secret key over the titleId, we can simulate it by hashing the titleId instead. // NOTE: The hex hash is a HMAC-SHA256 (first 32 bytes) using a hardcoded secret key over the titleId, we can simulate it by hashing the titleId instead.
string hash = BitConverter.ToString(SHA256.HashData(BitConverter.GetBytes(titleId))).Replace("-", "").Remove(0x20); string hash = Convert.ToHexString(SHA256.HashData(BitConverter.GetBytes(titleId))).Remove(0x20);
string folderPath = Path.Combine(_sdCardPath, "Nintendo", "Album", currentDateTime.Year.ToString("00"), currentDateTime.Month.ToString("00"), currentDateTime.Day.ToString("00")); string folderPath = Path.Combine(_sdCardPath, "Nintendo", "Album", currentDateTime.Year.ToString("00"), currentDateTime.Month.ToString("00"), currentDateTime.Day.ToString("00"));
string filePath = GenerateFilePath(folderPath, applicationAlbumEntry, currentDateTime, hash); string filePath = GenerateFilePath(folderPath, applicationAlbumEntry, currentDateTime, hash);