From 85d98289a86cd4b39e7f29a55b6f0f1f73ae2de9 Mon Sep 17 00:00:00 2001 From: Josh Patterson Date: Thu, 29 Aug 2024 09:45:05 -0400 Subject: [PATCH] Fixed uint overflow. --- TightWiki.Models/DataModels/Page.cs | 2 +- .../DataModels/PageFileRevisionAttachmentInfo.cs | 2 +- TightWiki.Security/Helpers.cs | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/TightWiki.Models/DataModels/Page.cs b/TightWiki.Models/DataModels/Page.cs index bd7c574f..8373bb8b 100644 --- a/TightWiki.Models/DataModels/Page.cs +++ b/TightWiki.Models/DataModels/Page.cs @@ -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 { diff --git a/TightWiki.Models/DataModels/PageFileRevisionAttachmentInfo.cs b/TightWiki.Models/DataModels/PageFileRevisionAttachmentInfo.cs index dee38bd7..d38fee51 100644 --- a/TightWiki.Models/DataModels/PageFileRevisionAttachmentInfo.cs +++ b/TightWiki.Models/DataModels/PageFileRevisionAttachmentInfo.cs @@ -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; } } diff --git a/TightWiki.Security/Helpers.cs b/TightWiki.Security/Helpers.cs index e1bf77da..c8b6259b 100644 --- a/TightWiki.Security/Helpers.cs +++ b/TightWiki.Security/Helpers.cs @@ -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("-", "");