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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:00:23+00:00 2026-05-26T09:00:23+00:00

I need a way to store encrypted data, in a way that I can

  • 0

I need a way to store encrypted data, in a way that I can still run queries. Is that even possible?

At least I need an encryption algorythm that always returns the same string for the same input, so I can find all the users named ‘John’ by encrypting that string and looking for the encrypted result in the DB. In PHP, mcrypt always returns different strings (I know this is on purpose, to improve security).

Any ideas?

  • 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-26T09:00:24+00:00Added an answer on May 26, 2026 at 9:00 am

    Depends on how you’re storing that ‘John’ name. If it’s the ONLY thing in a particular field, you can do something like

    SELECT ...
    FROM sometable
    WHERE cryptedfirstname = AES_ENCRYPT('John', $key)
    

    If ‘John’ is part of a larger string (‘John Doe’ or ‘King John, Ruler of the Universe’), then you’ll have to decrypt the full field and match against that

    SELECT ...
    FROM sometime
    WHERE INSTR(AES_DECRYPT(cryptedFULLame, $key), 'John') > 0
    

    Note that I’m embedding the decryption key in the query. Bad idea for a production system, but this is just an example.

    You won’t be able to do something like:

    ...
    WHERE INSTR(cryptedFULLname, AES_ENCRYPT('John', $key))
    

    due to how AES and most other userful/decent crypto systems work.

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

Sidebar

Related Questions

I need a way to store application-level data (i.e. cross user sessions) in ASP.NET.
I am in need of a lightweight way to store dictionaries of data into
What is the best way to store string data across postback. I need to
I need to store IP address in the most compact way possible, searching is
I'm using DPAPI in C++ to encrypt some data that I need to store
I need to store sensitive information (a symmetric encryption key that I want to
I need a way to store an int for N columns. Basically what I
I'm writing a memory allocator, and I need a way to store an integer
I need to find a way to store 250 KB of plain text numbers
I need an elegant way to implement credit-based purchases for an online store with

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.