The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.


Module::CryptSource - Encrypt and Decrypt source for Binary Packagers



    use Module::CryptSource;


    % perl --ensrc
    % perlapp -f      # or perl2exe
    % myprog.exe --desrc


One of the problems in binary packages such as perlapp or perl2exe is the difficulty of uncovering the source code. While it can be argued that obscuring source code may be necessary in some environments, it could be disastrous when you accidentally lose the source code.

This self-modifying module let you specify a key to encrypted source code and modules, so you can use that key to retrieve them back.

To use this module, simply put use Module::CryptSource; in all scripts and modules you wish to encrypt. Run it once with the --ensrc option before running perlapp or perl2exe, so it can store the modified Module/ along with your .exe file; copies of encrypted source files will be stored in the Module/ file.

Run the resulting executable with --desrc to decrypt the source files back.


Storable, Crypt::Rijndael and Term::ReadKey are three XS modules you'll have to install it yourself. It's probably possible to use Crypt::Rijndael_PP and Win32::* as alternatives, but I don't have the motivation to investigate yet.

If user enters a wrong decryption key, chances are that the unpack('N/a*') will report an Out of memory! error.


Autrijus Tang <>


Copyright 2001, 2002 by Autrijus Tang <>.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.