2 Star 0 Fork 0

chromium_develop / chromium_third_party_zxcvbn-cpp

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

zxcvbn-cpp

This is a C++ port of zxcvbn, an advanced password strength estimation library. For more details on how zxcvbn works and its advantages, check out the blog post.

This port is a direct translation of the original CoffeeScript source. This allows this port to easily stay in sync with the original source. Additionally, this port uses the same exact test scripts from the original with the help of emscripten.

This port also provides C, Python, and JS bindings from the same codebase.

Python Bindings

Build

$ python setup.py install

Use

>>> import zxcvbncpp
>>> print(zxcvbncpp.password_strength("Tr0ub4dour&3"))

JS Bindings

Build

Building the JS bindings requires a POSIX environment, including make, and Emscripten.

First make sure emcc is in your $PATH. You can do so using the Emscripten Portable SDK as follows:

$ source /path/to/emsdk_portable/emsdk_env.sh

Then simply run:

$ RELEASE=1 make -f jsmakefile lib/zxcvbn.js

Use

Add this script to your index.html:

<script src="path/to/zxcvbn.js"></script>

To make sure it loaded properly, open in a browser and type zxcvbn('Tr0ub4dour&3') into the console. For more information on how to use the JS port see the original documentation.

Use From Node

Usage from node is straight-forward:

var zxcvbn = require("./path/to/zxcvbn.js");
console.log(zxcvbn("Tr0ub4dour&3"));

How to build for your C/C++ project

Adapt these instructions to your build environment.

First generate adjacency graphs and frequency lists:

$ python ./data-scripts/build_frequency_lists.py ./data ./native-src/zxcvbn _frequency_lists.hpp
$ python ./data-scripts/build_frequency_lists.py ./data ./native-src/zxcvbn _frequency_lists.cpp
$ python ./data-scripts/build_keyboard_adjacency_graphs.py ./native-src/zxcvbn/adjacency_graphs.hpp
$ python ./data-scripts/build_keyboard_adjacency_graphs.py ./native-src/zxcvbn/adjacency_graphs.cpp

Add /absolute_path/to/zxcvbn-repo/native-src to your include path, then build all the .cpp files in /absolute_path/to/zxcvbn-repo/native-src/zxcvbn. Make sure you use the -std=c++14 compiler flag.

Testing

zxcvbn-cpp uses the test scripts from the original codebase, this makes it easy to verify that it is 100% compatible with the original. In addition to requiring a POSIX environment and Emscripten, testing also requires a NodeJS environment. Here's how you set it up:

$ npm install

Then to run the tests:

$ make -f jsmakefile test

Development

Bug reports and pull requests welcome!

Please note zxcvbn-cpp is written using modern C++14 techniques, no passing around stray pointers!

Copyright (c) 2016 Rian Hunter Copyright (c) 2012-2016 Dan Wheeler and Dropbox, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

暂无描述 展开 收起
C++ 等 3 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/chromium_develop/chromium_third_party_zxcvbn-cpp.git
git@gitee.com:chromium_develop/chromium_third_party_zxcvbn-cpp.git
chromium_develop
chromium_third_party_zxcvbn-cpp
chromium_third_party_zxcvbn-cpp
master

搜索帮助