java
public static String convertMsb(String S){
LinkedList<String> queue = new LinkedList<String>();
int length = S.length()/2;
for (int i = 0; i < length; i++) {
String ss = S.substring(0,2);
queue.addFirst(ss);
S = S.substring(2);
}
String join = String.join("", queue);
return join;
}
测试一下:
java
@Test
public void test2() {
String S = "63720228582810F7595D38FEFD839935A76197DC31ABB3CB2EA5FF5A61A89D13DA89BB67CEAD92FAA8CA21A94D8C2B80D3ADE7F99938C5EDDD404F972FC5EC950ECCBBDA28F9D6FBCB7195E321055467DB64C31C367E07D3B7CF399CE8D083A4DC6297FD77E79F2F94B50856FA3F411BAA58A53EA054F9DDA5CC46DD0340D7CC";
// 转换成 ccd74003dd46cca5ddf954a03ea558aa1b413ffa5608b5942f9fe777fd9762dca483d0e89c39cfb7d3077e361cc364db67540521e39571cbfbd6f928dabbcc0e95ecc52f974f40ddedc53899f9e7add3802b8c4da921caa8fa92adce67bb89da139da8615affa52ecbb3ab31dc9761a7359983fdfe385d59f710285828027263
String s = convertMsb(S);
System.out.println("s = " + s);
}
走该分支
e = publicArea->parameters.rsaDetail.exponent;
if(e == 0)
e = RSA_DEFAULT_PUBLIC_EXPONENT;
e= 65537
keySizeInBits = publicArea->parameters.rsaDetail.keyBits;
2048
LIB_EXPORT int
Msb(
crypt_uword_t word
)
{
int retVal = -1;
//
#if RADIX_BITS == 64
if(word & 0xffffffff00000000) { retVal += 32; word >>= 32; }
#endif
if(word & 0xffff0000) { retVal += 16; word >>= 16; }
if(word & 0x0000ff00) { retVal += 8; word >>= 8; }
if(word & 0x000000f0) { retVal += 4; word >>= 4; }
if(word & 0x0000000c) { retVal += 2; word >>= 2; }
if(word & 0x00000002) { retVal += 1; word >>= 1; }
return retVal + (int)word;
}
BnMath.c
LIB_EXPORT int
BnLsb(
bigConst bn
);