3

Python code

from base64 import b85decode
from base64 import b85encode
encoded=b85encode(b'Hello, world!!!!')
print(encoded.decode('utf-8'))

Output:

'NM&qnZ!92pZ*pv8At50l'

Dart code

import 'dart:io';
import 'dart:typed_data';
import 'package:base85/base85.dart';

void main() {
  var codec = Base85Codec(Alphabets.z85);
  var encode = codec.encode(Uint8List.fromList('Hello, world!!!!'.codeUnits));
  print(encode);
}

Output:

nm=QNz.92Pz/PV8aT50L

Letter case is swapped between upper and lower, and non-letters are also mapped differently.

I may be missing something.

Boann
  • 48,794
  • 16
  • 117
  • 146
Sumit Kumar
  • 678
  • 4
  • 19

1 Answers1

3

Because you are not actually using ascii85 in the dart example at all. Compare this (requires pip install pyzmq*):

from zmq.utils import z85
z85.encode(b"Hello, world!!!!")
#  b'nm=QNz.92Pz/PV8aT50L'

z85 and ascii85 are subtly different.

*pip show zmq reveals: Summary: You are probably looking for pyzmq... Requires: pyzmq. Thanks to @SumitKumar for the catch.

References:

https://rfc.zeromq.org/spec/32/

2e0byo
  • 5,305
  • 1
  • 6
  • 26