Multiple changes to HashHelper and RandomHelper

- Renamed HashHelper to CryptoHelper
- Moved CryptoHelper.GenerateRandomBytes to RandomHelper
- Documented RandomHelper
This commit is contained in:
jvyden 2022-05-01 15:27:35 -04:00
parent 396477c05d
commit f31a73ccaa
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278
22 changed files with 86 additions and 86 deletions

View file

@ -34,7 +34,7 @@ public class LighthouseServerTest
{
await using Database database = new();
if (await database.Users.FirstOrDefaultAsync(u => u.Username == $"{username}{number}") == null)
await database.CreateUser($"{username}{number}", HashHelper.BCryptHash($"unitTestPassword{number}"));
await database.CreateUser($"{username}{number}", CryptoHelper.BCryptHash($"unitTestPassword{number}"));
}
//TODO: generate actual tickets
@ -68,7 +68,7 @@ public class LighthouseServerTest
public async Task<HttpResponseMessage> UploadFileEndpointRequest(string filePath)
{
byte[] bytes = await File.ReadAllBytesAsync(filePath);
string hash = HashHelper.Sha1Hash(bytes).ToLower();
string hash = CryptoHelper.Sha1Hash(bytes).ToLower();
return await this.Client.PostAsync($"/LITTLEBIGPLANETPS3_XML/upload/{hash}", new ByteArrayContent(bytes));
}
@ -76,7 +76,7 @@ public class LighthouseServerTest
public async Task<HttpResponseMessage> AuthenticatedUploadFileEndpointRequest(string filePath, string mmAuth)
{
byte[] bytes = await File.ReadAllBytesAsync(filePath);
string hash = HashHelper.Sha1Hash(bytes).ToLower();
string hash = CryptoHelper.Sha1Hash(bytes).ToLower();
using HttpRequestMessage requestMessage = new(HttpMethod.Post, $"/LITTLEBIGPLANETPS3_XML/upload/{hash}");
requestMessage.Headers.Add("Cookie", mmAuth);
requestMessage.Content = new ByteArrayContent(bytes);