Merge pull request #72 from huysentruitw/patch-2

Fix bug in DataMatrix padding algorithm
This commit is contained in:
Florian 2022-02-09 09:49:09 +01:00 committed by GitHub
commit 65580ac6e3
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
} }