Posted January 22, 201312 yr Hey Comuntity I try my luck in Cpp now have i a problem with Miracl miracl *mip=mirsys(256, 0); mip->IOBASE=16; big t=mirvar(0); cinstr(t, "666AAA422FDF79E1D4E41EDDC4D42C51"); mip->IOBASE=64; cotstr(t, buff); // ZmqqQi/feeHU5B7dxNQsUQ mirkill(t); I try to convert a base 16 string "666AAA422FDF79E1D4E41EDDC4D42C51"to base 64 "ZmqqQi/feeHU5B7dxNQsUQ" Have any an idea why i have the wrong result? Regards,
January 22, 201312 yr Base64 string "ZmqqQi/feeHU5B7dxNQsUQ" decodes to byte sequence "66 6A AA 42 2F DF 79 E1 D4 E4 1E DD C4 D4 2C 51", so it looks correct. What is the expected result?
January 22, 201312 yr Author Hi Thanks for your answhere I have a Hex sequence "666AAA422FDF79E1D4E41EDDC4D42C51" it is base 16 now i would likeconvert to base 64 "ZmqqQi/feeHU5B7dxNQsUQ" with the Miracl Try Rsa Tool it give me a result "ZmqqQi/feeHU5B7dxNQsUQ" Edited January 22, 201312 yr by ragdog
January 22, 201312 yr http://andrewl.dreamhosters.com/crackmes_solutions/c00lw0lf_KeygenMe1_sol_andrewl.cpp
January 22, 201312 yr Author Is this Base 64 no It use only IOBASE 16 And i need help to convert a IOBASE 16 string to output IOBASE 64 Edited January 22, 201312 yr by ragdog
January 22, 201312 yr Important: Base64 number format is not supported by MIRACL. I used ownroutines. Conversion goes from MSB to LSB of the hex representation ofeach number. This may be incompatible with conversion routines of yourfavourite lib.Sourcecode in C for the base64 conversion comes bundled withthis Tool.
January 23, 201312 yr Author Hi Is this from a older Miracl Sdk? In the last Sdk can i read Version 4.7.4Base64 I/O supported. Just set IOBASE=64 before input/output I have test with older Miracl sdk (*.lib) And I have different results with the same code in my projectHas the last sdk an error by base 64? String to convert = 2E4E30DABOutput = Lk4w2r older miraclOutput = AALk4w2r last miracl Regards, Edited January 23, 201312 yr by ragdog
January 23, 201312 yr Is it 02E4E30DAB or 2E4E30DAB0 ?You didn't gave a pair number of characters, meaning you omitted a char or a zero. In this case, the first output took away the last char because it was alone so not a byte (2E4E30DA) and in the second case it took it as 02E4E30DAB but it adds a null byte first (IDK why).The first output could be correct (it depends on the using), the second output (I think) is the good interpretation but it adds "00".Try to convert : 02E4E30DAB (it should works, if you want to put it for every string, adds a if (str.length % 2 == 1) { str.insert(0,'0') } Edited January 23, 201312 yr by mArTi
January 23, 201312 yr Author This is wrong a older Miracl.lib v4x works but not the last 5x make this padding on start AAa correct base64 ends with padding ==
January 23, 201312 yr A correct Base64 string has not to end by == : it can end without anything, with a = or with ==.Base64 encodes 6 bits by char, and we use bytes which are 8 bits. Each "=" means that we added 2 zero bits to fill the last base64 6-bits char. Ex: you want to encode A (0x41) : 01000001. Base64 needs to encode on 6 chars :First base 64 char will be the one that correspond to 010000 ("Q"). Now there's still "01" to encode but it's meant to be by 6 bits, so we add arbitrary "0000" to make it 6 bits : 010000 (again "Q"). So there we have QQ, but we need to tell that we put 4 bits to fill the last char, so we add 2 = : it will be "QQ==".If you just put "QQ", it may means "010000 010000" which will give the byte A then a not complete byte (0000????). But usually base64 decoder are just taking bits by 8 and don't care of "=" (a not complete byte is nonsense, a good base64 decoder will output "A" for "QQ","QQ=" and "QQ=="). The funny thing is that we use this encoding usually in ascii, so the base64 characters are encoded on 8 bits while they have a 6-bits information, meaning that when we use it in ascii system we waste 2 bits/char. Edited January 23, 201312 yr by mArTi
January 23, 201312 yr Author Ok i found the solution, Convert to a Base 64 and is it a bug in the Miracl sdkThanks to all ,which have tried to help. regards Edited January 23, 201312 yr by ragdog
Create an account or sign in to comment