Hashing passwords with Python and Bcrypt

Поділитися
Вставка
  • Опубліковано 20 лип 2024
  • Enjoying this type of content? Head over to my website at pythonise.com for full length text based tutorials, courses and guides.
    Want to help me make even better content? You can by supporting me on Patreon! / juliannash

КОМЕНТАРІ • 46

  • @joe7992
    @joe7992 4 роки тому +20

    Thanks, I use these sort of things all the time in my python homework to surprise my teacher and I think this is awesome.

  • @tpbarratt
    @tpbarratt 5 років тому +7

    I've just come across this video and found it very clear and useful. Now subscribed and looking forward to learning more about Python. Thanks Julian!

  • @maxyulu
    @maxyulu 4 роки тому +6

    Great tutorial! Thank you. Also just subscribed and hopefully you gonna make more tutorials.

  • @lydiayoussef8162
    @lydiayoussef8162 3 роки тому +1

    Thank you very much for this video, I have been struggling for 2 hours now, I wish I had watched this video earlier!

  • @franzbiberkopf9179
    @franzbiberkopf9179 3 роки тому +7

    Thank you very much for this. But how would you hide the password in the source code of your web-page? Would it be enough to create a dummy page with the password and to import the hashed password in the main code of the application?

  • @anujlahoty8022
    @anujlahoty8022 4 роки тому +1

    Awesome tutorial!

  • @jayaramkulkarni4989
    @jayaramkulkarni4989 3 роки тому +1

    Thanks, was facing that problem discussed in video at 5:30. It was really helpful.

    • @lostfrequentie_7476
      @lostfrequentie_7476 3 роки тому

      with like a Tkinter Entry its
      input = Entry1.get()
      cryp = bytes(input, encoding="utf-8")
      result = bcrypt.hashpw(cryp, bcrypt.gensalt())
      print(result)

  • @raiyan22
    @raiyan22 3 роки тому +1

    THANK YOU VERY MUCH! Helped a lot ! Thanks again !! :)

  • @finessegod2645
    @finessegod2645 3 роки тому

    great content bro keep it up, ill be subscribing

  • @EnglishRain
    @EnglishRain Рік тому

    Fantastic explanation thanks a lot!

  • @adamhughes5527
    @adamhughes5527 5 років тому +2

    Cheers dude!

  • @simrakausar6271
    @simrakausar6271 3 роки тому +3

    I get error "invalid salt" in checkpw. I m writing a code for password authentication using socket programming in python.

  • @Parzalai
    @Parzalai 2 роки тому +4

    Damn bro you explained this so well I'm gonna hash everything now

  • @data9051
    @data9051 2 роки тому +1

    is there any way you could drop a tutorial similar to this that would include peppering

  • @NunoLima10
    @NunoLima10 Рік тому

    Great video

  • @MatteoMenozzi
    @MatteoMenozzi 2 роки тому

    i must crypt some fields in db with python can i use the method who yyou show in this video ?

  • @annietabuanaba8458
    @annietabuanaba8458 5 років тому +3

    thanks for the tutorial...

  • @raghavnegi713
    @raghavnegi713 3 роки тому +1

    Thanks a thousand!!!!!!!!!

  • @mortezamashary187
    @mortezamashary187 4 роки тому +2

    How we can hash the user input password???

  • @0xsuperman
    @0xsuperman Рік тому

    I get what this python tutorial and the lines of this script, thanks. But I am confused how this can be implemented in a production environment. Let's say I have an API key. I will use this to obtain a hashed API key and save it somewhere. In run time, do I ask user to enter the original string of the API key, and then I will hash this user-input API key, and then compare the newly hashed API key vs. the stored hashed API key? If so, how can I be sure when I use `bcrypt.hashpw()` on the newly entered API key, the resulting hashed string will be the same as the stored one? Can/should I save the `hashed = bcrypt.hashpw(password, bcrypt.gensalt())` inside the project directory, so when I hash the new API key, it should result the same hashed string?

  • @jdchannelviewer
    @jdchannelviewer 4 роки тому +1

    If I have access to the hash file, why don't I just replace it with Hashes that I know??? Then access the system with my own set of passwords populating it...

  • @michellemassaad1013
    @michellemassaad1013 3 роки тому +1

    What app where you typing on before python ???

  • @biohazard7785
    @biohazard7785 3 роки тому

    How would i pass in a user input as the password? I keep getting the "TypeError: can only concatenate str (not "bytes") to str" error. Would it have to be something like
    username = input("username: ")
    Or would something need to go before it?

    • @noestu
      @noestu 2 роки тому +1

      import bcrypt
      password = input("password: ")
      hashed = bcrypt.hashpw(password.encode('utf-8'), bcrypt.gensalt())
      print(hashed)

  • @miguecastillo
    @miguecastillo 3 роки тому +1

    Can anybody tell me, what do you save on the database?, the varible "hashed" that he creates on the video?

    • @ffuyu
      @ffuyu 3 роки тому

      Yes

  • @khushbukumari7753
    @khushbukumari7753 2 роки тому

    How decode this hash password ??

  • @srajith4499
    @srajith4499 5 років тому +2

    hey how to do that if password was taken from input ??

    • @adamhughes5527
      @adamhughes5527 5 років тому +3

      password = input().encode("utf-8")

  • @jsceo
    @jsceo 4 роки тому +3

    if hashing is irreversible how checkpw checks if our password matches hash? don't get it

    • @NotKewl
      @NotKewl 4 роки тому

      The password typed in by the user is hashed, this is compared to the stored hash.

    • @jsceo
      @jsceo 4 роки тому +4

      ​@@NotKewl but it is hashed with random salt, so how later can be it compared?

    • @karolmarkiewicz6526
      @karolmarkiewicz6526 4 роки тому

      i dont get it as well, randomly spotted your comment while was watching yt and looking for an answer

    • @djadamkent
      @djadamkent 4 роки тому

      It won’t work unless the salt is the same, otherwise you just end up with a completely different hash each time that can’t be compared. Usually the salt would be generated once and stored as an environment variable on the server.

    • @jsceo
      @jsceo 4 роки тому +1

      @@djadamkent but it actually works

  • @keytetra5093
    @keytetra5093 4 місяці тому

    where did Julian go?

  • @gandalfgrey91
    @gandalfgrey91 6 місяців тому

    I do not like the idea of having to grab the password from the database in order to run a check

  • @logy6580
    @logy6580 Рік тому

    Hey i have a question

  • @daedricpedgey9667
    @daedricpedgey9667 4 роки тому +2

    Shame that you stopped uploading tbh😢

  • @RyanBess
    @RyanBess 2 роки тому

    Salting ensures that no 2 same passwords are the same hash.