bitcoinj / bitcoinj/bitcoinj

Replace remaining usages of Guava's `BaseEncoding`

Open
#3,982 8 comments 0 reactions 0 assignees View on GitHub
Enhancement good first issue Guava
Dominant language
Java
Stars
5.2k
Forks
2.6k
Avg merge
10h 56m
Merged PRs (30d)
18

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](https://downloads.bouncycastle.org/java/docs/bcprov-jdk15to18-javadoc/org/bouncycastle/util/encoders/Base32.html) -- see PR #4012
* `BaseEncoding.base64()` -- can be replaced with ~~Bouncy Castle [Base64](https://downloads.bouncycastle.org/java/docs/bcprov-jdk15to18-javadoc/org/bouncycastle/util/encoders/Base64.html)~~ update: we should use [java.util.Base64](https://docs.oracle.com/javase/8/docs/api/java/util/Base64.html) -- 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](https://developer.android.com/reference/java/util/Base64)

Contributor guide

Open the contributing guide

Research direction

Search the repository for remaining usages of Guava's BaseEncoding, then review PRs #4011, #4012, and #4017 for the intended replacements. Implement the Base32 and Base64 compatibility methods in org.bitcoinj.core.internal.BaseUtils and handle base16 with ByteUtils; done means all remaining BaseEncoding usages are migrated without changing behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.