Crypt-JS Encode possibly using createCipheriv?

I'd be happy to send a few bucks to someone if they could help with a task I've been given. I'm hoping I can use the Javascript library Crypto-JS and not the NodeJS version since I'll be using a client browser.

I need to include the correct scripts and perform the following:

The token will be constructed as a set of key=value pairs separated by a semicolon (;), the resultant string will be encrypted with AES and a pre-shared secret key, the resultant output will then be converted into a string with HEX character encoding.

The following AES cipher attributes should be used to construct the token: - Rijndael cipher - Electronic Code Book mode (ECB) - No built in padding (such as PKCS) - Resultant encrypted buffer should be manually padded with spaces to achieve the total length a multiple of 32. That is: length(encrypted padded string) mod 32 = 0 For example, instantiate the cipher and initialize it using Java standard SunJCE cryptological library the code would contain: Cipher cipher = Cipher.getInstance("Rijndael/ECB/NoPadding", "SunJCE");

I've found some code that I thought was getting me close, but I can't figure out which script to include so that createCipheriv is available.

function encrypt(data,key) {
    var cipher = crypto.createCipheriv('aes-128-ecb', key,''); //create aes-128 cipher 
    var encrypted = cipher.update(data,'utf8', 'hex'); //output as hex
    return encrypted;
}

function padRightTo32(str) { // ensure block size of 32

    len=str.length;
    for(i=len; i%32>0; i++) {
        str=str +" ";
    }
    return str;
}