GithubHelp home page GithubHelp logo

hhy5277 / webscrypt Goto Github PK

View Code? Open in Web Editor NEW

This project forked from etherdream/webscrypt

0.0 1.0 0.0 1.58 MB

a fast and lightweight scrypt hash algorithm for browser

HTML 0.98% CSS 0.23% JavaScript 82.26% PHP 0.20% C 5.81% Makefile 0.68% TypeScript 6.22% Python 0.52% ActionScript 3.10%

webscrypt's Introduction

WebScrypt

一个浏览器版的 scrypt 算法,性能高、体积小。

scrypt 简介

scrypt 是一种密码学 Hash 函数,专门用于 Hash 口令。

不同于 PBKDF2、bcrypt 只有时间成本,scrypt 还可设定空间成本,该特征能使 GPU 等硬件设备破解 Hash 时瓶颈出现在内存上,从而降低硬件的计算优势。

另外 scrypt 支持并发维度,可充分利用多线程提高工作量,使破解时间成倍增加。详细讲解

前端计算

口令 Hash 函数的计算成本,决定了暴力破解的难度。但过高的成本,也会给服务器带来压力。因此通常只能在性能和安全之间折中。

事实上,口令 Hash 完全可在前端计算 —— 账号注册时,提交口令的 Hash 值(通常称之 DK);登录时,如果提交的 DK 相同,即可证明口令是相同的。

// REG or LOGIN
dk = scrypt(password, username, cost ...)

submit(username, dk, ...)

前端高成本 Hash 计算,不仅分担了后端压力,还能让原始口令数据更早消失,从而减少泄露环节,例如网络被窃听、服务端恶意程序等。

这就是本项目的初衷:在不增加网站基础设施的前提下,大幅提升账号口令安全。

API

演示

如何用到我的项目中?

更新中...

各种浏览器的性能对比

更新中...

其他的前端 scrypt 库

project ver asm.js flash purejs thread progress size (gzip -6)
WebScrypt latest ✔️ 2KB + 10KB / 54KB
js-scrypt 1.2.0 384KB
scrypt-async-js 1.3.0 3KB

备注:54KB 的是 flash.swf 文件,只有低版本浏览器才会使用

单线程性能

多线程性能

测试环境:Chrome56、OSX 10.11.6、MacBookPro 2013(2 GHz Intel Core i7,8 GB 1600 MHz DDR3)

探讨

探讨一些前端技术、隐私安全相关的话题。

License

MIT

webscrypt's People

Contributors

etherdream avatar thanhpk avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.