Skip to content

Commit

Permalink
Fixed uint overflow.
Browse files Browse the repository at this point in the history
  • Loading branch information
NTDLS committed Aug 29, 2024
1 parent cd0f892 commit 85d9828
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion TightWiki.Models/DataModels/Page.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class Page : IPage
public string Name { get; set; } = string.Empty;
public string Navigation { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
public uint DataHash { get; set; }
public int DataHash { get; set; }

public string EllipseDescription
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ public class PageFileRevisionAttachmentInfo
public int Revision { get; set; }
public string ContentType { get; set; } = string.Empty;
public int Size { get; set; }
public uint DataHash { get; set; }
public int DataHash { get; set; }
public int PageId { get; set; }
public int PageFileId { get; set; }
}
Expand Down
8 changes: 4 additions & 4 deletions TightWiki.Security/Helpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ public static string GenerateRandomString(int maxLength = 10)
return result.ToUpper();
}

public static uint Crc32(string text)
=> (new Crc32()).Get(Encoding.Unicode.GetBytes(text));
public static int Crc32(string text)
=> (int)(new Crc32()).Get(Encoding.Unicode.GetBytes(text));

public static uint Crc32(byte[] bytes)
=> (new Crc32()).Get(bytes);
public static int Crc32(byte[] bytes)
=> (int)(new Crc32()).Get(bytes);

public static string Sha1(string text)
=> BitConverter.ToString(SHA1.HashData(Encoding.Unicode.GetBytes(text))).Replace("-", "");
Expand Down

0 comments on commit 85d9828

Please sign in to comment.