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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:44:21+00:00 2026-06-14T22:44:21+00:00

First and foremost, I want to iterate that I’m not asking how to HASH

  • 0

First and foremost, I want to iterate that I’m not asking how to HASH a password (such as salting / bcrypt / etc). For every other project I’ve done, I’ve always hashed / salted the passwords but in this case I need to regain the password temporarily.

Basically, I need to store a password in my DB and then have it be accessible again. In codeigniter (the framework I’m using), they use mcrypt as well as a key (which they suggest should be 32-characters long). Would this suffice?

EDIT:

The reason for asking: I need to be able to send out mission-critical sensitive PDFs to users and want to password protect them (ideally with the same password).

After a discussion with people on SO and off, I’ve come to the conclusion that you should NEVER encrypt a password and always hash / salt it. Think of how many people use the same password / email for different services. Therefore, I’ve come to the conclusion that IF you DO need to encrypt an item that you should use a separate PIN or other non-essential item.

However, even though I’m going to go the pin route and keep the passwords hashed, I still am very curious as to how you would theoretically go about this problem.

  • 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-14T22:44:23+00:00Added an answer on June 14, 2026 at 10:44 pm

    Yes, as long as you keep the SALT value secret.

    UPDATE: seems people do not happy with simple answers. by using mcrypt extensions, you can encrypt your data with a specific secret value SALT. If people do not know the SALT, they can’t decrypt the value.

    Example:

    <?php 
        define('SALT', 'whateveryouwant'); 
    
        function encrypt($text) 
        { 
            return trim(base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, SALT, $text, MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND)))); 
        } 
    
        function decrypt($text) 
        { 
            return trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, SALT, base64_decode($text), MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND))); 
        } 
    ?> 
    

    Of course, if you want extra security, consider using Public Key Infrastructure.

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

Sidebar

Related Questions

First and foremost, I am not asking anyone to write a program for me
First and foremost, I do not know RegEx but am trying to piece something
First and foremost, apologies for any cross-posting. Hope I'm not repeating an issue here,
First and foremost let me state that I know that accessing server side controls
First and foremost, I have searched this thoroughly and I'm not convinced with any
First and foremost, this is not a question about generating a serial number for
First of all I want to say I am not a programmer but I
Please no jQuery code, as I want to learn javascript first and foremost. I
in first and foremost i need to say that I'm new in Spring AOP
Preface: Hi, all! Here goes. First and foremost, I am not familiar with jquery,

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.