password generator

64 views
Skip to first unread message

Robert

unread,
Dec 15, 2011, 2:52:26 PM12/15/11
to vim_use
Just wondering if anyone has done a password generator using a
vimscript function? Google brought me nothing back.

Thanks,

Bob

Marc Weber

unread,
Dec 15, 2011, 3:01:01 PM12/15/11
to vim_use
a pwd generater requires random values:
:h rand*(<tab>
does not show anything - thus VimL does not support random values.
On linux like operating systems you can use /dev/(u)random and read some
chars or you can use interfaces to the supported scripting languages
(python,ruby,..) or use additional external tools.

Of course you could base it on the time which you can query using some VimL
functions as well.
It all depends on your security requirements.

Marc Weber

Charles Campbell

unread,
Dec 15, 2011, 3:36:24 PM12/15/11
to vim...@googlegroups.com
See http://drchip.0sites.net/astronaut/vim/index.html#RNDM for a
pseudo-random number generator for vimL.

One should be able to gin up a password generator with it and nr2char().

Regards,
Chip

lith

unread,
Dec 16, 2011, 3:36:58 AM12/16/11
to vim...@googlegroups.com


Am Donnerstag, 15. Dezember 2011 20:52:26 UTC+1 schrieb Robert:
Just wondering if anyone has done a password generator using a
vimscript function?

Is there a reason why you don't want to use a specialized app that gives you more options with respect to which characters the password should include etc.?

    :r !pwgen

Regards,
Tom

Steve Hall

unread,
Dec 16, 2011, 8:35:50 AM12/16/11
to vim...@googlegroups.com
On Fri, Dec 16, 2011 at 3:36 AM, lith wrote:
>
> Is there a reason why you don't want to use a specialized app that
> gives you more options with respect to which characters the password
> should include etc.?

The best passwords include the most character possibilities. This
crazy notion websites/software have of restricting them to certain
characters or counts only means less security because they are more
easily guessed.

But one can always use a random generator to replace the
"non-acceptable" characters one by one, looping until you get one that
"fits".


--
Steve Hall [ digitect dancingpaper com ]

Robert

unread,
Dec 16, 2011, 9:32:03 AM12/16/11
to vim_use

Part of it was curiosity that it could be done. Also, like vim, I am
on multiple OS platforms and it would be nice just to have.

Bob

Sven Guckes

unread,
Dec 16, 2011, 9:37:45 AM12/16/11
to vim...@googlegroups.com
* Robert:
> Just wondering if anyone has done a password
> generator using a vimscript function?

* lith <mini...@gmail.com> [2011-12-16 12:32]:


> Is there a reason why you don't want to use a specialized
> app that gives you more options with respect to which
> characters the password should include etc.?
> :r !pwgen

speaking of which:
Password Generators: apg, gpw, pwgen, makepasswd

on some systems there's $PROGRAM - but the
user has no power to install other programs.
that's usually a case for asking whether
$PROGRAM also has $FOO installed somehow.

still, when there is a connection to the world
then you should probably use an ssh or vpn client
to escape the hell of the local jail and simply
do your stuff on your own account/machine. :)

Sven

Tim Chase

unread,
Dec 16, 2011, 10:18:05 AM12/16/11
to vim...@googlegroups.com, Steve Hall
On 12/16/11 07:35, Steve Hall wrote:
> On Fri, Dec 16, 2011 at 3:36 AM, lith wrote:
> The best passwords include the most character possibilities. This
> crazy notion websites/software have of restricting them to certain
> characters or counts only means less security because they are more
> easily guessed.

It's true that larger character sets diminish the ability to
brute-force the password, but length is also a factor. And
there's the ability to remember that password without writing it
down. A password that has 25 alphanumeric characters beats the
pants off an 8-character mixed-printable in terms of time to
complete. Steve Gibson (security guy) goes so far as to suggest
keeping some secret thing you can repeat to pad out your length,
such as adding 15 ampersands or 8 period-followed-by-comma pairs
after your password to give it extra length.[1]

That said, if you run vim with +python built in, you can use this
one-liner:

:python import random as r, string as s, vim as v; v.command('let
@"="'+(''.join([r.choice(s.printable.replace('"', '')) for i in
range(10)]))+'"')

which will preload the scratch register with a random password of
length 10 (in this case) chosen from printable-characters (minus
the double-quote for simplicity instead of escaping). You can
then paste that just as you would anything you've yanked.

-tim

[1] https://www.grc.com/haystack.htm


Charles Campbell

unread,
Dec 16, 2011, 3:51:40 PM12/16/11
to vim...@googlegroups.com
I wrote one -- please look at
http://drchip.0sites.net/astronaut/vim/index.html#PASSWGEN

Regards,
Chip Campbell

John Beckett

unread,
Dec 16, 2011, 5:32:27 PM12/16/11
to vim...@googlegroups.com
Steve Hall wrote:
> The best passwords include the most character possibilities.
> This crazy notion websites/software have of restricting them
> to certain characters or counts only means less security
> because they are more easily guessed.

Off topic for Vim, but it's worth knowing that length
compensates for the use of a small character set.

One of the best systems is Diceware where you use a random
number generator (a set of dice) to pick a word from a publicly
available list of 7776 words. Your only decision is how many
words to pick. Each word is equivalent to 12.9 random bits, so
five words is the same as picking 8 random characters, each of
which ranges from 0 to 255 (64 random bits).

The five words are longer than 8 characters, but easier to
remember and to type.

http://en.wikipedia.org/wiki/Diceware

John

lith

unread,
Dec 17, 2011, 8:09:35 AM12/17/11
to vim...@googlegroups.com
Am Freitag, 16. Dezember 2011 14:35:50 UTC+1 schrieb Steve Hall:
The best passwords include the most character possibilities. This

But one can always use a random generator to replace the


"non-acceptable" characters one by one, looping until you get one that
"fits".

Some more sophisticated password generators can generate passwords that are somewhat pronounceable and thus easier to remember. One could of course ask whether that is an advantage or not.

Regards,
Tom

Joan Miquel Torres

unread,
Dec 17, 2011, 8:31:15 AM12/17/11
to vim...@googlegroups.com
Al 17/12/11 14:09, En/na lith ha escrit:

https://www.xkcd.com/936/

--
Joan Miquel Torres__________________________________
Linux Registered User #164872
http://www.mallorcaweb.net/joanmiquel
BULMA: http://bulma.net http://breu.bulma.net/?l2301

Anthony Campbell

unread,
Dec 21, 2011, 3:39:42 AM12/21/11
to vim...@googlegroups.com

If you don't use a US keyboard it's best to avoid characters that differ
on your keyboard. I've been caught out a couple of times like that, when
an upgrade changed my default keyboard and I found my password no longer
worked. I now avoid using, for example, # and @.

--
Anthony Campbell - a...@acampbell.org.uk
Microsoft-free zone - Using Debian GNU/Linux
http://www.acampbell.org.uk - sample my ebooks at
http://www.smashwords.com/profile/view/acampbell

Reply all
Reply to author
Forward
0 new messages