# crypto-js **Repository Path**: zhao-hui7000/crypto-js ## Basic Information - **Project Name**: crypto-js - **Description**: 加密算法类库,目前支持MD5、SHA-1、SHA-256、HMAC、HMAC-MD5、HMAC-SHA1、HMAC-SHA256、PBKDF2等 - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 4 - **Created**: 2022-04-09 - **Last Updated**: 2024-05-31 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # crypto-js **本项目是基于开源项目crypto-js的功能进行ets开发,可以通过项目标签以及github地址( https://github.com/brix/crypto-js )追踪到原项目版本** #### 项目介绍 - 项目名称:crypto-js - 所属系列:ohos的第三方组件ets开发 - 功能:加密算法类库,可以非常方便的在前端进行其所支持的加解密操作。目前crypto-js已支持的算法有:MD5、SHA-1、SHA-256、HMAC、HMAC-MD5、HMAC-SHA1、HMAC-SHA256、PBKDF2等。 - 项目开发状态:完成 - 调用差异:无 - 项目作者和维护人:hihope - 联系方式:hihope@hoperun.com - 原项目Doc地址:https://github.com/brix/crypto-js - 原项目基线版本:4.1.1; sha1:4dcaa7afd08f48cd285463b8f9499cdb242605fa - 编程语言:ets - 外部库依赖:无 #### 效果展示: #### 安装教程 ##### 方案一: 1. 下载crypto-js源码。 2. 拷贝crypto-js源码中crypto-js目录代码到default目录下。 3. 在demo中引用。 #### 使用说明 1、在page页面引入依赖 ``` import md5 from '../crypto-ts/md5.ets' import sha1 from '../crypto-ts/sha1.ets' import sha256 from '../crypto-ts/sha256.ets' import sha512 from '../crypto-ts/sha512.ets' import ripemd160 from '../crypto-ts/ripemd160.ets' ``` 2、md5 ``` md5.prototype.hex_md5('message') ``` 3、sha1 ``` sha1.prototype.hex_sha1('message'); ``` 4、sha256 ``` sha256.prototype.hex_sha256('message') ``` 5、sha512 ``` sha512.prototype.hex_sha512('message') ``` 6、ripemd160 ``` ripemd160.prototype.hex_rmd160('message') ``` 7、hmac-md5 ``` md5.prototype.hex_hmac_md5('message', 'pwd') ``` 8、hmac-sha1 ``` sha1.prototype.hex_hmac_sha1('message', 'pwd') ``` 9、hmac-sha256 ``` sha256.prototype.hex_hmac_sha256('message', 'pwd') ``` 10、hmac-sha512 ``` sha512.prototype.hex_hmac_sha512('message', 'pwd') ``` 11、hmac-ripemd160 ``` ripemd160.prototype.hex_hmac_rmd160('message', 'pwd') ``` #### 版本迭代 - v1.0.0 - 已实现功能 1. md5 2. sha1 3. sha256 4. sha512 5. ripemd160 6. hmac-md5 7. hmac-sha1 8. hmac-sha256 9. hmac-sha512 10. hmac-ripemd160 #### 版权和许可信息 ``` /* * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ ```