Esempio n. 1
0
static void to_binary(char *crypt, char *alt)
{

#define _24bit_from_b64(I,B2,B1,B0) \
  {\
      unsigned char c1=findb64(crypt[I+0]);\
      unsigned char c2=findb64(crypt[I+1]);\
      unsigned char c3=findb64(crypt[I+2]);\
      unsigned char c4=findb64(crypt[I+3]);\
      unsigned int w=c4<<18|c3<<12|c2<<6|c1;\
      unsigned char b2=w&0xff;w>>=8;\
      unsigned char b1=w&0xff;w>>=8;\
      unsigned char b0=w&0xff;w>>=8;\
      alt[B2]=b0;\
      alt[B1]=b1;\
      alt[B0]=b2;\
  }

	_24bit_from_b64(0, 0, 6, 12);
	_24bit_from_b64(4, 1, 7, 13);
	_24bit_from_b64(8, 2, 8, 14);
	_24bit_from_b64(12, 3, 9, 15);
	_24bit_from_b64(16, 4, 10, 5);
	uint32_t w = findb64(crypt[21]) << 6 | findb64(crypt[20]) << 0;
	alt[11] = (w & 0xff);
}
Esempio n. 2
0
//hash indepdendent
static void to_binary(char *crypt, char *alt)
{

#define _24bit_from_b64(I,B2,B1,B0) \
  {\
      uint8_t c1,c2,c3,c4,b0,b1,b2;\
      uint32_t w;\
      c1=findb64(crypt[I+0]);\
      c2=findb64(crypt[I+1]);\
      c3=findb64(crypt[I+2]);\
      c4=findb64(crypt[I+3]);\
      w=c4<<18|c3<<12|c2<<6|c1;\
      b2=w&0xff;w>>=8;\
      b1=w&0xff;w>>=8;\
      b0=w&0xff;w>>=8;\
      alt[B2]=b0;\
      alt[B1]=b1;\
      alt[B0]=b2;\
  }
	uint32_t w;
	_24bit_from_b64(0, 0, 6, 12);
	_24bit_from_b64(4, 1, 7, 13);
	_24bit_from_b64(8, 2, 8, 14);
	_24bit_from_b64(12, 3, 9, 15);
	_24bit_from_b64(16, 4, 10, 5);
	w = findb64(crypt[21]) << 6 | findb64(crypt[20]) << 0;
	alt[11] = (w & 0xff);
}
static void magic(char *crypt, char *alt)
{

#define _24bit_from_b64(I,B2,B1,B0) \
  {\
      uint8_t c1,c2,c3,c4,b0,b1,b2;\
      uint32_t w;\
      c1=findb64(crypt[I+0]);\
      c2=findb64(crypt[I+1]);\
      c3=findb64(crypt[I+2]);\
      c4=findb64(crypt[I+3]);\
      w=c4<<18|c3<<12|c2<<6|c1;\
      b2=w&0xff;w>>=8;\
      b1=w&0xff;w>>=8;\
      b0=w&0xff;w>>=8;\
      alt[B2]=b0;\
      alt[B1]=b1;\
      alt[B0]=b2;\
  }
	uint32_t w;
	_24bit_from_b64(0, 0, 10, 20);
	_24bit_from_b64(4, 21, 1, 11);
	_24bit_from_b64(8, 12, 22, 2);
	_24bit_from_b64(12, 3, 13, 23);
	_24bit_from_b64(16, 24, 4, 14);
	_24bit_from_b64(20, 15, 25, 5);
	_24bit_from_b64(24, 6, 16, 26);
	_24bit_from_b64(28, 27, 7, 17);
	_24bit_from_b64(32, 18, 28, 8);
	_24bit_from_b64(36, 9, 19, 29);
	w =
	    findb64(crypt[42]) << 12 | findb64(crypt[41]) << 6 |
	    findb64(crypt[40]);
	alt[30] = w & 0xff;
	w >>= 8;
	alt[31] = w & 0xff;
	w >>= 8;
}