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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:20:57+00:00 2026-06-15T20:20:57+00:00

I have a PHP website which acts as a web proxy/anonymizer, and I have

  • 0

I have a PHP website which acts as a web proxy/anonymizer, and I have it set up where each visited page is cached on my server for a limited time. To further secure things, I would like to encode the URLs into a set of hexadecimal characters, but it needs be be unique enough to where no 2 URLs will ever clash together; The cached page’s file name will reflect the encoded URL, so I can’t allow them to be overwritten by the visitation of another page.

Meanwhile, I’ve been using this:

$file = str_shuffle(preg_replace("/[^a-zA-Z0-9\s]/", "", urlencode($url))) .".html";

… But the problem here is that it’s always random and not guaranteed to be fully unique. I’d like to make it so that users can bookmark their URLs (and revisit them within a given time period, without having to re-navigate to the page). How can I generate such a string?

  • 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-06-15T20:20:59+00:00Added an answer on June 15, 2026 at 8:20 pm

    If you need a “secure”, as in not reversible, unique “encoding” of a URL, that’s what hashes are for:

    $hash = sha1('http://...');
    

    The value will be unique for each URL, two identical URLs will hash to the same value, they’re not reversible and are for most intents and purposes random values.

    If you’re talking about encoding (changing from one form to another) or encrypting (changing into another form using a secret key), then you’re talking about reversible algorithms, in which case the result is unique by definition. Encoding the string won’t be “secure”, since there’s no secret. Encrypting the string is as secure as you keep the secret.

    So you have three choices:

    1. encoding (e.g. url_encode, base64_encode), which is not secure and reversible
    2. encryption (e.g. AES), which uses a secret and is secure and reversible
    3. hashing (e.g. SHA1), which is not reversible and thereby secure

    All three result in unique values (good hashes have a mathematically high enough probability to result in unique values).

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

Sidebar

Related Questions

I have a website which works with PHP on the server side. Users access
I have a website which has 2 pages , (home_page.php and action_page.php)Action page takes
Currently, I have a website which serves dynamic (PHP-MySQL) content from an Apache server,
I have designed a website which uses AJAX. I have a PHP page named
I have an PHP website which creates and stores HTML template files on server
I have a PHP website in which, when a member visits a page, a
I have working website in PHP with a MySQL backend which has several tables
I have a php page inside a folder on my website. I need to
I have developed a PHP-MySQL web application, which is a school-based project. My client
I have a website which employs a PHP script to load some data from

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.