Python Code
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
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
For alphabets, there is difference of uppercase and lowercase.
For non-alphabets a fix pattern of conversion is there.
It may happen that I am missing something.
CodePudding user response:
Because you are not actually using ascii85 in the dart example at all. Compare this (requires pip install zmq
):
from zmq.utils import z85
z85.encode(b"Hello, world!!!!")
# b'nm=QNz.92Pz/PV8aT50L'
z85 and ascii85 are subtly different.