Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I found this cool little script on Usenet that encrypts Perl code. It works really well, as I tested it out on several scripts. My question... Is encrypted code such as this script produces portable, or are there any dependency issues?
Here is the script that does the encryption...
#! /usr/bin/perl -w # Copyright (c) 1998 Greg Bacon. All Rights Reserved. # This program is free software. You may distribute it or modify # it (perhaps both) under the terms of the Artistic License that # comes with the Perl Kit. use strict; use integer; foreach my $file (@ARGV) { unless (open FILE, $file) { warn "$0: failed open $file: $!\n"; next; } my $key = int rand 256; my $out = <<EOTop; #! /usr/bin/perl my \$prog = ''; { my \$key = $key; local \$/; \$prog = pack "c*", map { \$_ ^= \$key } unpack "c*", <DATA>; } eval \$prog; __END__ EOTop while (<FILE>) { $out .= pack "c*", map { $_ ^= $key } unpack "c*", $_; } close FILE; unless (open FILE, ">$file") { warn "$0: failed open >$file: $!\n"; next; } print FILE $out; close FILE;; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: encryption portability?
by thraxil (Prior) on Apr 17, 2002 at 14:54 UTC | |
|
Re: encryption portability?
by tachyon (Chancellor) on Apr 17, 2002 at 15:09 UTC | |
by jsprat (Curate) on Apr 17, 2002 at 16:33 UTC | |
|
Re: encryption portability?
by kappa (Chaplain) on Apr 17, 2002 at 14:56 UTC | |
|
(smitz)Re: encryption portability?
by smitz (Chaplain) on Apr 17, 2002 at 14:54 UTC | |
by Anonymous Monk on Apr 17, 2002 at 17:51 UTC | |
by smitz (Chaplain) on Apr 17, 2002 at 21:29 UTC |