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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:56:40+00:00 2026-05-24T03:56:40+00:00

Suppose I have String input = 1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,2,3,0,4,0,0,0,4,0,3; I want to encode it into a

  • 0

Suppose I have
String input = "1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,2,3,0,4,0,0,0,4,0,3";
I want to encode it into a string with less character and actually hides the actual information by representing it in roman character, IE. the above encodes to something like "Adqwqkjlhs". Must be able to decode to original string if given the encoded string.

The string input is actually something I parse from the hash of an URL, but the original format is lengthy and open to manipulation.

Any ideas?

Thanks

Edit #1
The number can be from 0 to 99, and each number is separate by a comma for String.split(“,”) to retrieve the String[]

Edit #2 (Purpose of encoded string)
Suppose the above string encodes to bmtwva1131gpefvb1xv, then I can have URL link like www.shortstring.com/input#bmtwva1131gpefvb1xv. From there I would decode bmtwva1131gpefvb1xv into comma separate numbers.

  • 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-24T03:56:41+00:00Added an answer on May 24, 2026 at 3:56 am

    Suggest you look at base64 which provides 6 bits of information per character — in general your encoding efficiency is log2(K) bits per symbol where K is the number of symbols in the set of allowable symbols.

    For 8-bit character set, many of these are impermissible in URLs, so you need to choose some subset that are legal URL characters.


    Just to clarify: I didn’t mean encode your “1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,2,3,0,4,0,0,0,4,0,3” string as base64 — I meant figure out what information you really want to encode, expressed as a string of raw binary bytes, and encode that in base64. It will exclude control characters (although you might want to use an alternate form where all 64 characters can be used in URLs without escaping) and be more efficient than converting numbers to a printable number form.


    The number can be from 0 to 99, and each number is separate by a comma for String.split(“,”) to retrieve the String[]

    OK, now you have a clear definition. Here’s a suggestion:

    Convert your information from its original form to a binary number / byte array. If all you have is a string of comma-separated numbers from 0-99, then here’s two options:

    • (slow) — treat as numbers in base 100, convert to a BigInteger (e.g. n = n * 100 + x[i] for each number x in the array), convert to a byte array, and be sure to precede the whole thing by its length, so that “0,0,0,0” can be distinguished from “0,0” (numerically equal in base 100 but it has a different length. Then convert the result to base64.

    • (more efficient) — treat as numbers in base 128 (since that is a power of 2), and use any number from 100-127 as a termination character. Each block of 6 numbers therefore contains 42 (=6*7) bits of information, which can be encoded as a string of 7 characters using base64. (Pad with termination characters as needed to reach an even multiple of 6 of the original numbers.)

    Because you have a potentially variable-length array of numbers as inputs, you need to encode the length somehow — either directly as a prefix, or indirectly by using a termination character.

    For the inverse algorithm, just reverse the steps and you’ll get an array of numbers from 0 to 99 — using either the prefixed length or termination character to determine the size of the array — which you can convert to a human-readable string separated with commas.

    If you have access to the original information in a raw binary form before it’s encoded as a string, use that instead. (but please post a question with the input format requirements for that information)

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

Sidebar

Related Questions

In Java, suppose I have a String variable S, and I want to search
Suppose I have a string 'nvarchar(50)', which is for example the T-SQL string segment
Suppose I have following string: String asd = this is test ass this is
Suppose you have the following string: white sand, tall waves, warm sun It's easy
Suppose I have a python object x and a string s , how do
Suppose I have this Windows wchar_t string: L\x4f60\x597d and L\x00e4\x00a0\x597d and would like to
Suppose you have a collection of Foo classes: class Foo { public string Bar;
Suppose I have a class public class MyClass { private Set<String> set = new
For example, suppose I have a class: class Foo { public: std::string& Name() {
suppose I have a form: <form id=someform action=some.php method=get> <input type=text name=somename /> <input

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.