0

Will using one type of encoder, to encode a binary message to base64(like the default one with jvm) and another(like apache commons codec) to decode this string to binary affect consistency of results? Or the type of encoders/decoders don't matter?

Vivek Agarwal
  • 301
  • 1
  • 2
  • 8
  • There are only 2 characters you would ever need to replace, and that can be done easily with RegEx. The key is to determine if the codec is web compliant. – vandench Aug 13 '18 at 17:03

1 Answers1

1

It doesn't matter. Base64 is a standard. Any compliant implementation will produce the same results.

  • There are actually 2 standards one of which is web compliant. The other is not because it uses `/`. – vandench Aug 13 '18 at 17:04
  • @vandench which two characters for the non web compliant, do one needs to replace? replace with what? any documentation for these two standards? – Vivek Agarwal Aug 13 '18 at 17:48
  • This shows the differences. https://gist.github.com/geraintluff/21beb1066fc5239304aa – vandench Aug 13 '18 at 18:04
  • Yeah thanks @vandench wikipedia page lists some base64 standards.. JVM's Base64 class has 3 different encoders for 3 different standards including UrlEncoder which uses the web-safe base64 standard https://docs.oracle.com/javase/8/docs/api/java/util/Base64.html – Vivek Agarwal Aug 13 '18 at 20:11