hex

Converting a Hex String to an image file [duplicate]

折月煮酒 提交于 2021-01-27 07:08:55
问题 This question already has answers here : Convert a string representation of a hex dump to a byte array using Java? (24 answers) Closed 3 years ago . I have a requirement to read a Hex String with leading zeros which represents a JPEG file, from an xml file received and save it as an image file. The image data looks like 0000005000000050FF191818FF151715FF111413FF0E1...........................FF2A2322FF292221 In xml file The length of String between the tag is 51216 I read the Hex data in

Converting a Hex String to an image file [duplicate]

久未见 提交于 2021-01-27 07:04:38
问题 This question already has answers here : Convert a string representation of a hex dump to a byte array using Java? (24 answers) Closed 3 years ago . I have a requirement to read a Hex String with leading zeros which represents a JPEG file, from an xml file received and save it as an image file. The image data looks like 0000005000000050FF191818FF151715FF111413FF0E1...........................FF2A2322FF292221 In xml file The length of String between the tag is 51216 I read the Hex data in

基于机智云物联网平台MCU模式基础教程及远程OTA

对着背影说爱祢 提交于 2021-01-26 19:42:31
编写背景: 用户如果将开发了的产品发布上线销售,后期需要更新固件和程序,就需要用到远程OTA固件升级,就能对已发布的产品进行远程升级。 材料准备: 1. 机智云 4G模组GC211,此模组采用中移模组ML302,需烧录机智云 GAgent 固件,可在机智云淘宝店铺购买或者联系商务获取,此模组支持网络,移动,联通,电信4G网络,可前往机智云官方和淘宝店铺购买。 https://shop159680395.taobao.com/ 2.秉火【F103开发板-指南者】 正文: 云端部署 创建新产品,可根据自己需求选择。 添加如下数据点,可根据自己需求 生成 STM32 F103代码下载备用 简述STM32 启动 ARM7/ARM9 内核的控制器在复位后,CPU 会从存储空间的绝对地址0x000000 取出第一条指令执行复位中断服务程序的方式启动,即固定了复位后的起始地址为0x000000(PC =0x000000)同时中断向量表的位置并不是固定的。然而,Cortex-M3 内核启动有3 种情况: 1、通过boot 引脚设置可以将中断向量表定位于SRAM 区,即起始地址为0x2000000,同时复位后PC 指针位于0x2000000 处; 2、通过boot 引脚设置可以将中断向量表定位于FLASH 区,即起始地址为0x8000000,同时复位后PC 指针位于0x8000000 处; 3

NodeJS学习笔记 进阶 (2)Nodejs进阶:MD5加密算法(ok)

爱⌒轻易说出口 提交于 2021-01-26 08:24:05
个人总结:这篇文章讲解了Nodejs中自带模块的MD5加密算法的使用,读完这篇文章需要15分钟,其实还有一个叫utility的包在npm上,也非常好用。 摘选自网络 简介 MD5(Message-Digest Algorithm)是计算机安全领域广泛使用的散列函数(又称哈希算法、摘要算法),主要用来确保消息的完整和一致性。常见的应用场景有密码保护、下载文件校验等。 本文先对MD5的特点与应用进行简要概述,接着重点介绍MD5在密码保护场景下的应用,最后通过例子对MD5碰撞进行简单介绍。 特点 运算速度快:对 jquery.js 求md5值,57254个字符,耗时1.907ms 输出长度固定:输入长度不固定,输出长度固定(128位)。 运算不可逆:已知运算结果的情况下,无法通过通过逆运算得到原始字符串。 高度离散:输入的微小变化,可导致运算结果差异巨大。 弱碰撞性:不同输入的散列值可能相同。 应用场景 文件完整性校验:比如从网上下载一个软件,一般网站都会将软件的md5值附在网页上,用户下载完软件后,可对下载到本地的软件进行md5运算,然后跟网站上的md5值进行对比,确保下载的软件是完整的(或正确的) 密码保护:将md5后的密码保存到数据库,而不是保存明文密码,避免拖库等事件发生后,明文密码外泄。 防篡改:比如数字证书的防篡改,就用到了摘要算法。(当然还要结合数字签名等手段)

MySQL DataType--字符串函数

我只是一个虾纸丫 提交于 2021-01-24 13:06:09
1.UPPER和UCASE 返回字符串str,根据当前字符集映射(缺省是ISO-8859-1 Latin1)把所有的字符改变成大写。该函数对多字节是可靠的。 2.LOWER和LCASE 返回字符串str,根据当前字符集映射(缺省是ISO-8859-1 Latin1)把所有的字符改变成小写。该函数对多字节是可靠的。 3.FIND_IN_SET(str,strlist) 如果字符串str在由N子串组成的表strlist之中,返回一个1到N的值。一个字符串表是被“,”分隔的子串组成的一个字符串。如果第一个参数是一个常数字符串并且第二个参数是一种类型为SET的列,FIND_IN_SET()函数被优化而使用位运算!如果str不是在strlist里面或如果 strlist是空字符串,返回0。如果任何一个参数是NULL,返回NULL。如果第一个参数包含一个“,”,该函数将工作不正常。 4.FIELD(str,str1,str2,str3,…) 返回str在str1, str2, str3, …清单的索引。如果str没找到,返回0。FIELD()是ELT()反运算。 SELECT FIELD('A','AB','A','C') --返回2 5.ELT(N,str1,str2,str3,…) 如果N= 1,返回str1,如果N= 2,返回str2,等等。如果N小于1或大于参数个数,返回NULL

Convert this line of Java code to C# code

元气小坏坏 提交于 2021-01-21 06:17:06
问题 I need this line of Java code: Integer.toString(256 + (0xFF & arrayOfByte[i]), 16).substring(1) converted to C# since I'm not sure how to work with "0xFF". EDIT This is the full code: MessageDigest localMessageDigest = MessageDigest.getInstance("SHA-256"); localMessageDigest.update(String.format(Locale.US, "%s:%s", new Object[] { paramString1, paramString2 }).getBytes()); byte[] arrayOfByte = localMessageDigest.digest(); StringBuffer localStringBuffer = new StringBuffer(); for (int i = 0; ; i

Convert this line of Java code to C# code

老子叫甜甜 提交于 2021-01-21 06:15:41
问题 I need this line of Java code: Integer.toString(256 + (0xFF & arrayOfByte[i]), 16).substring(1) converted to C# since I'm not sure how to work with "0xFF". EDIT This is the full code: MessageDigest localMessageDigest = MessageDigest.getInstance("SHA-256"); localMessageDigest.update(String.format(Locale.US, "%s:%s", new Object[] { paramString1, paramString2 }).getBytes()); byte[] arrayOfByte = localMessageDigest.digest(); StringBuffer localStringBuffer = new StringBuffer(); for (int i = 0; ; i

文件 转为16进制 ,16进制转为文件

依然范特西╮ 提交于 2021-01-16 07:01:54
最近在搞文件升级 遇到 16进制转为文件,然后文件转为16进制 下面为代码: 1 import java.io.* ; 2 3 /** 4 * @author ipodao@qq.com 5 * @date 2019/9/4 16:05 6 */ 7 public class ExportFile { 8 private static final String EXPORT_PATH = "C:\\Users\\ipodao\\OneDrive\\文档\\rowan\\1\\" ; 9 10 public static void main(String[] args) { 11 ExportFile apk = new ExportFile(); 12 String infilePath = EXPORT_PATH + "test.zip" ; 13 String outfilePath = EXPORT_PATH + "hex.txt" ; 14 apk.fileToHex(infilePath, outfilePath); 15 // hex val 16 String val = "" ; 17 apk.hexToFile(val, "a.zip" ); 18 } 19 20 /** 21 * 文件转成十六进制 22 * 23 * @param infilePath

UUID简记

99封情书 提交于 2021-01-10 13:19:56
一、概述 wiki上的解释: A universally unique identifier ( UUID ) is a 128-bit number used to identify information in computer systems. 128位的UUID也并非没有重复的可能,理论证明这个重复的概率很小近乎为零以至于可以忽略。 UUID规范的表示格式通常用32个16进制字符表示(也就是"0" / "1" / "2" / "3" / "4" / "5" / "6" / "7" / "8" / "9" /"a" / "b" / "c" / "d" / "e" / "f"这16个字符)。 这32个字符通常被连字符“-”分成5个组(简记为 8-4-4-4-12格式 ),如下: 8a2986cc-256d-470b-bc3d-027113f76553 5个组所表示的含义如下表所示(图表来自wiki): UUID record layout Name Length (bytes) Length (hex digits) Contents time_low 4 8 integer giving the low 32 bits of the time time_mid 2 4 integer giving the middle 16 bits of the time time_hi

nodejs

こ雲淡風輕ζ 提交于 2021-01-10 11:57:05
21、nodejs异步读写文件 https://blog.csdn.net/songmaolin_csdn/article/details/52910771 20、nodejs垃圾回收 node --max_semi_space_size=1 --max_old_space_size=10 1.js --production max_semi_space_size 32 16 max_old_space_size 1.4G 0.7g node --v8-options | grep max dong@ubuntu:~$ node --v8-options | grep max --gvn_iterations (maximum number of GVN fix-point iterations) --max_inlining_levels (maximum number of inlining levels) --max_inlined_source_size (maximum source size in bytes considered for a single inlining) --max_inlined_nodes (maximum number of AST nodes considered for a single inlining) --max_inlined