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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T12:36:54+00:00 2026-05-15T12:36:54+00:00

I am using the md5 function to hash a string into a 32 digit

  • 0

I am using the md5 function to hash a string into a 32 digit string.

str_to_encode = 'this is a test string which I want to encode'
encoded = hashlib.md5(str_to_encode).hexdigest() 

I want to be able to decode this string (i.e. encoded in the example above) back to its original value. I don’t think this is possible using md5 (but if it is please let me know), but is there a compressionn function which I can use which will give me a 32 digit string at the end but which can be reverted?

EDIT:
The string being encoded is a url so will only be a couple of hundred characters max although in most cases it will be a lot less.

Thanks

  • 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-15T12:36:55+00:00Added an answer on May 15, 2026 at 12:36 pm

    It seems to me that you aren’t looking for a hash or encryption, you are looking for compression. Try zlib and base64 encoding:

    s = 'Hello, world'
    encoded = zlib.compress(s).encode('base64')
    

    The length of the encoded data will grow as the input grows, but it may work for you.

    Even restricting yourself to URLs, there’s no way to reversibly map them to 32-character strings, there are just too many possible URLs.

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

Sidebar

Related Questions

Using the hash function MD5 on a string creates a very long value, and
am generating unique api keies using this function and storing into database. strtoupper( md5(
I am getting MD5 of several files using python function: filehash = hashlib.md5(file) print
I'm using MD5 function and Base64 Encoding to generate a User Secret (used to
I'm using md5 to encrypt the user's password in my database, and I want
When I am encrypting 23 using MD5 encryption I am getting 37693cfc748049e45d87b8c7d8b9aacd this 32-character
This is a general question about character encoding when using MD5 libraries in various
Greetings, I have some mysql tables that are currently using an md5 hash as
when using oracle forms to generate md5 hash, i get result that is different
I need to hash with md5 algorithm a string in my program. There is

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.