Skip to content

Commit

Permalink
Fix checksum calculation for B64/Z64 encoded bitmap data (#41)
Browse files Browse the repository at this point in the history
* Use correct polynomial and encode CRC as hexadecimal

* Change algorithm for CRC

* Update B64/Z64 checksums in unit tests
  • Loading branch information
sungaila authored Dec 14, 2023
1 parent 5078242 commit eb918f0
Show file tree
Hide file tree
Showing 11 changed files with 338 additions and 362 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ body:
attributes:
label: PDFtoZPL version
description: Which version of PDFtoZPL is affected?
value: 3.6.3
value: 3.6.4
validations:
required: true
- type: dropdown
Expand Down
2 changes: 1 addition & 1 deletion Console/Console.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<AssemblyName>PDFtoZPL.Console</AssemblyName>
<RootNamespace>PDFtoZPL.Console</RootNamespace>
<StartupObject>PDFtoZPL.Console.Program</StartupObject>
<Version>3.6.3</Version>
<Version>3.6.4</Version>
<Configurations>Debug;Release;ReleaseSigned</Configurations>
</PropertyGroup>

Expand Down
4 changes: 2 additions & 2 deletions PDFtoZPL/Conversion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -579,9 +579,9 @@ private static string ConvertBitmapImpl(SKBitmap pdfBitmap, BitmapEncodingKind e
}

var base64 = Convert.ToBase64String(bitmapAsBytes);
var csc = ComputeBitmapChecksum(base64);
ushort csc = ComputeBitmapChecksum(base64);

bitmapPayload = $":{encodingId}:{base64}:{csc}";
bitmapPayload = $":{encodingId}:{base64}:{csc:X4}";
}
else
{
Expand Down
Loading

0 comments on commit eb918f0

Please sign in to comment.