you can do this in pretty much any language. have you tried anything and need help or you're just asking us to do your homework for you?
Asking to do a homework.
honest advice: it's fine to ask for help online, but not putting any effort into solving your own problems before you do is disrespectful
There are various ways to solve the first part and they're pretty generic, the only "C++
-specific" part is whether you'll want to build the string step by step (adding characters) or build in one go then modify (build a prearranged string, for example of a specific size, then modify as needed).
To solve the second part we (you) also need to know the encryption algorithm. "Encrypt" is quite a generic word.
What's the best encryption algorithm in your opinion?
Let's solve the first part then.
But I guess that @herzenschein already suggested me a solution...
You could take inspiration from Theodore Tso’s pwgen: https://github.com/tytso/pwgen
FILE *f = popen("curl 'https://www.random.org/passwords/?num=1&len=12&format=plain&rnd=new'", "r");
char s[14];
fread(s, 1, sizeof(s), f);
s[13] = 0;
🤭
that's cheating
(also, it won't work on systems without curl installed)
(or without internet access)
You could take inspiration from Theodore Tso's pwgen: https://github.com/tytso/pwgen
It's a Unix utility in C commonly used on Linux and FreeBSD to make truly random passwords. It's the first thing I thought of when reading this.
Thanks so much! 👍🏼
But thanks to you! 😄
It will be a really hard work https://github.com/tytso/pwgen/blob/master/pw_rand.c 🤔
This is not doable in c++ unfortunately. Its an old case that’s only doable in f# or turbo pascal because of string handling and cryptography export rules (and possibly copy right)
C++
The center for all discussion and news regarding C++.
Rules
- Respect instance rules.
- Don't be a jerk.
- Please keep all posts related to C++.