If anyone knows how I could encrypt the data in chunks, I'd appreciate the help since I don't know much about Python.
I almost managed to fix this, except I don't know how to circumvent the pkgcrypt function encrypting all of the data at once. The one downside to using this script is that it reads every file into memory at once, causing issues when trying to create large packages. To install to any other path, just recreate the directory structure on the PS3 in the custom folder. To create a PKG that installs to flash, you must create a directory in the custom folder named dev_blind, not dev_flash. On OFW dev_flash will not be mounted, so you will have to mount dev_flash to dev_blind using one of the PS3Xploit tools. I'm not using psn_package_npdrm.exe for this as installing to flash doesn't work when using it (even though multiple sources says it does) and it creates a blank icon on the XMB. Using PKG script I managed to find a way to install files to the PS3's root directory, so now you can install files to anywhere you want.