Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Encrypting a Filename

by marcink (Monk)
on Jun 15, 2001 at 01:59 UTC ( [id://88646]=note: print w/replies, xml ) Need Help??


in reply to Encrypting a Filename

How about using something like <shamelessplug>this</shamelessplug>? ;-) It's very simple, but seems to do exactly what you need -- (en|de)cryption (after simple modification -- that implementation squashes all letters to lowercase) using alphabet permutation. The nice thing is that the result has the same length as before encryption.

-mk

Replies are listed 'Best First'.
Re-3: Encrypting a Filename
by John M. Dlugosz (Monsignor) on Jun 15, 2001 at 02:13 UTC
    I saw that, and supposed at the time it was a Perl implementation of the Vigenère cypher, probably because your chart was formatted as a square. Looking again now, it seems to be just a simple 8-way Ceasar cypher, which I guess is the same in principle with a 8-character password built-in rather than allowing the user to supply a password.

    It will be trivially cracked. You can suppose that files end in ".exe" etc., and very often have dot as the 4th from the end character. Since the encoding rule depends on the mod-8 position, various length filenames will allow you to probe the cypher and get a few matches. From there you can pick out bits of words, and continue the process.

    Hmm, I wonder if the old Vigenère or other substitution cypher could be used in a chaining mode...?

    —John

      Well, I _did_ write it was a simple solution, didn't I? ;-)

      I like tye's suggestion, although increasing file name might mean exceeding filesystem's name length limit... Hmm... perhaps good ol' enigma?

      -mk
        I was just thinking on the drive home that I could implement the Vigenère cypher as a CUFP as a companion to your post.

        I also figured out how to use a stream cypher: treat the legal character set as a wheel, and use the output of a pseudorandom sequence (as set up initially with your key) as a count to shift the wheel. So even though the sequence produces numbers in the range 0..255, I can map that using modulo addition. That doesn't 'feedback' though, so I need to throw the current character into the sequence generator as it's encoded.

        I also wonder if RC4 can be trivially adapted to use an arbitrary sized alphabet.

        Using Enigma, generalized to any alphabet, is just plain cool, too!

        —John

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://88646]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2024-04-18 18:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found