https://github.com/kbrgl/xkcd-password-rb
A password generator inspired by xkcd comics, in Ruby.
https://github.com/kbrgl/xkcd-password-rb
Last synced: 4 months ago
JSON representation
A password generator inspired by xkcd comics, in Ruby.
- Host: GitHub
- URL: https://github.com/kbrgl/xkcd-password-rb
- Owner: kbrgl
- License: mit
- Created: 2015-11-21T06:47:26.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-11-21T06:54:04.000Z (over 9 years ago)
- Last Synced: 2025-01-01T12:12:50.068Z (5 months ago)
- Language: Ruby
- Size: 35.2 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# xkcd password generator

### Languages in which I've implemented this
* [Python](https://github.com/kbrgl/xkcd-password) (compatible with both 2 and 3)
* Ruby### What word list are you using?
I'm using a word list I found at [a GitHub repo called 'google-10000-english'](https://github.com/first20hours/google-10000-english). However, you can use pretty much any word list for this.### How the heck do I use this thing?
If you just want a password then just clone the repo and run the Ruby script.#### Using the code
Initialize the XkcdPasswordGenerator object with the word list you want to use. Call the generate() method. You can retrieve individual words with the random_word() method.
* In case you are using an external word list file, there's a parse() function that you can use.Here's an example:
```ruby
generator = XkcdPasswordGenerator.new(parse('dictionary.csv', delimiter: ','))
generator.generate #=> 'correct horse battery staple'
generator.generate(words: 4, separator: nil) #=> ['correct', 'horse', 'battery', 'staple']
generator.random_word #=> 'horse'
```