On 6/20/07, yitzle <[EMAIL PROTECTED]> wrote:
> Without more information about why you want to encrypt something we > can give no good advice; so here's some bad advice > > #!/usr/bin/perl > > use strict; > use warnings; > > my $plaintext = do { local $/ = undef; <> }; > my $pad = "X" x length $plaintext; > > my $encryptedtext = $plaintext ^ $pad; > my $decryptedtext = $encryptedtext ^ $pad; > print "plaintext:\n$plaintext\n\nencryptedtext:\n$encryptedtext\n\n", > "decryptedtext:\n$decryptedtext\n"; >I like it! I just need a simple way to encypt text to store in a text file. To protect sensitive info. Thanks
Please note that obscuring the text with xor* is less effective than using file permissions. If you are just trying to convince your boss that the information is "safe" then this might be an acceptable solution; however, the information is not safe. Any attacker could easily undo the encryption in a short period of time and if the attacker has access to the source code then he/she will be able to break it instantly. If there are legal reasons for encrypting the data, then this will not stand up in court as a reasonable attempt to secure the data. * unless you are using a truly randomly generated one-time-pad that is used once and then thrown away, in which case it is the strongest form of encryption. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
