How-to Generate Random Characters as Password Generator

How can I create a great password by generating a random sentence by avoiding ambiguous character with digits and symbol?

May I suggest that you consider 1Password for this task?

Not only will it generate random PWs for you, it will store them in a highly secure, encrypted, vault (on your computer) along with your other logon credentials like UserName, EMail, URL, etc.

Then, when you need to logon, you just press a hotkey (like CMD \) and 1Password autofills the logon fields for you.

It is also great to store your credit card and registration info for your software.

I’ve used it many times a day for years now, and it would be very hard to get by without it. :smile:

1 Like

Hey Benoit,

I'm with JM. I've used 1Password for six or seven years now. The price made me balk at first, but after I'd used it for two days I realized it saved me so many headaches it was worth the money.

KM itself is probably not the ideal vehicle for creating strong passwords, but you might be able to build a pretty good macro if you try.

Scope out:

Google:

os x generate strong password

KM can access the OSX Keychain (see the wiki and search for 'keychain'), so if you're determined to use it many things can be accomplished with a little (or a lot of) effort.

Even so — I recommend a good purpose-built password manager.

-Chris

I really like 1Password and I’m using it all the time. The goal is to create quick password on the fly, without using my mouse. I always need to unlock my 1Password vault and click my way thought out the password generator. That’s the problem.

I also want to mention another use case of generating password: generating file name. Something, I need to quickly share a file, so I want to export it but without thinking about the name file. Normally, I use 1password, create a password and use it as the file name. But again, the flow is too slow.

That’s why. Any idea how I can automate this task with 1Password?

You can setup hotkeys to activate the 1PW mini-app.
I use CTRL + \ for auto fill and
CTRL + OPT + \ just to bring up the mini-app

It looks like this:

The first time you use it on a day, you will have to log in to 1PW.
But after that it will just come up. You can set how long before you have to re-enter the 1PW master PW.

As you can see, 1PW mini-app will generate the PW for you.
But it does take one click on the "Fill" button.

You could use this for a random file name generator, but I prefer this AppleScript:

set strFileName to "AS-" & (do shell script "date '+%Y%m%d%H%M%S'") & "-temp.html"
result:   "AS-20150817095854-temp.html"

As you can see it is actually a shell script, so you could just use that in KM Execute Script Action to return a file name. In the KM macro you could, of course, ask for a file extension (with a default).

If you just want a unique name, just use the current date and time.

%ICUDateTime%yyyyMMdd-HHmmss%

Or a random number:

%Calculate%RAND(1000000000000)%

If you want a password, you are generally better off to use a real password generating tool, however for your password generating purposes it probably does not matter how random it is since no one will be able to back-track to how you generated the password to attack the password that way. So a random number is probably fine here too. If you want letters as well, you can use something like this:

Execute Shell Script:
cat /dev/urandom | LC_ALL=C tr -dc ‘a-zA-Z0-9-_$?’ | fold -w 16 | sed -e 1,10d -e 11q

Change the allowed characters a-zA-Z0-9-_$? and the password length 16 as desired.

Note this is a potentially weak password due to its reliance on urandom.

2 Likes

There are some great suggestions here, but I went in a slightly different way.

  • Installed "apg" from Homebrew -- note, this needs a bit of extra work and maybe isn't ideal (see why Debian is striking apg)

  • Specified my own set of filters as a command line argument to a program, and then had KM run it and add it to my clipboard:

    /usr/local/bin/apg -M SNCL -E '[]{}#%^*+=_|~<>"' -m 30 -x 32 -n 1

  • -M SNCL: must use symbols, numeric, capital, and lower case

  • -E ... -- exclude any of those characters

  • -m 30 -- minimum 30 characters long

  • -x 32 -- maximum 32 characters long

  • -n 1 -- only generate one

1 Like