The legacy format v3 encodes the JSON with base64_urlsafe with the prefix cashuA.
The v4 format uses smaller JSON keys and adds CBOR (converts the JSON to binary) then encodes as base64_urlsafe with the prefix cashuB.
This results in smaller sized tokens.
The prefix was my suggestion to make the difference both human and machine readable, iirc.
For more info:
