in reply to best way to encrypt long file names?

Are you trying to encrypt or hash the filenames? Crypt is a one-way hash function (despite the name).

You could use something like Crypt::CBC and pump all your filenames through it. This is particularly desirable if you'd like to be able to recover the filenames again later.

use strict; use warnings; my $cbc = Crypt::CBC->new( -header=>"randomiv", -key => 'my secret key +', -cipher => 'Blowfish' ); my $enc = $cbc->encrypt_hex("filename"); # recoverable hex phrase

-Paul

Replies are listed 'Best First'.
Re^2: best way to encrypt long file names?
by keiusui (Monk) on May 28, 2009 at 02:45 UTC
    Thank you so much for telling me about Crypt::CBC. It looks like this module would work great for encrypting strings, files and other data.

    However, the resulting encrypted strings are something like "Salted__8u,ZrXf69 B#". This would be fine if I was working with data, but this is not good for filenames.

    Thanks again for your help. I'm sure Crypt::CBC will come in handy in the near future.

      Why is it "not good?" Looks like you're not using encrypt_hex.
      Hence the reason my example uses encrypt_hex() ... There are many other ways to move from the binary bits to something suitable to your filesystem, but encrypt_hex is built in and easy...

      -Paul