Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aldy505/generate-passphrase-id
Secure random passphrase in Indonesian language
https://github.com/aldy505/generate-passphrase-id
generator indonesia passphrase random secure
Last synced: about 1 month ago
JSON representation
Secure random passphrase in Indonesian language
- Host: GitHub
- URL: https://github.com/aldy505/generate-passphrase-id
- Owner: aldy505
- License: mit
- Created: 2021-03-12T06:07:49.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2021-07-16T18:00:20.000Z (over 3 years ago)
- Last Synced: 2024-12-09T03:37:20.830Z (about 1 month ago)
- Topics: generator, indonesia, passphrase, random, secure
- Language: TypeScript
- Homepage:
- Size: 892 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Generate Passphrase
[![npm](https://img.shields.io/npm/v/generate-passphrase-id?style=flat-square) ![npm](https://img.shields.io/npm/dm/generate-passphrase-id?style=flat-square) ![npm bundle size](https://img.shields.io/bundlephobia/min/generate-passphrase-id?style=flat-square)](https://www.npmjs.com/package/generate-passphrase-id) [![Codecov](https://img.shields.io/codecov/c/github/aldy505/generate-passphrase-id?style=flat-square)](https://codecov.io/gh/aldy505/generate-passphrase-id) [![GitHub branch checks state](https://img.shields.io/github/checks-status/aldy505/generate-passphrase-id/master?style=flat-square)](https://github.com/aldy505/generate-passphrase-id/actions) [![GitHub](https://img.shields.io/github/license/aldy505/generate-passphrase-id?style=flat-square)](https://github.com/aldy505/generate-passphrase-id/blob/master/LICENSE)
> β¨Zero dependency module for generating passphrase.
An Indonesian language fork of (also my repository) [generate-passphrase](https://github.com/aldy505/generate-passphrase).
* π Simple passphrase generator with simple config
* β¨ ESM support
* π Cryptographically secure
* π Built-in Typescript typings
* π Supports Node.js 10 and higherThe code is close to node [generate-password](https://github.com/brendanashworth/generate-password) repo. But this is for a passphrase, with Indonesian language.
ProtonMail has a [decent article](https://protonmail.com/blog/protonmail-com-blog-password-vs-passphrase/) explaining about password vs passphrase.
Is this secure? Yes. I don't use `Math.floor`, I used the `crypto` module.
Why is this repo heavy? I'm using scraped words list from KBBI for fetching the Indonesian word list. If you have a better idea/workaround for this, feel free to open up an issue and file a PR! I'll gladly accept any feedbacks.
## Installation
```bash
$ npm install generate-passphrase-id
# or
$ yarn add generate-passphrase-id
# or basically any package manager you like.
```## How to use this?
```js
import { generate, generateMultiple } from 'generate-passphrase-id'
// or
const { generate, generateMultiple } = require('generate-passphrase-id')const passphrase = generate();
// 'spionase-syahwat-41-neolitikum'
const anotherPassphrase = generate({ length: 3, separator: '.', titlecase: true })
// see available options belowconst multiplePassphrase = generateMultiple(3)
// ['pomologi-jerojol-kalau-senandika', 'kakek-meristem-89-emigras', ... ]
const anotherMultiplePassphrase = generateMultiple(10, { length: 2, uppercase: true, numbers: false })
```I know some of us need to generate it fast just for the sake of it, you can add `fast` as a parameter. (It defaults to false). Please bear in mind, this would make the returning random passphrase **not cryptographically secure**
```js
const fast = generate({ fast: true })
// cultivars-strigose-avisements-58const extraFast = generateMultiple(5, { fast: true })
// ['extrorsal-169-resultlessness-168', 'postmodern-kolkhozniki-skulkers-99', ... ]
```## Options
| Key | Type | Default |
| --- | --- | --- |
| length | `integer` | `4` |
| separator | `string` | `'-'` |
| numbers | `boolean` | `true` |
| uppercase | `boolean` | `false` |
| titlecase | `boolean` | `false` |
| pattern | `string` | `null` |A few things to note:
* Uppercase is more prioritized than titlecase. So if you have both options set to `true`, it will be words full of uppercase.
* Pattern option is more prioritized than length, because you've set the passphrase pattern, hence the module is using the length from your pattern.## Benchmark a.k.a How slow is this?
**TL;DR:** It's slow.
I'm using:
* Asus ROG GL553VE
* Windows 10 Home 64-bit (10.0 Build 18363)
* Intel Core i7-7700HQ @ 2.80GHz, 8 CPUs
* 16 GB RAMBenchmark for single passphrase/password:
| Module | Ops/sec | Accuracy | Runs sampled |
| --- | --- | --- | --- |
| generate-passphrase-id | 107,649 | Β±1.89% | 407 |
| generate-passphrase (`fast` enabled) | 503,082 | Β±1.26% | 438 |
| generate-password | 401,664 | Β±1.33% | 335 |
| niceware | 268,618 | Β±1.95% | 319 |
| randomatic | 7,870 | Β±3.16% | 307 |Benchmark for multiple passphrase/password (`generateMultiple` function):
| Module | Ops/sec | Accuracy | Runs sampled |
| --- | --- | --- | --- |
| generate-passphrase-id | 11,714 | Β±1.37% | 425 |
| generate-passphrase-id (`fast` enabled) | 50,090 | Β±2.54% | 432 |
| generate-password | 40,261 | Β±2.26% | 332 |## Contributing
Yes please.
## License
[MIT](https://github.com/aldy505/generate-passphrase-id/blob/master/LICENSE)