Class SHA

java.lang.Object
com.anlavn.hash.SHA

public class SHA extends Object
The SHA256 class only supports object encryption, decryption it is impossible. SHA256 uses the Secure Hash Algorithm 2 cryptographic hash function designed by the US National Security Agency with a 256-bit long hash value.
Make sure your object class was "implements Serializable".
  • Constructor Details

    • SHA

      public SHA()
  • Method Details

    • Encrypt

      public static final String Encrypt(SHA.Types type, Object objToEncrypt)
      Use this method to encrypt the original object.
      Parameters:
      type - is the type in SHA Family use to encrypt.
      objToEncrypt - is the object need encrypt.
      Returns:
      a SHA256 hash code of the original object.
    • Encrypt

      public static final String Encrypt(SHA.Types type, String strToEncrypt)
      Use this method to encrypt the original string.
      Parameters:
      type - is the type in SHA Family use to encrypt.
      strToEncrypt - is the string need encrypt.
      Returns:
      a SHA256 hash code of the original string.