Browse Source

update: 更新README.md

SongZihuan 3 years ago
parent
commit
e9a47cf9c9
4 changed files with 36 additions and 3 deletions
  1. 1 1
      CMakeLists.txt
  2. 20 0
      README.md
  3. 11 2
      main.c
  4. 4 0
      passwd_file.c

+ 1 - 1
CMakeLists.txt

@@ -15,5 +15,5 @@ if (have_key)
     message(STATUS "KeyTips = " ${KeyTips})
 endif()
 
-add_definitions(-DVERSION="0.0.1" -DVERSION_INFO="H-Password, now start.")
+add_definitions(-DVERSION="1.0.0" -DVERSION_INFO="Spring, protect your password!")
 add_executable(H_Passwd main.c base64.c passwd.c argument.c random_passwd.c passwd_file.c md5.c)

+ 20 - 0
README.md

@@ -15,5 +15,25 @@ Option:
  -h --help          显示帮助文档。
  -s --set-pw        根据密钥和账户信息生成一个标签文本。
  -g --get-pw        根据密钥和标签文本获取账户信息。
+ -t --tips          打印提示信息。
+ -i --in-file       从文件中获取密码标签或保存密码标签到文件中。
+ -p --print-label   打印文件中所有的密码标签。
+ -d --delete-label  删除文件中指定的密码标签。
+ --set-tips         设置一个标签文本到文件中。
+ --delete-old       删除同名的旧密码。
+ -c                 检查key是否和exe绑定的key相同。
 ```
 
+## 文件模式
+H-Passwd支持将长的不便记忆的密码标签存储到文件中,并且设置一个可自定义的短名与其对应。
+可以使用`-p`参数查看文件中所有的密码标签及其对应的短名。具体使用可参见命令行参数介绍。  
+`p`、`-d`等涉及文件操作的选项均依赖`-i`选项。使用`-i`选项后,密码标签存储在可执行文件
+目录下的`passwd.hpd`文件中。
+
+## 可执行文件绑定密钥
+在编译过程可以设置`cmake`参数:`WriteKey`,`UserName`以及`KeyTips`。设置后可以启用
+该模式。该模式将key直接写入`exe`中,并且`UserName`和`KeyTips`作为`key`的提示信息。
+启用该模式后,文件模式将无法使用。
+
+## 构建
+本项目使用`cmake`管理生成,最低版本要求为`3.16`。

+ 11 - 2
main.c

@@ -207,12 +207,21 @@ void printVersion(void) {
 }
 
 void printHelp(void) {
-    printf("Usage: %s <[option]..>\n", name);
+    printf("Usage: %s <[option]..> [key]\n", name);
     printf("Option: \n");
     printf(" -v --version       Show version.\n");
     printf(" -h --help          Show help.\n");
     printf(" -s --set-pw        Set Password.\n");
-    printf(" -g --get-pw        Get Password.\n\n");
+    printf(" -g --get-pw        Get Password.\n");
+    printf(" -t --tips          Print the key tips.\n");
+#ifndef INCLUDE_KEY
+    printf(" -i --in-file       Save and get passwd from file.\n");
+    printf(" -p --print-label   Prints all labels in the file.\n");
+    printf(" -d --delete-label  Delete labels in the file.\n");
+    printf(" --set-tips         Save or reset the key-tips in file.\n");
+    printf(" --delete-old       Update password and delete same-name old password.\n");
+#endif
+    printf("\n");
 
 #ifdef INCLUDE_KEY
     printf("!!! Exclusive custom user: %s !!!\n", UserName);

+ 4 - 0
passwd_file.c

@@ -293,7 +293,11 @@ void printContent(void) {
     struct Content *con = content;
     printf("********************\n");
     printf("Print all label in file.\n");
+#ifdef _MSC_VER
+    printf("total: %llu\n", content_size);
+#else
     printf("total: %lu\n", content_size);
+#endif
     printf("--------------------\n");
     for (int i = 0; i < content_size; i++, con = con->next)
         printf("%d. %s : name: %s, label: %s\n", i, con->date, con->name, con->passwd_str);