Open raziel057 opened 3 years ago
Please note that if I REMOVE or ADD a single char from the JSON data I don't have issues anymore.
I just checked the following code:
for (i = 1; i<200; ++i) {
str = makeid(10);
console.log('String: ' + i + ' : ' + str);
str1 = zlib.deflate(str)
console.log('zlib deflated: ' + str1);
str1 = base45.encode(str1)
console.log('Base45 encoded: ' + str1);
str1 = base45.decode(str1)
console.log('Base45 decoded: ' + str1);
str2 = new TextDecoder().decode(zlib.inflate(str1))
console.log('String decoded: ' + str2);
}
And I got the following result:
String: 1 : wDuEjKdFGU
zlib deflated: 120,156,43,119,41,117,205,242,78,113,115,15,5,0,19,215,3,113
Base45 encoded: 6BFCM5%A5R1QB-9POEKS0*M2QJ0
Base45 decoded: x�+w)u��Nqs☼♣‼�♥q
String decoded: wDuEjKdFGU
String: 2 : 0mjW3BzyOG
zlib deflated: 120,156,51,200,205,10,55,118,170,170,244,119,7,0,18,36,3,93
Base45 encoded: 6BFQO6K-PN07+PLX+U$*09D26J0
Base45 decoded: x�3��
7v���w↕$♥]
String decoded: 0mjW3BzyOG
...
String: 10 : AfShJrTBTl
zlib deflated: 120,156,115,76,11,206,240,42,10,113,10,201,1,0,18,186,3,117
Base45 encoded: 6BF-PE7M1CGUIE1GG1V50OG2UJ0
Base45 decoded: x�sL♂��*
q
�↕�♥u
X:\workspace-dgc\ehn-sign-verify-javascript-trivial\node_modules\pako\lib\inflate.js:384
if (inflator.err) throw inflator.msg || msg[inflator.err];
^
incorrect data check
I don't have any problem is I comment the base45 encode / decode.
The issue comes from https://github.com/dirkx/base45-js/issues/3
Hello,
Sometimes we encounter an issue when inflating the compressed stream:
for example runing: npm run sign | tail -1 | npm run verify
With the following JSON gives this error: