1 Star 0 Fork 33

xileilei / crypto-js

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

crypto-js

简介

加密算法类库,可以非常方便的在前端进行其所支持的加解密操作。目前crypto-js已支持的算法有:MD5、SHA-1、SHA-256、HMAC、HMAC-MD5、HMAC-SHA1、HMAC-SHA256、PBKDF2等。

preview.gif

下载安装

npm install @ohos/crypto-js --save

OpenHarmony npm环境配置等更多内容,请参考 如何安装OpenHarmony npm包

使用说明

  1. 引入依赖
  import { md5 } from '@ohos/crypto/'
  import { sha1 } from '@ohos/crypto/'
  import { sha256 } from '@ohos/crypto/'
  import { sha512 } from '@ohos/crypto/'
  import { ripemd160 } from '@ohos/crypto/'
  1. md5
  md5.prototype.hex_md5('message')
  1. sha1
  sha1.prototype.hex_sha1('message');
  1. sha256
  sha256.prototype.hex_sha256('message')
  1. sha512
  sha512.prototype.hex_sha512('message')
  1. ripemd160
  ripemd160.prototype.hex_rmd160('message')
  1. hmac-md5
  md5.prototype.hex_hmac_md5('message', 'pwd')
  1. hmac-sha1
  sha1.prototype.hex_hmac_sha1('message', 'pwd')
  1. hmac-sha256
  sha256.prototype.hex_hmac_sha256('message', 'pwd')
  1. hmac-sha512
  sha512.prototype.hex_hmac_sha512('message', 'pwd')
  1. hmac-ripemd160
  ripemd160.prototype.hex_hmac_rmd160('message', 'pwd')

接口说明

  1. md5加密 md5.hex_md5(s)
  2. sha1加密 sha1.hex_sha1(s)
  3. sha256加密 sha256.hex_sha256(s)
  4. sha512加密 sha512.hex_sha512(s)
  5. ripemd160加密 ripemd160.hex_rmd160(s)

兼容性

支持 OpenHarmony API version 8 及以上版本。

目录结构

|---- crypto-js  
|     |---- entry  # 示例代码文件夹
|     |---- crypto  # crypto-js库文件夹
|         |---- src
|             |---- main
|                 |---- ets
|                     |---- md5.ets  # md5加密类
|                     |---- ripemd160.ets  # ripemd160加密类
|                     |---- sha1.ets  # sha1加密类
|                     |---- sha256.ets  # sha256加密类
|                     |---- sha512.ets  # sha512加密类
|          |---- index.ets  # 对外接口
|     |---- README.md  # 安装使用方法                    

贡献代码

使用过程中发现任何问题都可以提 Issue 给我们,当然,我们也非常欢迎你给我们发 PR

开源协议

本项目基于 MIT ,请自由地享受和参与开源。

# License [The MIT License (MIT)](http://opensource.org/licenses/MIT) Copyright (C) 2022 Huawei Device Co., Ltd. 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.

简介

暂无描述 展开 收起
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/xileilei/crypto-js.git
git@gitee.com:xileilei/crypto-js.git
xileilei
crypto-js
crypto-js
master

搜索帮助