Skip to content

Commit

Permalink
Fix math
Browse files Browse the repository at this point in the history
ahmed605 authored May 4, 2023
1 parent 346e10b commit 470e104
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions SRC/RageLib/Common/KeyUtil.cs
Original file line number Diff line number Diff line change
@@ -124,7 +124,7 @@ bool ReadKeyFromOffset(uint offset)
if (offset <= fs.Length - 32)
{
var tempKey = new byte[32];
fs.Seek(u, SeekOrigin.Begin);
fs.Seek(offset, SeekOrigin.Begin);
fs.Read(tempKey, 0, 32);

var hash = BitConverter.ToString(SHA1.Create().ComputeHash(tempKey)).Replace("-", "");
@@ -140,9 +140,9 @@ bool ReadKeyFromOffset(uint offset)

uint LookupOffset()
{
int num = (int)Math.Floor(fs.Length / 32);
uint num = (uint)Math.Floor((double)(fs.Length / 32));

for (int i = 0; i < num; i++)
for (uint i = 0; i < num; i++)
{
if (ReadKeyFromOffset(i * 32))
return i * 32;
@@ -171,15 +171,15 @@ uint LookupOffset()
{
offset = LookupOffset();

if (offset != (uint)-1)
if (offset != (uint)0xFFFFFFFF)
File.WriteAllText($"{ExecutableName}.keyOffset", offset.ToString());
}
}
else
{
offset = LookupOffset();

if (offset != (uint)-1)
if (offset != (uint)0xFFFFFFFF)
File.WriteAllText($"{ExecutableName}.keyOffset", offset.ToString());
}
}

0 comments on commit 470e104

Please sign in to comment.