com.ibm.crypto.fips.provider

Class SHA3

  • java.lang.Object
    • java.security.MessageDigestSpi
      • com.ibm.crypto.fips.provider.SHA3
  • All Implemented Interfaces:
    java.lang.Cloneable


    public final class SHA3
    extends java.security.MessageDigestSpi
    implements java.lang.Cloneable
    This class implements the Secure Hash Algorithm 3 (SHA-3) developed by the National Institute of Standards and Technology along with the National Security Agency. SHA-3 is defined in the same exact manner as as SHA-5, with 2 exceptions: 1. The initial hash value is different (see code below) 2. The 384-bit message digest is obtained by truncating the final hash value to it's left-most 384 bits.
    • Constructor Summary

      Constructors 
      Constructor and Description
      SHA3()
      Standard constructor, creates a new SHA3 instance, allocates its buffers from the heap.
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      java.lang.Object clone()
      Clones this object.
      protected byte[] engineDigest()
      Compute the final hash and reset the engine so that it is ready for re-use, as specifed by MessageDigest.
      protected int engineDigest(byte[] buf, int offset, int len)
      Compute the final hash and reset the engine so that it is ready for re-use, as specifed by MessageDigest.
      protected int engineGetDigestLength()
      Return the digest length in bytes
      protected void engineReset() 
      protected void engineUpdate(byte b)
      Update adds the passed byte to the digested data.
      protected void engineUpdate(byte[] input, int offset, int len)
      Update adds the selected part of an array of bytes to the digest.
      void init()
      Initialize the SHA3 information
      java.lang.Object internalClone()
      Clones this object.
      protected byte[] internalDigest()
      Compute the final hash and reset the engine so that it is ready for re-use, as specifed by MessageDigest.
      protected int internalDigest(byte[] buf, int offset, int len)
      Compute the final hash and reset the engine so that it is ready for re-use, as specifed by MessageDigest.
      protected int internalGetDigestLength()
      Return the digest length in bytes
      void internalInit()
      Initialize the SHA3 information
      protected void internalReset() 
      protected void internalUpdate(byte b)
      Update adds the passed byte to the digested data.
      protected void internalUpdate(byte[] input, int offset, int len)
      Update adds the selected part of an array of bytes to the digest.
      • Methods inherited from class java.security.MessageDigestSpi

        engineUpdate
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SHA3

        public SHA3()
        Standard constructor, creates a new SHA3 instance, allocates its buffers from the heap.
    • Method Detail

      • init

        public void init()
        Initialize the SHA3 information
        Throws:
        FIPSRuntimeException - if SelfTest.isFipsRunnable returns false.
      • internalInit

        public void internalInit()
        Initialize the SHA3 information
      • engineReset

        protected void engineReset()
        Specified by:
        engineReset in class java.security.MessageDigestSpi
        Throws:
        FIPSRuntimeException - if SelfTest.isFipsRunnable returns false.
      • internalReset

        protected void internalReset()
      • engineGetDigestLength

        protected int engineGetDigestLength()
        Return the digest length in bytes
        Overrides:
        engineGetDigestLength in class java.security.MessageDigestSpi
        Throws:
        FIPSRuntimeException - if SelfTest.isFipsRunnable returns false.
      • internalGetDigestLength

        protected int internalGetDigestLength()
        Return the digest length in bytes
      • engineUpdate

        protected void engineUpdate(byte b)
        Update adds the passed byte to the digested data.
        Specified by:
        engineUpdate in class java.security.MessageDigestSpi
        Throws:
        FIPSRuntimeException - if SelfTest.isFipsRunnable returns false.
      • internalUpdate

        protected void internalUpdate(byte b)
        Update adds the passed byte to the digested data.
      • engineUpdate

        protected void engineUpdate(byte[] input,
                        int offset,
                        int len)
        Update adds the selected part of an array of bytes to the digest. This version is more efficient than the byte-at-a-time version; * it avoids data copies and reduces per-byte call overhead.
        Specified by:
        engineUpdate in class java.security.MessageDigestSpi
        Throws:
        FIPSRuntimeException - if SelfTest.isFipsRunnable returns false.
      • internalUpdate

        protected void internalUpdate(byte[] input,
                          int offset,
                          int len)
        Update adds the selected part of an array of bytes to the digest. This version is more efficient than the byte-at-a-time version; it avoids data copies and reduces per-byte call overhead.
      • engineDigest

        protected byte[] engineDigest()
        Compute the final hash and reset the engine so that it is ready for re-use, as specifed by MessageDigest.
        Specified by:
        engineDigest in class java.security.MessageDigestSpi
        Throws:
        FIPSRuntimeException - if SelfTest.isFipsRunnable returns false.
      • internalDigest

        protected byte[] internalDigest()
        Compute the final hash and reset the engine so that it is ready for re-use, as specifed by MessageDigest.
      • engineDigest

        protected int engineDigest(byte[] buf,
                       int offset,
                       int len)
                            throws java.security.DigestException
        Compute the final hash and reset the engine so that it is ready for re-use, as specifed by MessageDigest.
        Overrides:
        engineDigest in class java.security.MessageDigestSpi
        Throws:
        FIPSRuntimeException - if SelfTest.isFipsRunnable returns false.
        java.security.DigestException
      • internalDigest

        protected int internalDigest(byte[] buf,
                         int offset,
                         int len)
                              throws java.security.DigestException
        Compute the final hash and reset the engine so that it is ready for re-use, as specifed by MessageDigest.
        Throws:
        java.security.DigestException
      • clone

        public java.lang.Object clone()
        Clones this object.
        Overrides:
        clone in class java.security.MessageDigestSpi
        Throws:
        FIPSRuntimeException - if SelfTest.isFipsRunnable returns false.
      • internalClone

        public java.lang.Object internalClone()
        Clones this object.
© Portions Copyright 2003, 2014, 2015, 2016 IBM Corporation. All rights reserved.
© Portions Copyright 2003, 2014 Oracle and/or its affiliates. All rights reserved.