Class BlowFishCrypt


  • public class BlowFishCrypt
    extends java.lang.Object
    Blowfish (Two-Way) Byte/String encryption
    • Constructor Summary

      Constructors 
      Constructor Description
      BlowFishCrypt​(byte[] key)
      Creates a new BlowFishCrypt object.
      BlowFishCrypt​(java.io.File keyFile)
      Creates a new BlowFishCrypt object.
      BlowFishCrypt​(javax.crypto.spec.SecretKeySpec secretKeySpec)
      Creates a new BlowFishCrypt object.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      byte[] decrypt​(byte[] bytes)
      Decrypt the byte array with the secret key.
      byte[] decrypt​(java.lang.String string)
      Decrypt the string with the secret key.
      byte[] encrypt​(byte[] bytes)
      Encrypt the byte array with the secret key.
      byte[] encrypt​(java.lang.String string)
      Encrypt the string with the secret key.
      static byte[] generateKey()  
      static void main​(java.lang.String[] args)  
      static boolean testKey​(byte[] key)  
      • Methods inherited from class java.lang.Object

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

      • BlowFishCrypt

        public BlowFishCrypt​(javax.crypto.spec.SecretKeySpec secretKeySpec)
        Creates a new BlowFishCrypt object.
        Parameters:
        secretKeySpec - A SecretKeySpec object.
      • BlowFishCrypt

        public BlowFishCrypt​(byte[] key)
        Creates a new BlowFishCrypt object.
        Parameters:
        key - An encoded secret key
      • BlowFishCrypt

        public BlowFishCrypt​(java.io.File keyFile)
        Creates a new BlowFishCrypt object.
        Parameters:
        keyFile - A file object containing the secret key as a String object.
    • Method Detail

      • encrypt

        public byte[] encrypt​(java.lang.String string)
        Encrypt the string with the secret key.
        Parameters:
        string - The string to encrypt.
      • decrypt

        public byte[] decrypt​(java.lang.String string)
        Decrypt the string with the secret key.
        Parameters:
        string - The string to decrypt.
      • encrypt

        public byte[] encrypt​(byte[] bytes)
        Encrypt the byte array with the secret key.
        Parameters:
        bytes - The array of bytes to encrypt.
      • decrypt

        public byte[] decrypt​(byte[] bytes)
        Decrypt the byte array with the secret key.
        Parameters:
        bytes - The array of bytes to decrypt.
      • generateKey

        public static byte[] generateKey()
                                  throws java.security.NoSuchAlgorithmException
        Throws:
        java.security.NoSuchAlgorithmException
      • testKey

        public static boolean testKey​(byte[] key)
      • main

        public static void main​(java.lang.String[] args)
                         throws java.lang.Exception
        Throws:
        java.lang.Exception