base85 icon indicating copy to clipboard operation
base85 copied to clipboard

Encode returning false

Open ajmas opened this issue 7 years ago • 2 comments

I am running into an issue where base85.encode() is returning false. This is happening bother with a buffer and a text string. I am using Node 8.9.4.

For the text case:

base85.encode('hello world')

For the buffer it is one created by crypto.cipher

const iv = crypto.randomBytes(16);
const cipher = crypto.createCipheriv(algorithm, key, iv);
let encrypted = cipher.update(value, 'utf8');
encrypted = Buffer.concat([encrypted, cipher.final()]);

console.log(base85.encode(iv) + ',' + base85.encode(encrypted));

Here iv works fine, but not the encrypted buffer.

Note that 'ascii85' seems to work ok, but not 'z85'.

ajmas avatar Feb 25 '18 21:02 ajmas

Rereading the docs I now see this is a limitation of the z85 specification, though I am wondering whether throwing an exception would not be better, than returning false?

ajmas avatar Feb 25 '18 22:02 ajmas

This is super old, but I am experiencing this as well, and take it it hasn't been addressed - or a work around?

sigdavis avatar Sep 27 '22 13:09 sigdavis