I'm currently developing a CLI password generator and I've been trying to come up with ways of randomizing characters between a defined set of chars. I know the srand(time(NULL)) method but as far as I know, it's a bit incosistent and not so safe to generate random passwords.
I also know there is a way of randomizing numbers using the libsodium library for C (according to this topic), but I'm not sure how to use it. Should I install all the dependencies in my project? Is a relative small project to have such a huge library. Although I plan expanding it as time goes by, I don't know if it's worth having a huge library and not use most of its functions.
On top of that, are there specific algorithms to generate passwords other than just randomizing characters? Should I also randomize the array within itself following another algorithm for better consistency like the Fisher Yates Shuffle?
Thanks in advance!
Random password generator + algorithm
724 Views Asked by thevoyager At
1
There are 1 best solutions below
Related Questions in C
- How to call a C language function from x86 assembly code?
- What does: "char *argv[]" mean?
- User input sanitization program, which takes a specific amount of arguments and passes the execution to a bash script
- How to crop a BMP image in half using C
- How can I get the difference in minutes between two dates and hours?
- Why will this code compile although it defines two variables with the same name?
- Compiling eBPF program in Docker fails due to missing '__u64' type
- Why can't I use the file pointer after the first read attempt fails?
- #include Header files in C with definition too
- OpenCV2 on CLion
- What is causing the store latency in this program?
- How to refer to the filepath of test data in test sourcecode?
- 9 Digit Addresses in Hexadecimal System in MacOS
- My server TCP doesn't receive messages from the client in C
- Printing the characters obtained from the array s using printf?
Related Questions in RANDOM
- Producing filtered random samples which can be replicated using the same seed
- Random getting value from a range or a specific value
- Unique and random selection of 10 rows per user in a table
- How to calculate the accuracy in number guessing game?
- Using attributes from instances of array of objects in other classes
- How do I write such a random source code generator?
- How to randomly load html file inside a html page on page load using javascript?
- New error on random number assigned to local variable , Rails
- Why does the code return the same 5 random numbers every time
- How can I efficiently find two numbers in an array that sum up to a given target without using the same element twice?
- How can I use a variable that is defined in one script in a different script in Unity
- Why is C# BigInteger not always the same bit length?
- Choosing a sequence of bitwise operations
- java: method nextLong in class java.util.Random cannot be applied to given types;
- How to add the outout the random element from array and keep adding 1 by 1 in empty array?
Related Questions in LIBSODIUM
- Updates to pgsodium encrypted values don't use specified key_id
- How to properly decrypt file using libsodium in java (chacha20poly1305)?
- About problem in installing ext-sodium * for installing lcobucci/jwt 4.3.0 and kreait/firebase-tokens 4.3.0 for laravel project
- Issue in sodium installation in R
- crypto_secretbox_easy appends several '[NUL]' characters to the end of text
- I can't install libsodium on code blocks for a C program
- decryption function for XChaCha20-Poly1305
- Trouble with homebrew and libsodium
- Derive same X25519 public from either Ed25519-public or Ed25519-secret
- Decrypting a Chacha20-Poly1305 string without using tag\mac
- Decryption doesn't succeed consistently when decrypting a message with the same parameters using cryptoSecretBoxOpenEasy (lazysodium-java)
- Running make command throws issue error: ‘crypto_sign_SEEDBYTES’ was not declared in this scope
- Missing Libsodium in WSL2
- How to use static library libsodium.lib in C++Builder?
- Does PyNaCl release GIL and should it be used with multithreading
Related Questions in PASSWORD-GENERATOR
- Having a problem where not all of user input criteria is included in password
- perl rand lc/uc
- Generate a random string of specified length that contains only specified characters (in Java)
- Building a password algorithm, with password hashing
- How to generate different password each time i clicked the button python
- ImportError: cannot import name 'PasswordGenerator' from 'password_generator'
- Python Password Generator with TKInter
- Human Readable GUID
- Random Password Generator (ASCII - AP Computer Science) Java
- Random password generator doesn't exclude the numbers/special characters/uppercase letters etc when they aren't selected to be in the password
- [Random String Generator]Getting stuck in a loop on else condition
- Trying to create a Password Generator that can save passwords
- how to make the program ask the user for a input for length and use the input to make the password as long as the user would like
- Random password generator python
- Why does my password generator written in JavaScript often return passwords with repeating characters?
Related Questions in SODIUM
- Issue in sodium installation in R
- Is it easy to retrieve message and encryption key from several encryptions of the same message?
- Decrypt ChaCha20-Poly1305 (8 Byte Nonce) in Dart
- PHP extension sodium with IIS
- php-sodium on Amazon Linux 2023
- Random password generator + algorithm
- SodiumException secretkey should be SODIUM_CRYPTO_SIGN_SECRETKEYBYTES bytes
- How to get private key (in the right format) with sodium-plus js (secretbox) from html page for decrypting a message
- Missing sodium extension - wampserver
- Can't install node-sodium on Windows
- Error Logging Into Magento 2: Open Source admin panel
- When trying to use npm install I get a "msvsVersion is not defined" error on a discord bot
- why does node-sodium package is not working
- How to perform Tying the Knot/define observable recursively using iteself in Rx.Net?
- PHP Version 7.3.17 on Amazon EC2 missing sodium?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
There are lots of issues to resolve, including:
extern void gen_random_password(size_t length, char buffer[length]);rand()andsrand()will be available 'everywhere'nrand48()- no hidden seedarc4random()— no seed permitted (BSD, macOS)random()andsrandom()(BSD, macOS)I like using
nrand48()because it allows the random password generator to run a series of random numbers independently of any other sequence because it takes the seed — an array of 3unsigned shortintegers — as arguments.Generating a good random seed is tricky. I have code which can be configured to use any of these mechanisms:
The first two are preferable — there may or may not be a significant difference between
/dev/randomand/dev/urandom.Once you've got these important but tedious issues out of the way, the core algorithm for generating a random password is very simple:
grpwd43.hgrpwd43.cThe other source files needed can be found in my SOQ (Stack Overflow Questions) repository on GitHub in the src/so-7594-6155 sub-directory or in the src/libsoq sub-directory.