Logo

Travels with Charlie

  • Random
  • Archive
  • RSS
  • Ask me anything

Beautiful Code: Generate strong passwords using one line of Ruby

This line of ruby code lets you generate strong passwords, using most of the ASCII codes.

[code lang=”ruby”]

((33..126).map { |i| i.chr }).to_a.shuffle[0..14].join

[/code]

  • The (33..126) bit lets you use lowercase, UPPERCASE and symbols for your password.
  • The [0..14] indicates passwords should be 14 characters long. Feel free to change 14 to whatever you need.

Thanks to Michael Hartl (Ruby on Rails Tutorial: Learn Rails by Example) for the inspiration.

Posted via email from Pre-Posterous | Comment »

  • 1 year ago
  • Comments
  • Permalink
  • Share
    Tweet

Recent comments

Blog comments powered by Disqus
← Previous • Next →

Portrait/Logo

About

This is were I post my curated links on digital media, new technologies and their implications on media and journalism (as well as other stuff I find interesting).

Follow me here on Tumblr if you want a sneak peek at the links I'll be posting throughout the day on Twitter - plus additional bonus material!

  • Follow @cgranier


Come... drink my Kool-Aid!

Me, Elsewhere

  • @cgranier on Twitter
  • anonymonk on Flickr
  • cgranier on Delicious
  • cgranier on Pinboard
  • carlosgranier on Digg
  • Google
  • Linkedin Profile

Following

  • RSS
  • Random
  • Archive
  • Ask me anything
  • Mobile

Effector Theme by Carlo Franco.

Powered by Tumblr