bitcoinj/bitcoinj

Replace remaining usages of Guava's `BaseEncoding`

Open

#3982 opened on Jan 5, 2026

View on GitHub
 (8 comments) (0 reactions) (0 assignees)Java (4,687 stars) (2,509 forks)batch import
EnhancementGuavagood first issue

Description

As of today we are using:

  • BaseEncoding.base16() -- can be replaced with our existing ByteUtils methods: formatHex and parseHex -- see PR #4011
  • BaseEncoding.base32() -- can be replaced with Bouncy Castle Base32 -- see PR #4012
  • BaseEncoding.base64() -- can be replaced with Bouncy Castle Base64 update: we should use java.util.Base64 -- see PR #4017

This helps implement Issue #2105 and although we want to also migrate away from Bouncy Castle (Issue #3912) migrating away from Guava is a short-term goal so I think it is OK to use Bouncy Castle (for now) to achieve it.

Update: for the Base32 and Base64 implementations, create methods that are identical (or very similar) to the Guava methods and place them in a class named BaseUtils in org.bitcoinj.core.internal.

I would also recommend doing this as a series of 3 PRs: one each for base16, base32, and base64.

Update: it looks like we can use java.util.Base64 as it is available in both Java 8 and Android API 26 (Android 8.0) -- see Android reference documentation: java.util.Base64

Contributor guide