in reply to Re: Re: Re: Encrypting a Filename
in thread Encrypting a Filename

The timestamp is not the problem. The timestamp on the tar will naturally work just as well, anyway, without having to reset it. The problem is with the filename. If it is not 1-to-1, then it will have to open the file to check the original file name, to be sure it has the right one.

—John

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: Encrypting a Filename
by petdance (Parson) on Jun 15, 2001 at 23:02 UTC
    So give the tar the one-way crypted version of the real filename. As in, roughly:
    my $timestamp = timestamp_of( $innerfile ); my $tarname = crypt( $innerfile, $innerfile ) . ".tar"; $tarname = substr( $tarname, 2 ); system( 'tar $tarname cvf $innerfile' ); touch( $tar, $timestamp );
    The crypted filename will always be the same thing. So foo.txt will always create the same .tar file.

    Also, you'll want to drop the first 2 chars of the crypted filename, because they are the salt, which in this case is the first two letters of the inner filename.

    xoxo,
    Andy

    %_=split/;/,".;;n;u;e;ot;t;her;c; ".   #   Andy Lester
    'Perl ;@; a;a;j;m;er;y;t;p;n;d;s;o;'.  #   http://petdance.com
    "hack";print map delete$_{$_},split//,q<   andy@petdance.com   >
    
      If the real original filename is inside the file, then I agree a one-way mapping is OK, since the feature of "restore this directory" can be implemented by opening each backup file and checking the original name

      Is crypt going to generate a unique one-way mapping? If so, I don't see why that's any better than just using a 2-way function. If not, then it still has the problem of needing to open the file before overcopying to make sure it's the right one, giving disambiguating suffixes to the name, and searching for a base name with the right suffix.

      —John