Random Password Generator | C Programming Example

Поделиться
HTML-код
  • Опубликовано: 18 сен 2024
  • How to create a random password generator in C that generates passwords based on a user specified length incorporating digits, lowercase letters, uppercase letters, and symbols. Source code: github.com/por.... Check out www.portfolioc... to build a portfolio that will impress employers!

Комментарии • 27

  • @baruchben-david4196
    @baruchben-david4196 Год назад

    Thanks for these videos. You have helped me understand several issues that had previously seemed puzzling. I appreciate it.

  • @dami3nb
    @dami3nb Месяц назад

    How come you can print the value of the pointer ‘password’, without dereferencing the pointer?
    So from my understanding we create an character array, we allocate memory to it to store the amount of characters the user wants in their password. (+ 1 to terminate the string)
    We run a loop to assign a value of a random character type to the indexes (memory addresses) of the array.
    We add ‘\0’ to the password after the loop ends.
    Lastly we print the password using a format specifier and the password variable.
    So the loop adds the values of random character types to the different memory addresses of the array, but when we print the password, we get values, not memory addresses?

  • @D_Ladybug
    @D_Ladybug 2 года назад +3

    I wish meet you someday 🤩. Thank you for all you do

  • @SketchupGuru
    @SketchupGuru Год назад

    Thanks. Could you share a tutorial of how the "rand" function is built? The logic behind it that is.

    • @PortfolioCourses
      @PortfolioCourses  Год назад

      Hmm maybe one day I can do a video on that, that might be neat. :-) Here is something in the meantime: stackoverflow.com/a/4768189.

  • @cleightthejw2202
    @cleightthejw2202 Год назад +1

    @Host
    Iwas wondering if you can explain the placement of the '*' on the type or the variable name.Does it make a difference? If so what is it?
    Example being int*/char* variable_name or int/char *variable_name AND can there be a 'free standing/floating' '*' in between the int/char and var name like int/char * variable_name ?

    • @PortfolioCourses
      @PortfolioCourses  Год назад +1

      I actually have a video that goes over these questions you're asking: ruclips.net/video/H5MlTh5cBOg/видео.html. Hopefully that video helps to explain things! :-) You may also find this video interesting as well, it covers a sort of related concept: ruclips.net/video/Qp3WatLL_Hc/видео.html.

    • @cleightthejw2202
      @cleightthejw2202 Год назад

      ​@@PortfolioCourses Hello to you and Thank you for getting that link to the video for me. I am going to watch it now.
      And thanks for your videos. You definitely do put out a lot of good stuff

    • @PortfolioCourses
      @PortfolioCourses  Год назад

      @@cleightthejw2202 You're welcome! 🙂

  • @X3nnoha
    @X3nnoha 9 месяцев назад

    Could have been nice if you included a loop when we enter a short password so the program doesnt close each time

  • @callistafrancis8615
    @callistafrancis8615 Год назад

    Your explanation for each thing is really great. I just wanted help regarding how can I tell the computer to give me random words from the file which I tell it to read. It would be great help if you could help me out with this. Thanks:)

    • @PortfolioCourses
      @PortfolioCourses  Год назад +1

      I'm glad you enjoy the content! :-) That's a great question , but the answer to that is very long I would need to make a whole video I think to try to answer that. If it were me I would read all the content from the file into a string. Then you could count how many words are in the string. Then make a random number between 0 ... total words. You could then output or extract that word from the string by looping through the string again and storing it into a char array. These videos are the closest thing I have right now to what you're asking about:
      File Access Basics: ruclips.net/video/HQNsriyMhtY/видео.html
      Read All File Contents Into A String: ruclips.net/video/CzAgM5bez-g/видео.html
      Count the words in a string: ruclips.net/video/JpquiHExpfI/видео.html
      Random number generation: ruclips.net/video/Mp3eGLX-OpY/видео.html
      Count the characters and words in a file: ruclips.net/video/H-dehw4nLVM/видео.html

  • @matt.loupe.
    @matt.loupe. 3 месяца назад

    Do you have any videos on unit testing in c?

    • @PortfolioCourses
      @PortfolioCourses  3 месяца назад +1

      Unfortunately no, but I do want to cover that topic one day. :-)

  • @rapphhael
    @rapphhael 2 года назад

    Why not use arc4random_uniform? Manual indicates it generates higher quality random numbers. I started in C recently, please don't get me wrong.

    • @rinatvaliullov3247
      @rinatvaliullov3247 2 года назад +1

      Because of learning purpose.

    • @PortfolioCourses
      @PortfolioCourses  2 года назад +4

      Great question Raphael! :-) arc4random_uniform is an improvement on rand() and would be a great idea! Though it is still pseudo-random. In this video I used rand() because that's what most students looking to learn would be familiar with already from their classes, I think I'll make a separate video on arc4random_uniform() though!

    • @rapphhael
      @rapphhael 2 года назад

      @@PortfolioCourses Thanks for clarifying! I learned these functions a few weeks ago, also to generate random strings. Most information out there teaches to use a rand() family, but it becomes tricky when the documentation itself recommends the arc4random family. Tips on how to judge when to use each of them would be great.

    • @PortfolioCourses
      @PortfolioCourses  2 года назад +2

      That's a good point, maybe I can address that question in the video itself. It would depend on the quality of the randomness required. Using rand() for learning how to use random numbers as well as harmless things like games should be fine. Something like arc4random_uniform() would be more secure for situations such as this. Though it's possible to do better, the use cases where that's necessary would be more and more niche.

  • @علم-عام
    @علم-عام Год назад

    what you program use

  • @lizardmilk5753
    @lizardmilk5753 Год назад

    good tutorial but you dont actually explain how the code works.

    • @PortfolioCourses
      @PortfolioCourses  Год назад +1

      Which part don’t you think is explained? I literally explained the code step by step if you watched the video…

  • @noydygg1547
    @noydygg1547 Год назад +1

    Dont copy this please I will use it in my group project (: