public static String decrypt(String data, String key) {
        try {
            Cipher c = Cipher.getInstance("DES/ECB/PKCS5Padding");
            c.init(Cipher.DECRYPT_MODE, SecretKeyFactory.getInstance("DES").generateSecret(new DESKeySpec(key.getBytes())));
            return new String(c.doFinal(Hex.decodeHex(data.toCharArray())), Charset.defaultCharset());
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
public static String decrypt(String data, String key) {
        try {
            Cipher c = Cipher.getInstance("DES/ECB/PKCS5Padding");
            c.init(Cipher.DECRYPT_MODE, SecretKeyFactory.getInstance("DES").generateSecret(new DESKeySpec(key.getBytes())));
            return new String(c.doFinal(Hex.decodeHex(data.toCharArray())), Charset.defaultCharset());
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
public static String decrypt ( String data , String key ) { try { Cipher c = Cipher . getInstance ( "DES/ECB/PKCS5Padding" ) ; c . init ( Cipher . DECRYPT_MODE , SecretKeyFactory . getInstance ( "DES" ) . generateSecret ( new DESKeySpec ( key . getBytes ( ) ) ) ) ; return new String ( c . doFinal ( Hex . decodeHex ( data . toCharArray ( ) ) ) , Charset . defaultCharset ( ) ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } return null ; }
Convert encrypted hex string to UTF-8 string
@param data data to decrypt
@param key decrypt key
@return UTF-8 string
Convert encrypted hex string to UTF - 8 string