← 返回首页
DigestUtils: use Base64, not DatatypeConverter · scijava/scijava-common@06f52db · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

Commit 06f52db

Browse files
committed
DigestUtils: use Base64, not DatatypeConverter
Unlike java.util.Base64, the DatatypeConverter class is in the javax.xml.bind package, which is not part of java.base.
1 parent 9960d51 commit 06f52db

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

‎src/main/java/org/scijava/util/DigestUtils.java‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@
3232
import java.io.UnsupportedEncodingException;
3333
import java.security.MessageDigest;
3434
import java.security.NoSuchAlgorithmException;
35-
36-
import javax.xml.bind.DatatypeConverter;
35+
import java.util.Base64;
3736

3837
/**
3938
* Utility class for computing cryptographic hashes.
@@ -98,7 +97,7 @@ public static String hex(final byte[] bytes) {
9897

9998
/** Converts the given byte array to a base64 string. */
10099
public static String base64(final byte[] bytes) {
101-
return DatatypeConverter.printBase64Binary(bytes);
100+
return new String(Base64.getEncoder().encode(bytes));
102101
}
103102

104103
/**

0 commit comments

Comments
 (0)

Footer

© 2026 GitHub, Inc.