Skip to content

Decoded value is not same as encoded one #3

Open
@raziel057

Description

Hello,

I notice that your code is not working correctly in some cases. For example here:

var test = new Uint8Array([120,156,75,244,51,201,14,14,45,9,41,203,1,0,18,222,3,161]);
console.log('Original text:  ' + test.toString());
test = base45.encode(test)
console.log('Base45 encoded: ' + test);
test = base45.decode(test)
console.log('Base45 decoded: ' + test);

Produce the following log:

Original text:  120,156,75,244,51,201,14,14,45,9,41,203,1,0,18,222,3,161
Base45 encoded: 6BF4R9RO6/Y19V5YC5V50FH2TK0
Base45 decoded: 120,156,75,244,51,201,14,14,45,9,41,203,0,256,18,222,3,161

Is it normal that the decoded Uint8Array is not equals to the one provided for encode ?

Please note that the decoded Uint8Array generates an error when using zlib.inflate() function from https://github.com/nodeca/pako, but not the original one:

zlib.inflate(new Uint8Array([120,156,75,244,51,201,14,14,45,9,41,203,0,256,18,222,3,161]))
node_modules\pako\lib\inflate.js:384
  if (inflator.err) throw inflator.msg || msg[inflator.err];
                    ^
incorrect data check

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions