文件名称:
VB ASP MD5 SHA HMAC AES GZIP BASE64 微信公众号EncodingAESKey 十全大补DLL
开发工具:
文件大小: 272kb
下载次数: 0
上传时间: 2016-01-16
详细说明: CNBJX-原创函数,首发CSND 3.1 Base64 ------------------------------------------------------------------------------- Base64Decode(Str) Base64DecodeRaw(Str) as byte() Base64Encode(Str) FileBase64(file) 3.2 Hex ------------------------------------------------------------------------------- HexDecode(Str) HexDecodeRaw(Str) as byte() HexEncode(Str) File2Hex(file) 3.3 hash String ------------------------------------------------------------------------------- stringOrByte : 可以是字条串或字节数组 ChatSet : 可选,指定编码 MD2(stringOrByte, [Chat Set As String]) As String MD4(stringOrByte, [ChatSet As String]) As String MD5(stringOrByte, [ChatSet As String]) As String SHA1(stringOrByte, [ChatSet As String]) SHA256(stringOrByte, [ChatSet As String]) As String SHA384(stringOrByte, [ChatSet As String]) As String SHA512(stringOrByte, [ChatSet As String]) As String 3.4 hash Byte ------------------------------------------------------------------------------- abytData : 字节数组 asp里请加()号 如: bytes="" md5_byte((bytes),0,0) 可选参数 iStart iEnd 默认为0,取整个 bytes的hash值 ---------------------------------------------------- [可选] iStart: 起始位置 [可选] iEnd:结束位置 分块取值有几种情况 1: iStart = 0 , iEnd = 1024 * 1024 * 1 '读取前面1M 2: iStart = -1024 * 1024 * 1 , iEnd = 0 '读取后面1M 3: iStart = 10, iEnd = iStart + 10 '读取第10个字节后的10个字节 (10-20) 4: iStart = -20,iEnd = -10 '读取尾部 (-20 -> -10 的字节) ---------------------------------------------------- MD2_Byte(abytData As Array(Byte), [iStart As Double = 0], [iEnd As Double = 0]) As String MD4_Byte(abytData As Array(Byte), [iStart As Double = 0], [iEnd As Double = 0]) As String MD5_Byte(abytData As Array(Byte), [iStart As Double = 0], [iEnd As Double = 0]) As String SHA1_Byte(abytData As Array(Byte), [iStart As Double = 0], [iEnd As Double = 0]) As String SHA256_Byte(abytData As Array(Byte), [iStart As Double = 0], [iEnd As Double = 0]) As String SHA384_Byte(abytData As Array(Byte), [iStart As Double = 0], [iEnd As Double = 0]) As String SHA512_Byte(abytData As Array(Byte), [iStart As Double = 0], [iEnd As Double = 0]) As String 3.5 hash file ------------------------------------------------------------------------------- MD2_file(fileName As String, [iStart As Double = 0], [iEnd As Double = 0]) As String MD4_file(fileName As String, [iStart As Double = 0], [iEnd As Double = 0]) As String MD5_file(fileName As String, [iStart As Double = 0], [iEnd As Double = 0]) As String SHA1_file(fileName As String, [iStart As Double = 0], [iEnd As Double = 0]) As String SHA256_file(fileName As String, [iStart As Double = 0], [iEnd As Double = 0]) As String SHA384_file(fileName As String, [iStart As Double = 0], [iEnd As Double = 0]) As String SHA512_file(fileName As String, [iStart As Double = 0], [iEnd As Double = 0]) As String 3.6 hash hmac ------------------------------------------------------------------------------- 依赖系统mscorlib.dll,就是说系统必须安装NET Framework 组件 默认输出16进制值,可指定 output: hex base64 raw ---------------------------------------------------- MD5_HMAC(skey As String, data, [output As String = "hex"]) SHA1_HMAC(skey As String, data, [output As String = "hex"]) SHA256_HMAC(skey As String, data, [output As String = "hex"]) SHA384_HMAC(skey As String, data, [output As String = "hex"]) SHA512_HMAC(skey As String, data, [output As String = "hex"]) 3.6 hash 完整调用 ------------------------------------------------------------------------------- algo : md2 md4 md5 sha1 sha256 sha384 sha512 hmac 计算时不支持 md2 md4 ---------------------------------------------------- Hash(algo, stringOrByte, [ChatSet As String]) Hash_Byte(algo, abytData As Array(Byte), [iStart As Double = 0], [iEnd As Double = 0]) As String Hash_file(algo, fileName, [iStart As Double = 0], [iEnd As Double = 0]) As String Hash_HMAC(algo As String, skey As String, data, [output As String = "hex"]) 3.7 字节和字符串相互转换 ------------------------------------------------------------------------------- Byte2String(dataByte, [ChatSet As String]) As String String2Byte(dataStr As String, [ChatSet As String]) As Array(Byte) getFileBytes(fileName) As Array(Byte) 3.8 文件拆分和合并 ------------------------------------------------------------------------------- 拆分 SourceFile: 源文件 DestinationFile : 目录路径文件 如: d:\test.tmp 生成 test.tmp.001 -> test.tmp.010 有*号 d:\test.*.tmp 生成 test.001.tmp -> test.010.tmp ChunkSize : 拆分字节大小 1024 * 1024 * 10 10M BufferSize: 每次读写的字节数 默认: 256K 1024*256 函数返回: Array(True||False, fileCount, arrayfileName) FileSplit(SourceFile As String, DestinationFile As String, ChunkSize As Double, [BufferSize As Long = 262144]) 合并 mergeSaveFile : 要保存的结果文件 splitFile: 拆分的文件 d:\test.tmp 取 test.tmp.001 -> d:\test.*.tmp 取 test.001.tmp -> Chunks: 文件个数,为0时,自动判断 函数返回: True || False FileMerge(mergeSaveFile As String, splitFile As String, [Chunks As Long = 0], [BufferSize As Long = 262144]) 3.9 Gzip解压和压缩 ------------------------------------------------------------------------------- GunZip(ByteArray As Array(Byte), [ChatSet As String = "UTF-8"]) As String GZip(stringOrByte, [ChatSet As String = "UTF-8"]) As Array(Byte) 3.10 AES函数 (依赖系统mscorlib.dll,就是说系统必须安装NET Framework 组件) ------------------------------------------------------------------------------- A. AES/CBC/PKCS7 encrypt(data, privateKey) 加密 AES/CBC/PKCS7 128位模式 decrypt(data, privateKey) 解密 AES/CBC/PKCS7 128位模式 解密 B. AES/CBC/ZERO encrypt_cbc_zero_128(data, privateKey) decrypt_cbc_zero_128(data, privateKey) C. 完整 cipher : CBC CFB CTS ECB OFB [默认:CBC] paddingmode : ANSIX923 ISO10126 NONE PKCS7 ZEROS [默认:PKCS7] 注: privateKey iv 程序做了自动修正 根据:KeySize BlockSize 长度,自动截取或补chr(0) mcrypt_encrypt(cipher, privateKey, data, paddingmode, iv, [KeySize As Long = 128], [BlockSize As Long = 128]) mcrypt_decrypt(cipher, privateKey, data, paddingmode, iv, [KeySize As Long = 128], [BlockSize As Long = 128], [output As String = "raw"]) 3.11 微信公众号消息加解密 ------------------------------------------------------------------------------- 注: wxDecrypt 解密时,如from_appid <> appid , 返回 "" 值 wxEncrypt(msgtext As String, encodingAesKey As String, appId As String) As String wxDecrypt(msgtext As String, encodingAesKey As String, appId As String) As String wxSignature(Token As String, timestamp As String, nonce As String, msg_encrypt As String) As String ...展开收缩
(系统自动生成,下载前可以参看下载内容)
下载文件列表
相关说明
- 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
- 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度。
- 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
- 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
- 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
- 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.