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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T20:29:50+00:00 2026-05-29T20:29:50+00:00

I have a user auth table with a few thousand records containing a password

  • 0

I have a user auth table with a few thousand records containing a password field encrypted by bcrypt-ruby. I’ve ported the app in to PHP / Yii and need to use this field for authentication.

Is there a way to retrieve this Ruby-created field in PHP?

Verification

By “retrieve” I mean that I need to authenticate user logins using a PHP / Yii app to interpret a DB table with a password field created by bcrypt-ruby in a Rails app.

  • 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-29T20:29:52+00:00Added an answer on May 29, 2026 at 8:29 pm

    I believe this would solve your problem:

    $database_record = "something";   // grab from database
    $user_input = 'unicorns';         // take real one from post data
    $password = crypt($user_input, '$2a$10$usesomesillystringforsalt$');
    // key piece above is the second number, that is the 'work' factor
    
    if (crypt($user_input, $database_record) == $password) {
       echo "Password verified!";
    }
    else {
        echo 'failed!'; }
    

    This assumes you stored them using BCrypt::Password.create(desired_pass) in Ruby, and were verifying login by BCrypt::Password.new(database_entry) == form_input.

    Additionally, to create a new password in your database (i.e. a new user), store the result of

    $password = crypt($user_input, '$2a$10$usesomesillystringforsalt$');

    Lastly, make sure that you are always using the correct cost factor. The same password with different cost factors will not be equivalent. The default cost factor in bcrypt-ruby is 10 (current version, 3.0.1).

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

Sidebar

Related Questions

I have a django server that serves the basic site with user, auth etc
We've faced strange problem. We have log on service, that authenticates user, adds auth
I have user control in my MVC2 app placed in the Content folder (it's
I have trouble saving my date field into database using CakePHP. Table column name
I have following situation: I have loged user, standard authentication with DB table $authAdapter
I need to upadte, add and delete rows from the auth.models.User table, unfortunately... when
I have three models: Project, User, ProjectsUser. The ProjectsUser table is used for HABTM
I have two tables in my app: 'Clients' and 'Appointments' In the appointments table
I have set up Auth and ACL successfully on my cakePHP app. How, now
I have some code that gets the current logged in user. userID = request.session.get(_auth_user_id)

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.