[摘要]end) int res; ...
end)
{
int res;
//this is a bit inefficient at the end point
//worth it for the small decrease in code size?
res=(enc[0]<<16)+(enc[1]<<8)+enc[2];
int b;
int lowestbit=18-(j*6);
for(int toshift=18;toshift>=lowestbit;toshift-=6)
{
b=res>>>toshift;
b&=63;
if(b>=0&&b<26)
sb.append((char)(b+65));
if(b>=26&&b<52)
sb.append((char)(b+71));
if(b>=52&&b<62)
sb.append((char)(b-4));
if(b==62)
sb.append(''+'');
if(b==63)
sb.append(''/'');
if(sb.length()%76==0)
sb.append(''\n'');
}
//now set the end chars to be pad character if there
//was less than integral input (ie: less than 24 bits)
if(end)
{
if(j==1)
sb.append("==");
if(j==2)
sb.append(''='');
}
enc[0]=0;enc[1]=0;enc[2]=0;
j=0;
}
}
return sb.toString();
}
}
关键词:在jsp中作HTTP认证的办法