JavaScript加密库 jsCrypto
jopen
13年前
<p><a href="/misc/goto?guid=4959517721781967926" rel="nofollow"><img alt="JavaScript加密库 jsCrypto" src="https://simg.open-open.com/show/106501da89df84aa9d202109e7f10778.png" width="296" height="99" /></a> </p> <p>jsCrypto 是一个实现了一些常用加密方法的 JavaScript 库,支持的算法包括:</p> <ul> <li>Symmetric encryption: AES, DES, 3DES, </li> <li>Encryption mode: ECB, CBC, CTR, </li> <li>Digest algorithm: SHA-1, SHA256, </li> <li>Message Authentication Code (MAC): HMAC, CBCMAC, CMAC </li> <li>Random number generator (RNG): FIPS186, X9.17, </li> <li>Public key cryptography: RSA, DSA, ECC, CPK, IBE </li> </ul> <p>功能特性:</p> <ul> <li>Performance heavily enhanced. </li> <li>Object oriented architecture, with a single namespace, and you can extend the framework with your own algorithms. </li> <li>Support Init, Upate, Final pattern for bulk data processing for most algorithms. </li> <li>Parllellized computing, even long term operation will not block the browser. </li> <li>Support a key storage interface, with multiple implementations. </li> <li>Support local file system access, users can upload a local file into the browser DOM tree and then processed with <strong>jscrypto</strong> algorithms. </li> </ul> <p>这个库也可以在 ActionScript 下使用。</p> <p>示例代码:</p> <p></p> <pre class="brush:javascript; toolbar: true; auto-links: false;">var cipher = jscrypto.aes; var key = 'password'; var iv = 'initialvector'; var encryptor = new jscrypto.cbcmode.encryptor(cipher, key, iv); var ctext = new Array(); ctext.concat(encryptor.update('hello')); ctext.concat(encryptor.update('world')); ctext.concat(encryptor.final()); document.write(ctext);</pre> <p><strong>项目主页:</strong><a href="http://www.open-open.com/lib/view/home/1328022669327" target="_blank">http://www.open-open.com/lib/view/home/1328022669327</a></p> <p></p>