From 86aee8b4f421d1b533e9f4ff92b2443e55fef317 Mon Sep 17 00:00:00 2001 From: hunter007 Date: Wed, 20 Sep 2023 14:55:09 +0800 Subject: [PATCH] update README.md Signed-off-by: hunter007 --- README.md | 17 +++++++++++++++++ TODOs | 1 - 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 46ad5c7..6d033c0 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,23 @@ go get github.com/hunter007/password ## Usage +#### 0. Generate password + +```go +// 1. generate password via default config +p, _ := password.Generate(12, 4, 2, 1) + +// 2. make a custom config. Any utf8 char is supported. +c := Config{ + UpperLetters: "壹贰叁肆伍陆柒捌玖拾", + LowerLetters: "一二三四五六七八九十", + Digits: "①②③④⑤⑥⑦⑧⑨⑩0️⃣✅", + Symbols: "😭😁😄😞👏🏻🙋🏻‍♀️😴🔥", +} +g := NewGenerator(c) +p, _ := g.Generate(16, 4, 3, 0) +``` + #### 1. Validate password ```go diff --git a/TODOs b/TODOs index 41dc396..b8d83c5 100644 --- a/TODOs +++ b/TODOs @@ -1,4 +1,3 @@ -- Generate password - imporove performence - sync.Pool - add benchmark test