更新记录
2.0.0(2025-10-19) 下载此版本
-
重构代码结构,修改调用方式。
-
新增
Base64
编码
1.0.0(2025-10-16) 下载此版本
-
实现
['MD5', 'SHA1', 'SHA224', 'SHA256', 'SHA384', 'SHA512']
加密 -
安卓、鸿蒙可用,IOS未测试
平台兼容性
uni-app(4.0)
Vue2 | Vue3 | Chrome | Safari | app-vue | app-nvue | Android | iOS | 鸿蒙 |
---|---|---|---|---|---|---|---|---|
√ | √ | × | × | √ | - | 5.0 | × | 9 |
微信小程序 | 支付宝小程序 | 抖音小程序 | 百度小程序 | 快手小程序 | 京东小程序 | 鸿蒙元服务 | QQ小程序 | 飞书小程序 | 快应用-华为 | 快应用-联盟 |
---|---|---|---|---|---|---|---|---|---|---|
× | × | × | × | × | × | × | × | × | - | - |
uni-app x(4.0)
Chrome | Safari | Android | iOS | 鸿蒙 | 微信小程序 |
---|---|---|---|---|---|
× | × | 5.0 | × | 9 | × |
其他
多语言 | 暗黑模式 | 宽屏模式 |
---|---|---|
√ | √ | √ |
kh-crypto
支持的加密算法
['MD5', 'SHA1', 'SHA224', 'SHA256', 'SHA384', 'SHA512', 'Base64加解密']
使用示例
import * as KhCrypto from '@/uni_modules/kh-crypto'
const input = ref<string>('待加密字符串');
const output = ref<string>('')
// base64加密
result.value = KhCrypto.Base64Encode(inputText.value)
// base64解密
result.value = KhCrypto.Base64Decode(inputText.value)
result.value = KhCrypto.MD5(inputText.value)
result.value = KhCrypto.SHA1(inputText.value)
result.value = KhCrypto.SHA224(inputText.value)
result.value = KhCrypto.SHA256(inputText.value)
result.value = KhCrypto.SHA384(inputText.value)
result.value = KhCrypto.SHA512(inputText.value)
开发说明
- 使用鸿蒙
5.1.0
测试可用
// 使用鸿蒙内置API实现
import { cryptoFramework } from '@kit.CryptoArchitectureKit';
import { buffer } from '@kit.ArkTS';
- 使用安卓
16.0
测试可用
// 使用安卓内置类及kotlin方法实现
import MessageDigest from 'java.security.MessageDigest';
import BigInteger from 'java.math.BigInteger'