6

I am using Moar. It is possible to create perl6 executables now?

I have source codes developed on machineA and I want to run it on machineB which is about 3 times faster than machineA, but I don't want people on machineB to be able to look at the source codes.

Or do I have to change to Java VM?

If it is not possible to create perl6 executables, what is the best way to protect company/department intellectual properties?

halfer
  • 19,824
  • 17
  • 99
  • 186
lisprogtor
  • 5,677
  • 11
  • 17
  • 2
    I think ["there's not a way to do that yet"](https://stackoverflow.com/questions/27178599/how-can-i-compile-perl6-file-to-exe#comment42910261_27178599) (from 2014) is still applicable and so is ["I'm not aware of any blockers stopping someone from taking a shot at implementing this"](https://stackoverflow.com/questions/34663117/how-do-i-create-a-stand-alone-executable-with-perl-6#comment80650174_34664816) (from 2017). Perhaps some company wanting this could put up a bounty to motivate someone to make it happen? I don't know whether it would adequately protect "intellectual property". – raiph Jan 07 '19 at 00:33
  • Thank you raiph !!! I guess I will just have to wait. Thanks !!! – lisprogtor Jan 07 '19 at 06:42
  • I'm wondering if getting some tooling for building Perl6 snaps might be worth trying. https://snapcraft.io/ – Scimon Proctor Jan 07 '19 at 12:16

1 Answers1

4

For simple stuff and if you are running it by your own hand on machineB, you may try to decrypt the source within your program or to STDOUT and then feed it to perl6. There are many options for encryption and decryption, for example, one-time pad, gpg or even read things off securely via sockets at machineA. Here is a proof of concept example using zip and unzip,

cat my.p6
for 1 .. 5 { say rand }
zip -e my.zip my.p6
Enter password:
Verify password:
adding: my.p6 (stored 0%)
unzip -p my.zip | perl6
[my.zip] my.p6 password:
0.6868457931159548
0.3818693072902063
0.26339483730150215
0.03617574596367301
0.1992317319783774

As for doing encryption with one-time pad on shell level, a script (requires openssl and ssh) will be used,

./sshencdec.sh -p ~/.ssh/id_rsa.pub < my.p6 > my.p6.enc
./sshencdec.sh -s ~/.ssh/id_rsa  < my.p6.enc | perl6
Enter pass phrase for /home/david/.ssh/id_rsa:
0.4554567534399926
0.5215978159072545
0.5188661477620019
0.4928945548121154
0.2916414959794953
cat my.p6.enc
-- encrypted with https://git.e.tern.al/s2/sshencdec
-- keys
-- key
M32P8T5hAbkozzu9Hsb0UxaHMIowBnm5SGya1JdVRKM85NrsmMaO+JVICdpNCACu
0onf3xIDIdl6IRiLRmbrrG2qOHqYSqHXLLs4Yt7530IvGiDyxpGeygJwt35+PZ4T
KH6FMluenkvkHufsY1xRC2PM8kzQ0xtx9ThVNkupQavVN3SOHaMxVFZUqJCuInFl
Y8e6iMyoF7NfQ4ekUwOtpJtFjB5DzMepxg+iAetTV2E2kwAq5qUTrmkzSTd38b+X
YzdeYmngMjBPzMZ/nrBT4cE2kAYyIGUwTDMa5UsClUUBBAN6Igfxn5O6ozlq9FXk
IIujhfgAn64U2DfcYHCZ2w==
-- /key
-- /keys
U2FsdGVkX18ObEPup0W1+45UewyKoUftMzn+dUDRQp9mDCzJ0/7cVYTe6zNJINIU

So behind the scenes the flow goes like this,

  • encrypt the SECRET to SECRET.enc with a PAD using a strong cipher (the script used AES 256)
  • protect the PAD with asymmetric encryption to produce PAD.enc ( SSH + RSA in this case)
  • Now you will need SECRET.enc, PAD.enc and the private key pass phrase to perform the needful decryption (the script conveniently merge the first two into a single file)

This is useful when you need to share your file (using others public key as long as you can figure out the safe key exchange part)

As for in program operations, AFAIK there isn't any module similar to this in the ecosystems yet, but then you may draw idea from here to build your own helper class/module.

hkdtam
  • 341
  • 1
  • 8
  • Smart! Thank you very much hkdtam!!! I will do a little configuring with the parameters and the interactive part and then I think I will be good to go. Thanks!!! – lisprogtor Jan 09 '19 at 06:58
  • brilliant! hkdtam , i liked the idea could you show example of using one-time pad if possible? – jsor Jan 13 '19 at 23:44