TZ Zhuang · Mar 30 go to post

乔总的代码有个小问题,他在做字节转换的时候没有检查长度。如果是小于10的情况,也就是长度为1,需要前面补一个0.

s x=$system.Encryption.SHA1Hash("123456")
s hashs="" 
f i=1:1:$l(x) {
	s tmp=$zh(+$a($e(x,i)))
	if ($l(tmp) = 1) {
		s tmp = "0"_tmp
	}
	s hashs=hashs_tmp
}
w hashs