add readme
This commit is contained in:
parent
32487804c1
commit
ff63ef1549
@ -10,7 +10,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmacro-prefix-map=${CMAKE_SOURCE_DIR}=.")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-ld=mold -Wno-unused-command-line-argument")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -fsanitize=address,undefined")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=address,undefined")
|
||||
|
||||
message(STATUS "[DEPS] Processing spdlog")
|
||||
FetchContent_Declare(
|
||||
|
83
README.md
Normal file
83
README.md
Normal file
@ -0,0 +1,83 @@
|
||||
# password-analyzer
|
||||
|
||||
## Description
|
||||
|
||||
实现了以下的分析功能:
|
||||
|
||||
- [x] 密码日期分析 [source](./stat_date.cpp)
|
||||
- [x] 密码键位分析 [source](./stat_keystroke.cpp)
|
||||
- [x] 密码长度分析 [source](./stat_length.cpp)
|
||||
- [x] 密码结构分析 [source](./stat_struct.cpp)
|
||||
- [x] 密码单词分析 [source](./stat_word.cpp)
|
||||
|
||||
## Compile and Run
|
||||
|
||||
### Prerequisites
|
||||
|
||||
项目使用了 C++23 标准进行编写,需要使用支持 C++23 的编译器进行编译
|
||||
|
||||
经过测试的编译器:
|
||||
|
||||
```
|
||||
# g++ -v
|
||||
Using built-in specs.
|
||||
COLLECT_GCC=g++
|
||||
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/lto-wrapper
|
||||
Target: x86_64-pc-linux-gnu
|
||||
Configured with: /build/gcc/src/gcc/configure --enable-languages=ada,c,c++,d,fortran,go,lto,objc,obj-c++ --enable-bootstrap --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --with-build-config=bootstrap-lto --with-linker-hash-style=gnu --with-system-zlib --enable-__cxa_atexit --enable-cet=auto --enable-checking=release --enable-clocale=gnu --enable-default-pie --enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object --enable-libstdcxx-backtrace --enable-link-serialization=1 --enable-linker-build-id --enable-lto --enable-multilib --enable-plugin --enable-shared --enable-threads=posix --disable-libssp --disable-libstdcxx-pch --disable-werror
|
||||
Thread model: posix
|
||||
Supported LTO compression algorithms: zlib zstd
|
||||
gcc version 13.2.1 20230801 (GCC)
|
||||
```
|
||||
|
||||
如果使用 `clang++` 编译器,需要修改 `CMakeLists.txt`,强制使用 `libc++`,`patch` 如下:
|
||||
|
||||
```diff
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 2ca65a4..5129602 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -12,6 +12,9 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmacro-prefix-map=${CMAKE_SOURCE_DIR}=.
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-ld=mold -Wno-unused-command-line-argument")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=address,undefined")
|
||||
|
||||
+set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++ -lc++abi")
|
||||
+gset(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
|
||||
+
|
||||
message(STATUS "[DEPS] Processing spdlog")
|
||||
FetchContent_Declare(
|
||||
spdlog
|
||||
|
||||
```
|
||||
|
||||
其它依赖:
|
||||
|
||||
1. `cmake >= 3.12`
|
||||
2. `make` or `ninja`
|
||||
3. `git`
|
||||
4. `mold`: 可选,若不需要使用 `mold` 进行链接,请在 `CMakeLists.txt` 中删除 `-fuse-ld=mold` 选项
|
||||
|
||||
### Compile
|
||||
|
||||
编译:
|
||||
|
||||
```bash
|
||||
mkdir build
|
||||
|
||||
pushd
|
||||
cmake ..
|
||||
cmake --build . -j
|
||||
popd
|
||||
```
|
||||
### Run
|
||||
|
||||
在 **项目根目录** 下运行:
|
||||
|
||||
```
|
||||
# ./build/password-analyzer
|
||||
[2023-11-05 14:45:17.980] [info] [stat_length(YAHOO)] start...
|
||||
[2023-11-05 14:45:18.174] [info] 8: 119134
|
||||
[2023-11-05 14:45:18.174] [info] 6: 79628
|
||||
[2023-11-05 14:45:18.174] [info] 9: 65963
|
||||
...
|
||||
```
|
Loading…
Reference in New Issue
Block a user