Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6359111
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:28:32+00:00 2026-05-24T23:28:32+00:00

How do I reversibly (symmetrically) encrypt a filename (with or without directory path, I’m

  • 0

How do I reversibly (symmetrically) encrypt a filename (with or
without directory path, I’m OK w/ either) so that the result is also a
valid filename (less than 64 characters [or whatever the limit is], no
funny characters, ideally no spaces [but not a requirement], etc)?

Googling finds only filename encryption algorithms where the result is
a long string of binary characters (using MIME64, converting to
non-binary is easy, but this just makes the filename longer) and/or
non-symmetric one-way encrption schemes (eg, salted MD5, SHA1, DES,
etc). I don’t want to store a table of hashes: I want to decrypt the
filename with a simple key I’ve memorized.

My own attempts with things like “mcrypt -b” failed too: the resulting
output (even before converting to ASCII) grows in size very rapidly as
the filename and key length increase.

Reasoning: I plan to use an “infinite backup” service (like mozy,
blazebackup, etc), but none encrypt filenames (just file
content). I’ll create a directory that consists of encrypted filenames
with symlinks (or even hard links) to the real file. I’ll back up only
that directory (and choose my own private key), and have
filename-encrypted and filecontent-encrypted backups.

EDIT: Petey’s method worked like a charm!

# "-b 512" yields "Bits has bad value 512 (too small)" 
ssh-keygen -t rsa -b 768 -f /tmp/test.rsa 
echo "thisisareallylongfilenameknightswhosayniioratleastusedto" |\ 
 openssl rsautl -inkey /tmp/test.rsa -encrypt | base64 |\ 
 perl -0777 -pnle 's/\//-/isg;s/\n//isg' 

yields a 130 character result that should always be a filename!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T23:28:33+00:00Added an answer on May 24, 2026 at 11:28 pm

    You could use an RSA key pair to do this. Generate an rsa key pair plus certificate, then import that into your cert store. Use the public key to encrypt your file name, then base64 encode the result. The maximum file name length for ntfs is 255 characters, so a 1024 bit RSA key should be fine, if you need shorter file names, use a 512 bit key. When you want to decrypt the file name: base64 decode the encrypted file name, then use the private key to decrypt back to the actual file name.

    Not sure if there is any freeware available to do this. If you don’t want to write the program yourself, I’ll do it in .Net for you (for a small fee ;).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a simple algorithm to encrypt integers? That is, a function E(i,k) that
I'd like to build a custom StackPanel with a ReverseOrder property that I can
Edit: I have since found and published an efficient and elegant solution that transforms
I need to write a function that takes 4 bytes as input, performs a
What are some platform-specific API's that web browsers use to securely save passwords with
So I need to generate a code that can be tied to a specific
Does anyone out there know about examples and the theory behind parsers that will
Often you have something like an Applicative without pure , or something like a
GDB has a new version out that supports reverse debug (see http://www.gnu.org/software/gdb/news/reversible.html ). I
I want to encrypt some info for a licensing system and I want the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.