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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:16:59+00:00 2026-06-05T07:16:59+00:00

I have some entities(objects), each one having an id(unique) and a name. When i

  • 0

I have some entities(objects), each one having an id(unique) and a name.
When i want to display oneof these , i have a url like http://www.domain.com/view/key:xxx.
The key is just the id of the entity encoded with base64_encode, so it’s not straightforward from the url what the id is.

What i’m trying to do now (due to the projects specifications) is have the key contain only numbers and letters (base64_encode provides a result like eyJpZCI6IjM2In0= or eyJpZCI6IjM2In0%3D after url encode).

Is there a simple alternative to this? It’s not a high-security issue – there are many ways the id can be revealed -, i just need to have a key that contains only letters and numbers that is produced by the entity ID (maybe in combination with its name) that can be decoded to give me the ID back.

All different encode methods i’ve found can contain special characters as well.
Any help here?
Thanks in advance

  • 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-05T07:17:00+00:00Added an answer on June 5, 2026 at 7:17 am

    This answer doesn’t really apply encryption, but since your question was tagged with encoding as well …

    Since PHP 5 you can use bin2hex:

    $s = base64_decode('eyJpZCI6IjM2In0=');
    echo bin2hex($s);
    

    Output:

    7b226964223a223336227d
    

    To decode:

    $s = hex2bin($data);
    

    Or:

    $s = pack('H*', $data);
    

    Btw, if the id is sensitive you might want to consider tamper proofing it as an alternative to full-blown encryption.


    Forgot to mention how you can make base64 encoded data URL safe:

    function base64_url_encode($input)
    {
        return strtr(base64_encode($input), '+/=', '-_,');
    }
    
    function base64_url_decode($input)
    {
        return base64_decode(strtr($input, '-_,', '+/='));
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In CoreData, I have the data graph with some entities, and each object is
In one of my projects, I have some classes that represent entities that cannot
I am using sping3 mvc in my application. I have some entities which need
I am attempting to add some entities that I have created. When I try
Imagine you have an entity that has some relations with other entities and you
I have the following two entities: @Entity class Relation{ @ManyToOne private User user; //some
So I've got some data. There are entities. Entities have an arbitrary number of
I have an entity with several fields, but on one view i want to
In JPA the Entities are nice annotated Plain Old Java Objects. But I have
I have a collection of custom entity objects one property of which is an

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.