Example #1
0
        public static int CalculateCrc32(byte[] buffer)
        {
            CRC32Calculator cal = new CRC32Calculator();

            cal.SlurpBlock(buffer, 0, buffer.Length);
            return(cal.Crc32Result);
        }
Example #2
0
        public static int CalculateCrc32(string inputData)
        {
            CRC32Calculator cal = new CRC32Calculator();

            byte[] utf8 = System.Text.Encoding.UTF8.GetBytes(inputData);
            cal.SlurpBlock(utf8, 0, utf8.Length);
            return(cal.Crc32Result);
        }
Example #3
0
 static int RegisterFontName(string fontName)
 {
     fontName = fontName.ToUpper();
     if (!s_registerFontNames.TryGetValue(fontName, out int found))
     {
         int nameCrc32 = CRC32Calculator.CalculateCrc32(fontName);
         s_registerFontNames.Add(fontName, nameCrc32);
         return(nameCrc32);
     }
     return(found);
 }