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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:19:29+00:00 2026-05-13T07:19:29+00:00

I have a script to convert to base 62 (A-Za-z0-9) but how do I

  • 0

I have a script to convert to base 62 (A-Za-z0-9) but how do I get a number out of MD5?

I have read in many places that because the number from an MD5 is bigger than php can handle as an integer it will be inaccurate… As I want a short URL anyway and was not planning on using the whole hash, maybe just 8 characters of it….

So my question is how to get part of the number of an MD5 hash?

Also is it a bad idea to use only part of the MD5 hash?

  • 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-13T07:19:30+00:00Added an answer on May 13, 2026 at 7:19 am

    I’m going to suggest a different thing here.. Since you are only interested in using a decimal chunk of the md5 hash why don’t you use any other short numeric hash like CRC32 or Adler? Here is an example:

    $hash = sprintf('%u', crc32('your string here'));
    

    This will produce a 8 digit hash of your string.

    EDIT: I think I misunderstood you, here are some functions that provide conversions to and from bases up to 62.

    EDIT (Again): To work with arbitrary length numbers you must use either the bc_math or the GMP extension, here is a function that uses the bc_math extension and can also convert from base 2 up to base 62. You should use it like this:

    echo bc_base_convert(md5('your url here'), 16, 62); // public base 62 hash
    

    and the inverse:

    echo bc_base_convert('base 62 encoded value here', 62, 16); // private md5 hash
    

    Hope it helps. =)

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

Sidebar

Related Questions

I have a script that takes the articles out of the database and places
I have a script that will convert a text file into a resource file,
I have a script that will fetch data from server and compose a DIV
I have this script that works with iconv to automatically convert the encoding of
Basically I have a script that updates an xml document in various places... However,
I have this script: DELETE FROM [Tags] WHERE Id = CONVERT(uniqueidentifier, '7373D1A0-CB6A-4207-87C4-AE2939FD20C0'); GO INSERT
I have a script that generates a number and sets it to a textbox.
I have a script that brings in RSS feeds that come from different timezones.
I Wrote a small php script to convert string to HEX but i have
I have a script that runs recursively over many directories, and I'd like to

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.