How to do encryption/decyption using crypto js in ionic4?

I am trouble, how to do encryption/decyption using crypto js in ionic4?

I have written code for encryption decryption in java

public static String encrypt(String str) 
{
    String encryptedString = str;

    try {
        byte[] utf8 = str.getBytes("UTF8");
        byte[] enc = encryptor.doFinal(utf8);
        encryptedString = Base64.encodeBase64URLSafeString(enc);
    } catch (Exception e) {
        e.printStackTrace();
    }
    return encryptedString;
}

For decryption

public static String decrypt(String str) 
{
    String decryptedString = "";        
    try {
        byte[] dec = Base64.decodeBase64(str);
        byte[] utf8 = decryptor.doFinal(dec);
        decryptedString = new String(utf8, "UTF8");
    } catch (Exception e) {
        e.printStackTrace();
    } 
    return decryptedString;
}

Secrete key generation

public static void genKeyPair(int i)    {
    try {
        // generates DES key from string //
        key = new SecretKeySpec(Skey.getBytes(), "DES");

        // initialize the cipher with key //
        encryptor = Cipher.getInstance("DES");
        decryptor = Cipher.getInstance("DES");
        encryptor.init(Cipher.ENCRYPT_MODE, key);
        decryptor.init(Cipher.DECRYPT_MODE, key);

        System.err.println(java.util.Base64.getEncoder().encodeToString(key.getEncoded()));
    } catch (Exception e) {
        e.printStackTrace();
    }
}

I want to write same thing in ionic4, how to do plz help me. I am new in ionic4(Hybrid application)

Source: New feed
Source Url How to do encryption/decyption using crypto js in ionic4?