dirkx / base45-js

Base45 (for QR and Aztec barcode alphanumeric mode) library for Javascript/JS/node
2 stars 15 forks source link

fix remainder and quotient for edge case of 256 #5

Closed pp-ps closed 3 years ago

pp-ps commented 3 years ago

The divmod function behaves incorrectly if it is called with both parameters of value 256, the expected results should be [1, 0] while [0, 256] are returned.

This small difference makes base45 (or Python base45) return a different byte array in some cases.

dirkx commented 3 years ago

Yup - you are right(funny that SM behaves normal). Lovely - thanks for the fix !

pp-ps commented 3 years ago

Thx @dirkx, would this be available in npm? I know I might be pointing to a different repo, but pkg base45-js 1.0.1 has this logic.