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

  • Home
  • SEARCH
  • 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 6954121
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:33:54+00:00 2026-05-27T14:33:54+00:00

Starting from a hex source, i want to convert it to a-zA-Z0-9 . base_convert()

  • 0

Starting from a hex source, i want to convert it to a-zA-Z0-9.
base_convert() only supports as output a 32 base, that equals to a-z0-9. I need a base-62 output, for the additional A-Z (don’t know how to better explain, sorry).

I’m doing this (since that the community often ask) cause of i’m using openssl rand -hex as a source for random password (i would love to use rand() and so on, but i need to have lots of unique passwords, and rand() or even mt_rand() doesn’t provide enough casualty, password get repeated so often that the script locks down).

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-27T14:33:55+00:00Added an answer on May 27, 2026 at 2:33 pm

    Try this:

    function base62_encode($hex)
    {
        $chars = 'abcdefghijklmnopqrstuwvxyzABCDEFGHIJKLMNOPQRSTUWVXYZ0123456789';
        $in = hexdec($hex);
    
        $result = '';
    
        while ($in > 0) {
            $i = $in % 62;
            $in = (int)($in / 62);
    
            $result = $chars[$i] . $result;
        }
    
        return $result;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to display these list elements starting from top, I don't want them
I only want the dates starting from the current date. How do I ask
I want to generate a sequence number starting from 00000001,00000002....(i need all these zero
starting from a mostly fresh CE 1.6.2.0 installation, I want to remove the default
Starting from this official statement that all xyAndroid versions previous API 11 doesn't support
I need to create a historical timeline starting from 1600's to the present day.
I want to extract two consecutive words starting from each word in a string.
i have this problem: starting from an empty list (0 elements) i want check
I need to read some Scala code (starting from a few hours ago), I
I want to animate increment of numbers starting from 1 to a limit (variable)

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.