Fix bug in DataMatrix padding algorithm

This commit is contained in:
huysentruitw 2022-02-09 09:17:15 +01:00 committed by GitHub
parent 6c824513ba
commit 608a8ad611
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -69,7 +69,12 @@ func addPadding(data []byte, toCount int) []byte {
} }
for len(data) < toCount { for len(data) < toCount {
R := ((149 * (len(data) + 1)) % 253) + 1 R := ((149 * (len(data) + 1)) % 253) + 1
data = append(data, byte((129+R)%254)) tmp := 129 + R;
if (tmp > 254) {
tmp = tmp - 254
}
data = append(data, byte(tmp))
} }
return data return data
} }