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 6824157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:52:07+00:00 2026-05-26T21:52:07+00:00

I get a possibly large number (UInt.MaxValue: 18446744073709551615) as a normal base10 number. This

  • 0

I get a possibly large number (UInt.MaxValue: 18446744073709551615) as a normal base10 number.
This number would eventually become a filename: 12345678945768.txt

Since filenames on Windows aren’t limited to just numerical digits, I would like to “compress” this in to a shorter string but need to make sure the strings can be mapped back to a number.

For smaller numbers: 0001365555, hexed is much shorter than anything else.
Everything I’ve found so far states that Base64 would be shortest, but it isn’t.

So far I’ve tried this:

//18446744073709551615 - 20
UInt64 i = UInt64.MaxValue; // 0001365555

//"//////////8=" - 12
string encoded = Convert.ToBase64String(BitConverter.GetBytes(i)); 

//"FFFFFFFFFFFFFFFF" - 16
string hexed = i.ToString("X"); 

//"MTg0NDY3NDQwNzM3MDk1NTE2MTU=" - 28
string utf = Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes(i.ToString())); 

Is there a better way to “compress” integer to convert similar to Hex but use 00-zz and not just 00-FF?

Thanks in advance!

  • 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-26T21:52:07+00:00Added an answer on May 26, 2026 at 9:52 pm

    Everything I’ve found so far states that Base64 would be shortest, but it isn’t.

    You don’t want to use Base64. Base64 encoded text can use the / character, which is disallowed in file names on Windows. You need to come up with something else.

    What else?

    Well, you could write your own base conversion, perhaps something like this:

    public static string Convert(ulong number)
    {
        var validCharacters = "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890!@#$%^&()_-";
        char[] charArray = validCharacters.ToCharArray();
        var buffer = new StringBuilder();
        var quotient = number;
        ulong remainder;
        while (quotient != 0)
        {
            remainder = quotient % (ulong)charArray.LongLength;
            quotient = quotient / (ulong)charArray.LongLength;
            buffer.Insert(0, charArray[remainder].ToString());
        }
        return buffer.ToString();
    }
    

    This is a “base-73” result, The more characters in validCharacters, the smaller the output will be. Feel free to add more, so long as they are legal characters in your file system.

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

Sidebar

Related Questions

I want to send a get request to twitter to return a large number
I have a large number of DIVs aligned like this: +---------------+ | DIV 1
I'm storing a (possibly large) number of objects in memory that I want to
The following event can possibly get called hundreds of times a frame. public bool
i'm trying to get more info in the nimbuzz protocol, and possibly find any
I would like to get all possible available currencies. Java 7 had provided such
I have a table with large number of rows(~200 million) and I want to
I am writing an application that reads in a large number of basic user
I have plenty of RAM, however, after starting and finishing a large number of
Context I have a very large number of small classes or structures . 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.