tcwhk 1.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
tcwhk-1.0.1/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
tcwhk-1.0.1/PKG-INFO ADDED
@@ -0,0 +1,72 @@
1
+ Metadata-Version: 2.4
2
+ Name: tcwhk
3
+ Version: 1.0.1
4
+ Summary: 安全、简单、零依赖的随机密钥生成器
5
+ Author-email: shiroko <3207774253@qq.com>
6
+ License: MIT
7
+ Keywords: password,generator,secrets,cli
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Requires-Python: >=3.6
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Dynamic: license-file
14
+
15
+ ###### tcwhk
16
+
17
+ 安全、简单、零依赖的随机密钥生成器。
18
+
19
+ 安装
20
+
21
+ ```bash
22
+ pip install tcwhk
23
+ ```
24
+
25
+ 使用
26
+
27
+ ```bash
28
+ # 生成默认 20 位密钥
29
+ ra
30
+
31
+ # 指定长度
32
+ ra 32
33
+
34
+ # 32 位,不含符号
35
+ ra 32 3
36
+
37
+ # 纯数字 + 字母,关符号
38
+ ra 24 3
39
+
40
+ # 纯数字,关字母、关符号
41
+ ra 16 2 3
42
+
43
+ # 纯字母,关数字、关符号
44
+ ra 16 1 3
45
+
46
+ # 兼容旧格式
47
+ ra generate 32
48
+ ```
49
+
50
+ 模式说明
51
+
52
+ · 1 关闭数字
53
+ · 2 关闭字母
54
+ · 3 关闭符号
55
+
56
+ 可多模式组合,例如 1 3 表示关闭数字和符号
57
+
58
+ 与 text_discoloration 的关系
59
+
60
+ tcwhk 的核心功能也集成在 text_discoloration 中:
61
+
62
+ ```python
63
+ from text_discoloration import ra_key
64
+
65
+ ra_key() # 默认 20 位
66
+ ra_key(length=32) # 32 位
67
+ ra_key(no_symbol=True) # 不含符号
68
+ ```
69
+
70
+ 协议
71
+
72
+ MIT
tcwhk-1.0.1/README.md ADDED
@@ -0,0 +1,58 @@
1
+ ###### tcwhk
2
+
3
+ 安全、简单、零依赖的随机密钥生成器。
4
+
5
+ 安装
6
+
7
+ ```bash
8
+ pip install tcwhk
9
+ ```
10
+
11
+ 使用
12
+
13
+ ```bash
14
+ # 生成默认 20 位密钥
15
+ ra
16
+
17
+ # 指定长度
18
+ ra 32
19
+
20
+ # 32 位,不含符号
21
+ ra 32 3
22
+
23
+ # 纯数字 + 字母,关符号
24
+ ra 24 3
25
+
26
+ # 纯数字,关字母、关符号
27
+ ra 16 2 3
28
+
29
+ # 纯字母,关数字、关符号
30
+ ra 16 1 3
31
+
32
+ # 兼容旧格式
33
+ ra generate 32
34
+ ```
35
+
36
+ 模式说明
37
+
38
+ · 1 关闭数字
39
+ · 2 关闭字母
40
+ · 3 关闭符号
41
+
42
+ 可多模式组合,例如 1 3 表示关闭数字和符号
43
+
44
+ 与 text_discoloration 的关系
45
+
46
+ tcwhk 的核心功能也集成在 text_discoloration 中:
47
+
48
+ ```python
49
+ from text_discoloration import ra_key
50
+
51
+ ra_key() # 默认 20 位
52
+ ra_key(length=32) # 32 位
53
+ ra_key(no_symbol=True) # 不含符号
54
+ ```
55
+
56
+ 协议
57
+
58
+ MIT
@@ -0,0 +1,22 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "tcwhk"
7
+ version = "1.0.1"
8
+ description = "安全、简单、零依赖的随机密钥生成器"
9
+ readme = "README.md"
10
+ license = { text = "MIT" }
11
+ authors = [
12
+ { name = "shiroko", email = "3207774253@qq.com" }
13
+ ]
14
+ keywords = ["password", "generator", "secrets", "cli"]
15
+ classifiers = [
16
+ "Programming Language :: Python :: 3",
17
+ "License :: OSI Approved :: MIT License",
18
+ ]
19
+ requires-python = ">=3.6"
20
+
21
+ [project.scripts]
22
+ ra = "tcwhk.ra_generate:main"
tcwhk-1.0.1/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,4 @@
1
+ from .ra_generate import create_key, show_help
2
+
3
+ __version__ = "1.0.1"
4
+ __author__ = "shiroko"
@@ -0,0 +1,77 @@
1
+ import secrets
2
+ import sys
3
+
4
+ letter_pool = 'qwertyuiopasdfghjklzxcvbnm'
5
+ num_pool = '0123456789'
6
+ symbol_pool = '!@#$%^&*_+-=[]{}|;:,.<>?'
7
+
8
+ def build_pool(close_list):
9
+ use_letter = True
10
+ use_num = True
11
+ use_symbol = True
12
+
13
+ if 1 in close_list:
14
+ use_num = False
15
+ if 2 in close_list:
16
+ use_letter = False
17
+ if 3 in close_list:
18
+ use_symbol = False
19
+
20
+ if not use_letter and not use_num and not use_symbol:
21
+ return None
22
+
23
+ pool = ""
24
+ if use_letter:
25
+ pool += letter_pool
26
+ if use_num:
27
+ pool += num_pool
28
+ if use_symbol:
29
+ pool += symbol_pool
30
+ return pool
31
+
32
+ def create_key(length=20, close_list=None):
33
+ if close_list is None:
34
+ close_list = []
35
+ pool = build_pool(close_list)
36
+ if pool is None:
37
+ return "错误:不能同时关闭字母、数字、符号全部三项"
38
+ return ''.join(secrets.choice(pool) for _ in range(length))
39
+
40
+ def show_help():
41
+ print("===== tcwhk 密钥生成器 =====")
42
+ print("用法:ra [长度] [模式...]")
43
+ print(" ra generate [长度] [模式...] (兼容旧格式)")
44
+ print("默认长度:20位")
45
+ print("模式说明:")
46
+ print(" 1 关闭数字")
47
+ print(" 2 关闭字母")
48
+ print(" 3 关闭符号")
49
+ print("示例:")
50
+ print(" ra 生成默认20位")
51
+ print(" ra 32 指定32位")
52
+ print(" ra 32 3 32位,关闭符号")
53
+ print(" ra generate 32 兼容旧格式")
54
+
55
+ def main():
56
+ args = sys.argv[1:]
57
+
58
+ if args and args[0] == "generate":
59
+ args = args[1:]
60
+
61
+ if not args:
62
+ show_help()
63
+ return
64
+
65
+ length = 20
66
+ close_list = []
67
+
68
+ for arg in args:
69
+ if arg.isdigit():
70
+ length = int(arg)
71
+ elif arg in ('1', '2', '3'):
72
+ close_list.append(int(arg))
73
+
74
+ print(create_key(length, close_list))
75
+
76
+ if __name__ == "__main__":
77
+ main()
@@ -0,0 +1,72 @@
1
+ Metadata-Version: 2.4
2
+ Name: tcwhk
3
+ Version: 1.0.1
4
+ Summary: 安全、简单、零依赖的随机密钥生成器
5
+ Author-email: shiroko <3207774253@qq.com>
6
+ License: MIT
7
+ Keywords: password,generator,secrets,cli
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Requires-Python: >=3.6
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Dynamic: license-file
14
+
15
+ ###### tcwhk
16
+
17
+ 安全、简单、零依赖的随机密钥生成器。
18
+
19
+ 安装
20
+
21
+ ```bash
22
+ pip install tcwhk
23
+ ```
24
+
25
+ 使用
26
+
27
+ ```bash
28
+ # 生成默认 20 位密钥
29
+ ra
30
+
31
+ # 指定长度
32
+ ra 32
33
+
34
+ # 32 位,不含符号
35
+ ra 32 3
36
+
37
+ # 纯数字 + 字母,关符号
38
+ ra 24 3
39
+
40
+ # 纯数字,关字母、关符号
41
+ ra 16 2 3
42
+
43
+ # 纯字母,关数字、关符号
44
+ ra 16 1 3
45
+
46
+ # 兼容旧格式
47
+ ra generate 32
48
+ ```
49
+
50
+ 模式说明
51
+
52
+ · 1 关闭数字
53
+ · 2 关闭字母
54
+ · 3 关闭符号
55
+
56
+ 可多模式组合,例如 1 3 表示关闭数字和符号
57
+
58
+ 与 text_discoloration 的关系
59
+
60
+ tcwhk 的核心功能也集成在 text_discoloration 中:
61
+
62
+ ```python
63
+ from text_discoloration import ra_key
64
+
65
+ ra_key() # 默认 20 位
66
+ ra_key(length=32) # 32 位
67
+ ra_key(no_symbol=True) # 不含符号
68
+ ```
69
+
70
+ 协议
71
+
72
+ MIT
@@ -0,0 +1,10 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ tcwhk/__init__.py
5
+ tcwhk/ra_generate.py
6
+ tcwhk.egg-info/PKG-INFO
7
+ tcwhk.egg-info/SOURCES.txt
8
+ tcwhk.egg-info/dependency_links.txt
9
+ tcwhk.egg-info/entry_points.txt
10
+ tcwhk.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ ra = tcwhk.ra_generate:main
@@ -0,0 +1 @@
1
+ tcwhk