encode uses instance encodeBase64 to keep things DRY.