在java中可以这样写,但是现在我想在asp中实现同样的效果
tb是个字符,在java中可以这样写,但是现在我想在asp中实现这个效果
tmp=(char)((tb>>>4)&0x000f);
if(tmp>=10)
high=(char)('a'+tmp-10);
else
high=(char)('0'+tmp);
result+=high;
tmp=(char)(tb&0x000f);
if(tmp>=10)
low=(char)('a'+tmp-10);
else
low=(char)('0'+tmp);
result+=low;
问题点数:20、回复次数:5Top
1 楼karma(无为MS MVP)回复于 2002-04-02 13:11:16 得分 20
tmp=(char)((tb>>>4)&0x000f);
===> tmp = (CLNG(tb) / 16) mod 16
if(tmp>=10)
high=(char)('a'+tmp-10);
===> high = chr(asc("a") + tmp - 10)
else
high=(char)('0'+tmp);
===> high = chr(asc("0") + tmp)
result+=high;
===> result = result & high
tmp=(char)(tb&0x000f);
===> tmp = tb mod 16
if(tmp>=10)
low=(char)('a'+tmp-10);
===> low = chr(asc("a") + tmp - 10)
else
low=(char)('0'+tmp);
===> low = chr(asc("0") + tmp)
result+=low;
===>result = result & low
Top
2 楼skyonline(山中过客)回复于 2002-04-02 13:25:34 得分 0
多谢,我来看看
tmp = (CLNG(tb) / 16) mod 16
好想不能执行???
Top
3 楼karma(无为MS MVP)回复于 2002-04-02 13:39:12 得分 0
what is in your tb? if it is a character, try
tmp = (asc(tb) / 16) mod 16
Top
4 楼skyonline(山中过客)回复于 2002-04-02 13:47:31 得分 0
<%
funMAC("hello world!") 'Call function
Function funMAC(sourceByte)
Dim stringlen,i 'len is the sourceByte length and i is a counter
Dim tb 'tb is a byte of subsourceByte
Dim high,tmp,low
Dim result 'result is the return value
stringlen=len(sourceByte)
for i=0 to stringlen-1
tb=Mid(sourceByte,i+1,i+1)
response.write asc(tb)
'tmp=CLng(tb)/16
next
'response.write result
End Function
%>Top
5 楼skyonline(山中过客)回复于 2002-04-02 13:56:05 得分 0
好象行了 ,..............Top




