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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:25:30+00:00 2026-05-24T22:25:30+00:00

I have a string of data a bit over 800 characters that I’m trying

  • 0

I have a string of data a bit over 800 characters that I’m trying to compress down to use on a QR code (I’d like at least 50%, but would probably be happy if I got it to less than seven hundred). Here’s an example string I’m trying to compress, containing 841 characters:

+hgoSuJm2ecydQj9mXXzmG6b951L2KIl0k9VGzIEtLztuWO2On9rt7DUlH0lXzG4iJ1yK0fA
97mDyclKSttIZXOxSPBf85LEN4PUUqj65aio5qwZttZSZ64wpnMFg/7Alt1R39IJvTmeYfBm
Tuc1noMMcknlydFocwI8/sk2Sje5MR/nYNX0LPkQhzyi5vFJdrndqAgXYULsYrB3TJDAwvgs
Kw9C5EJnrlqcb21zg17O2gU/C8KY0pz9RPzUl1Sb0rCP8iZCeis4YbQ5tuUppOfnO/X0Mosv
SOQJ/bF9juKW8ocnQvNjsNxGV1gPkWWtiU2Old7Qm7FLDqL6kQKrq356yifs0NiMVGdvAg32
eugewuttCugoZASYOpQdwPu1jMxVO1fzF3zEy5w6tDlcfA2DZwa+un9/k8XZWAO/KVExy68q
UtVRQxsIOKgpl/2tNw5DBAKbykKIkmizbsA2xtzqnYqld4kOdNMJh3YjlqWF9Bt8MZo7a+Q6
jgayr2rjpyIptc599DGtvp68ZNQ64TKNmiMnnyGMo3E+xW34G3RrsYnHGm+xJoLKoOJhacDu
oZke1ycJgQv+Y61WPrvtFOVBxV5rvSzO0+8px5AWN3uCrrw1RmT5N14IVhh6BOtRjsifqIB2
dAKxzBNsvbXm1SzkuyqYiMnp5ivy3m2mPwc9GLsykx0FRIkhCYO8ins9E5ot9QvVnE155MFA
8FVwsP5uNdOF4EzQS2/h2QK3zb5Yq4Nftlo605Dd5vuVN/A7CUN38DaAKBxDKgqDzydfQnZw
R0hTfMHNLgBJKNDSpz2P6almGlUJtXT6IYmzuU2Iaion8ePG

I’ve already tried the following three libraries:

  1. The built-in .NET GzipStream
  2. DotNetZip, including,
    • GzipStream
    • DeflateStream
  3. The LZMA SDK from 7-zip

I’m running into an issue where the compression is actually making the string longer. My understanding was that DeflateStream had the least overhead, yet it’s still adding characters on. Using DotNetZip, I told it to use maximum compression:

Imports Ionic.Zlib

Shared Function CompressData(data As Byte()) As Array

    Dim msCompressed As MemoryStream = New MemoryStream

    ' I'm not sure if the last parameter on this next function should be
    ' true (for LeaveOpen), but it doesn't seem to affect it either way.
    Dim deflated As DeflateStream = New DeflateStream(msCompressed, _
        CompressionMode.Compress, CompressionLevel.BestCompression, True)

    ' Write data to compression stream (which is linked to the memorystream)
    deflated.Write(data, 0, data.Length)
    deflated.Flush()
    deflated.Close()

    Return msCompressed.ToArray
End Function

I’m only thinking this is going to get worse as I’m going to have even more data. Is there some better compression algorithm for strings of this length? Does compression normally only work on longer strings? Unfortunately, the data is such that I can’t use stand-in characters for pieces of data.

Also, am I able to use alphanumeric encoding for the QR code, or do I have to use binary? I don’t think I can, per http://www.qrme.co.uk/qr-code-forum.html?func=view&catid=3&id=324, but I’d like to make sure.

Thanks for your help!

  • 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-24T22:25:31+00:00Added an answer on May 24, 2026 at 10:25 pm

    At first glance, it appears that you are trying to take some data and convert it into a QR code with this process:

    –> encrypt –> base64 encode –> compress –> make QR code.

    I suggest using this process instead:

    –> compress –> encrypt –> make QR code.

    When you want to both encrypt and compress, pretty much everyone recommends compress-then-encrypt.
    (Because encryption works just as well with compressed data as with uncompressed data.
    But compression usually makes plaintext shorter and encrypted files longer.
    For more details, see:
    “Can I compress an encrypted file?”
    “Compress and then encrypt, or vice-versa?”
    “Composing Compression and Encryption”
    “Compress, then encrypt tapes”
    “Is it better to encrypt a message and then compress it or the other way around? Which provides more security?”
    “Compressing and Encrypting files on Windows”
    “Encryption and Compression”
    “Do encrypted compression containers like zip and 7z compress or encrypt first?”
    “When compressing and encrypting, should I compress first, or encrypt first?“,
    etc.)

    “am I able to use alphanumeric encoding for the QR code, or do I have to use binary?”

    Most encryption algorithms produce binary output, so it will be simplest to directly convert that to binary-encoded QR code.
    I suppose you could somehow convert the encrypted data to something that QR alphanumeric coding could handle, but why?

    “Is there some better compression algorithm”

    For encrypted data, No. It is (almost certainly) impossible to compress well-encrypted data, no matter what algorithm you use.

    If you compress-then-encrypt, as recommended, then the effectiveness of various compression algorithms depends on the particular kinds of input data, not on what you do with it after compression.

    What kind of data is your input data?

    If, hypothetically, your input data is some short of ASCII text,
    perhaps you could use one of the compression algorithms mentioned at
    “Really simple short string compression”
    “Best compression algorithm for short text strings”
    “Compression of ASCII strings in C”
    “Twitter text compression challenge“.

    If, on the other hand, your input data is some sort of photograph,
    perhaps you could use one of the many compression algorithms mentioned at “Twitter image encoding challenge“.

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

Sidebar

Related Questions

I have a string of data with the following format: xpos-ypos-zoom (i.e. 8743-12083-15) that
I have the following connection string: Data Source=localhost\\SQLEXPRESS; , it complains that '' is
serial.write() method in pyserial seems to only send string data. I have arrays like
I have a string like this: TEST.DATA.Data.COR.Point,2;TEST.DATA.Data.COR.Point,5;TEST.DATA.Data.COR.Point,12;TEST.DATA.Data.COR.Point,12;TEST.DATA.Data.COR.WordTOFIND,18 I have a list of array with
I have an application that does projection of data for my client over a
I'm trying to write a bit of code which sends a single int over
I have a string containing byte data. How can I perform an in-place conversion
I have a string say string s =C:\\Data , I have an array which
I have a string which contains binary data ( non-text data ). How do
I have a string in c# containing some data i need to extract based

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.