Class Hash


  • public class Hash
    extends Object
    • Field Detail

      • SIGHASH_ALL

        public static final Int SIGHASH_ALL
        Constant SIGHASH_ALL
      • SIGHASH_NONE

        public static final Int SIGHASH_NONE
        Constant SIGHASH_NONE
      • SIGHASH_SINGLE

        public static final Int SIGHASH_SINGLE
        Constant SIGHASH_SINGLE
    • Method Detail

      • sha1

        public static byte[] sha1​(byte[] bytes)

        sha1.

        Parameters:
        bytes - an array of byte objects
        Returns:
        an array of byte objects
      • getDigestSha256

        public static MessageDigest getDigestSha256()
      • sha256

        public static byte[] sha256​(byte[] bytes)

        sha256.

        Parameters:
        bytes - an array of byte objects
        Returns:
        an array of byte objects
      • hash160

        public static byte[] hash160​(byte[] bytes)
        sha256 followed by ripemd160
        Parameters:
        bytes - an array of byte objects
        Returns:
        an array of byte objects
      • hash256

        public static byte[] hash256​(byte[] bytes)
        two rounds of sha256
        Parameters:
        bytes - an array of byte objects
        Returns:
        an array of byte objects
      • hash256

        public static byte[] hash256​(MessageDigest digest,
                                     byte[] bytes)
      • hmacS256Init

        public static Mac hmacS256Init​(byte[] key)

        hmacS256Init.

        Parameters:
        key - an array of byte objects
        Returns:
        a Mac object
      • hmacS512Init

        public static Mac hmacS512Init​(byte[] key)

        hmacS512Init.

        Parameters:
        key - an array of byte objects
        Returns:
        a Mac object
      • taggedHash

        public static byte[] taggedHash​(String tag,
                                        byte[] msg)