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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:34:34+00:00 2026-05-28T03:34:34+00:00

import bcrypt hashedstring = bcrypt.gensalt() password = bcrypt.hashpw(password,hashedstring) Should I save the hashedstring everytime

  • 0
import bcrypt

hashedstring = bcrypt.gensalt()
password = bcrypt.hashpw(password,hashedstring)

Should I save the hashedstring everytime in the database table field to login succeesfully next time getting the hashed string?

Or should I use a static pre-generated hashed string in code?

  • 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-28T03:34:34+00:00Added an answer on May 28, 2026 at 3:34 am

    The salt you use to hash the password is stored in the resulting hash – this means there is no need to store it in the database, as it can be recovered from the hash.

    According to the project page, this can be done like so:

    # Store a hash.
    import bcrypt
    hashed = bcrypt.hashpw(password, bcrypt.gensalt())
    store_in_db(user, hashed) #Where user is the user to load the hash for, and store_in_db does what it says on the tin.
    
    # Check against an existing hash
    import bcrypt
    hashed = load_from_db(user) # (get the password of the user from database) Where user is the user to load the hash for, and load_from_db does what it says on the tin.
    if bcrypt.hashpw(password, hashed) == hashed: # Where password is a plaintext password attempt.
            print "It matches"
    else:
            print "It does not match"
    

    And yes, you should use a different salt for each value – which BCrypt’s design encourages.

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

Sidebar

Related Questions

import imaplib usr = 'someuser' pwd = 'somepwd' imap_server = imaplib.IMAP4_SSL('imap.gmail.com', 993) imap_server.login(USER, PASSWORD)
import imaplib import pprint IMAP_SERVER='imap.gmail.com' IMAP_PORT=993 M = imaplib.IMAP4_SSL(IMAP_SERVER, IMAP_PORT) rc, resp = M.login('user@gmail.com',
Join me in the fight against weak password hashes. A PBKDF2 password hash should
import sys sys.path.append('/home/myuser/svn-repos/myproject') from myproject.settings import * But, it says module not found when
import java.util.Collection; import example.Event; public interface Query { public boolean hasMore (); public Collection<Event>
import java.lang.Math; public class NewtonIteration { public static void main(String[] args) { System.out.print(rootNofX(2,9)); }
import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class DateDemo { public static void main(String[]
import threading event = threading.Event() event.set() print event.wait(1) None event.clear() print event.wait(1) None So
import java.io.*; import java.util.Scanner; import java.util.StringTokenizer; public class Filereader { public static void main(String[]
import wx class MainFrame(wx.Frame): def __init__(self,parent,title): wx.Frame.__init__(self, parent, title=title, size=(640,480)) self.mainPanel=DoubleBufferTest(self,-1) self.Show(True) class DoubleBufferTest(wx.Panel):

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.