更新记录

1.2.0(2023-10-07)

本次主要更新: 1.andorid 修复获取sha265 有些文件返回63位

1.1.0(2023-05-17)

本次主要更新:

  1. ios 优化 获取超大文件 2.andorid 增加获取App的MD5、SHA1、SHA256

1.0.0(2023-05-05)

新版首发

查看更多

平台兼容性

Android Android CPU类型 iOS
适用版本区间:4.4 - 12.0 armeabi-v7a:支持,arm64-v8a:支持,x86:支持 适用版本区间:11 - 16

原生插件通用使用流程:

  1. 购买插件,选择该插件绑定的项目。
  2. 在HBuilderX里找到项目,在manifest的app原生插件配置中勾选模块,如需要填写参数则参考插件作者的文档添加。
  3. 根据插件作者的提供的文档开发代码,在代码中引用插件,调用插件功能。
  4. 打包自定义基座,选择插件,得到自定义基座,然后运行时选择自定义基座,进行log输出测试。
  5. 开发完毕后正式云打包

付费原生插件目前不支持离线打包。
Android 离线打包原生插件另见文档 https://nativesupport.dcloud.net.cn/NativePlugin/offline_package/android
iOS 离线打包原生插件另见文档 https://nativesupport.dcloud.net.cn/NativePlugin/offline_package/ios

注意事项:使用HBuilderX2.7.14以下版本,如果同一插件且同一appid下购买并绑定了多个包名,提交云打包界面提示包名绑定不一致时,需要在HBuilderX项目中manifest.json->“App原生插件配置”->”云端插件“列表中删除该插件重新选择


KJ-HashCode

获取超大(测试过1G)文件或App的MD2、MD4、MD5、SHA1、SHA256、SHA384、SHA512、hash值(ios、android)

使用

<template>
    <view class="content">
        <button type="primary" @click="getMD2">获取文件MD2(ios)</button>
        <view class="json">{{MD2}}</view>
        <button type="primary" @click="getMD4">获取文件MD4(ios)</button>
        <view class="json">{{MD4}}</view>
        <button type="primary" @click="getMD5">获取文件MD5</button>
        <view class="json">{{MD5}}</view>
        <button type="primary" @click="getSHA1">获取文件SHA1</button>
        <view class="json">{{SHA1}}</view>
        <button type="primary" @click="getSHA256">获取文件SHA256</button>
        <view class="json">{{SHA256}}</view>
        <button type="primary" @click="getSHA384">获取文件SHA384</button>
        <view class="json">{{SHA384}}</view>
        <button type="primary" @click="getSHA512">获取文件SHA512</button>
        <view class="json">{{SHA512}}</view>
        <button type="primary" @click="getAppMD5">获取App的MD5(android)</button>
        <view class="json">{{AppMD5}}</view>
        <button type="primary" @click="getAppSHA1">获取App的SHA1(android)</button>
        <view class="json">{{AppSHA1}}</view>
        <button type="primary" @click="getAppSHA256">获取App的SHA256(android)</button>
        <view class="json">{{AppSHA256}}</view>
    </view>
</template>

<script>
    const KJHashCode = uni.requireNativePlugin('KJ-HashCode');
    export default {
        data() {
            return {
                MD2: '',
                MD4: '',
                MD5: '',
                SHA1: '',
                SHA256: '',
                SHA384: '',
                SHA512: '',
                AppMD5: '',
                AppSHA1: '',
                AppSHA256: '',
                filePath: plus.io.convertLocalFileSystemURL("static/logo.png")
            }
        },
        onLoad() {
            if (plus.os.name == 'Android') {
                this.getAppMD5();
                this.getAppSHA1();
                this.getAppSHA256();
            } else {
                this.getMD2();
                this.getMD4();
            }
            this.getMD5();
            this.getSHA1();
            this.getSHA256();
            this.getSHA384();
            this.getSHA512();
        },
        methods: {
            getMD2() {
                var dic = {
                    "filePath": this.filePath
                }
                KJHashCode.getMD2(dic, (res) => {
                    console.log("getMD2:" + JSON.stringify(res));
                    this.MD2 = JSON.stringify(res)
                })
            },
            getMD4() {
                var dic = {
                    "filePath": this.filePath
                }
                KJHashCode.getMD4(dic, (res) => {
                    console.log("getMD4:" + JSON.stringify(res));
                    this.MD4 = JSON.stringify(res)
                })
            },
            getMD5() {
                var dic = {
                    "filePath": this.filePath
                }
                KJHashCode.getMD5(dic, (res) => {
                    console.log("getMD5:" + JSON.stringify(res));
                    this.MD5 = JSON.stringify(res)
                })
            },
            getSHA1() {
                var dic = {
                    "filePath": this.filePath
                }
                KJHashCode.getSHA1(dic, (res) => {
                    console.log("getSHA1:" + JSON.stringify(res));
                    this.SHA1 = JSON.stringify(res)
                })
            },
            getSHA256() {
                var dic = {
                    "filePath": this.filePath
                }
                KJHashCode.getSHA256(dic, (res) => {
                    console.log("getSHA256:" + JSON.stringify(res));
                    this.SHA256 = JSON.stringify(res)
                })
            },
            getSHA384() {
                var dic = {
                    "filePath": this.filePath
                }
                KJHashCode.getSHA384(dic, (res) => {
                    console.log("getSHA384:" + JSON.stringify(res));
                    this.SHA384 = JSON.stringify(res)
                })
            },
            getSHA512() {
                var dic = {
                    "filePath": this.filePath
                }
                KJHashCode.getSHA512(dic, (res) => {
                    console.log("getSHA512:" + JSON.stringify(res));
                    this.SHA512 = JSON.stringify(res)
                })
            },
            getAppMD5() {
                KJHashCode.getAppMD5((res) => {
                    console.log("getAppMD5:" + JSON.stringify(res));
                    this.AppMD5 = JSON.stringify(res)
                })
            },
            getAppSHA1() {
                KJHashCode.getAppSHA1((res) => {
                    console.log("getAppSHA1:" + JSON.stringify(res));
                    this.AppSHA1 = JSON.stringify(res)
                })
            },
            getAppSHA256() {
                KJHashCode.getAppSHA256((res) => {
                    console.log("getAppSHA256:" + JSON.stringify(res));
                    this.AppSHA256 = JSON.stringify(res)
                })
            }
        }
    }
</script>
<style>
    .json {
        word-wrap: break-word;
    }
</style>

隐私、权限声明

1. 本插件需要申请的系统权限列表:

2. 本插件采集的数据、发送的服务器地址、以及数据用途说明:

插件不采集任何数据

3. 本插件是否包含广告,如包含需详细说明广告表达方式、展示频率:

使用中有什么不明白的地方,就向插件作者提问吧~ 我要提问