in reply to Convenient Crypto

Sometime ago it occured to me that the CoreModule Digest::SHA could be used to en/decrypt data.

What? No. And don't invent your own encryption.

It takes two lines of code to encrypt and decrypt properly.

use Crypt::CBC qw( ); my $cipher = Crypt::CBC->new( -cipher => 'Blowfish', -key => 'my secret key', ); my $ciphertext = $cipher->encrypt("This data is hush hush"); my $plaintext = $cipher->decrypt($ciphertext);

Crypt::CBC

Replies are listed 'Best First'.
Re^2: Convenient Crypto
by Anonymous Monk on Feb 04, 2011 at 18:42 UTC
    Isn't in core dist.
      Neither is the module that was posted. What's your point?
        Let me explain a little background. In an embedded device exists perl as a means for reliable memory management and possibility to fix bugs remotely. As a "security" (against reverse engineering) the policy is only to run from internal mem. There are three blocks (1536 bytes) available that I try to use for encrypting a database (tied hash) on external mem as a more real means of security. SHA is available because "auth the updates". Blowfish alone is more than 3 blocks.

        Sorry about the missing blanks, but I forgot to "ungolf" this.