Class Base58Provider

java.lang.Object
org.miaixz.bus.core.codec.binary.provider.Base58Provider
All Implemented Interfaces:
Serializable, Decoder<CharSequence,byte[]>, Encoder<byte[],String>

public class Base58Provider extends Object implements Encoder<byte[],String>, Decoder<CharSequence,byte[]>, Serializable
Base58编码器 此编码器不包括校验码、版本等信息
Since:
Java 17+
Author:
Kimi Liu
See Also:
  • Field Details

  • Constructor Details

    • Base58Provider

      public Base58Provider()
  • Method Details

    • divmod

      public static byte divmod(byte[] number, int firstDigit, int base, int divisor)
      Divides a number, represented as an array of bytes each containing a single digit in the specified base, by the given divisor. The given number is modified in-place to contain the quotient, and the return value is the remainder.
      Parameters:
      number - the number to divide
      firstDigit - the index within the array of the first non-zero digit (this is used for optimization by skipping the leading zeros)
      base - the base in which the number's digits are represented (up to 256)
      divisor - the number to divide by (up to 256)
      Returns:
      the remainder of the division operation
    • encode

      public String encode(byte[] data)
      Base58编码
      Specified by:
      encode in interface Encoder<byte[],String>
      Parameters:
      data - 被编码的数据,不带校验和。
      Returns:
      编码后的字符串
    • decode

      public byte[] decode(CharSequence encoded) throws IllegalArgumentException
      解码给定的Base58字符串
      Specified by:
      decode in interface Decoder<CharSequence,byte[]>
      Parameters:
      encoded - Base58编码字符串
      Returns:
      解码后的bytes
      Throws:
      IllegalArgumentException - 非标准Base58字符串