This is a multi-part message in MIME format.
------=_NextPart_000_0008_01CA9B53.F61D32E0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi,
I am having encode & decode functions in C.
Will get an encoded value in vb.net & this must be decoded using vb.net =
code.=20
How can I apply this?
The decode function in C is
/*Decode function to decode the incoming buffer containing encoded =
data*/
void decode(char *inbuf,int sizeInbuffer,char *outbuf,int =
*decodeoutbufsize)
{
/*Local Declaration*/=20
unsigned char in[4], out[3], v;
int i, len,j;
int counter=3D0;
int a1=3D0;
for(j=3D0;j<sizeInbuffer;j=3Dj+4)
{
for( len =3D 0, i =3D 0; i < 4; i++ )=20
{
v =3D 0;
while(v=3D=3D0)
{
v=3D(unsigned char) inbuf[counter++];
v =3D (unsigned char) ((v < 43 || v > 122) ? 0 : cd64[ v - 43 ]);
if( v )=20
{
v =3D (unsigned char) ((v =3D=3D '$') ? 0 : v - 61);
}
}
len++;
if( v )=20
{
in[ i ] =3D (unsigned char) (v - 1);
}
}
if( len )=20
{
decodeblock( in, out );
memcpy(outbuf+a1,out,3);
// printf("%d",strlen(outbuf));
a1+=3D3;
}
}
*decodeoutbufsize =3D a1; //Done at SetDecodedLengthForOrderMsg(). =
Subtract by 2 since we have only 439 bytes, Last 1 byte also decoded =
with more than one byte(i.e, two bytes).
return;
}
--=20
Regards
Valli
------=_NextPart_000_0008_01CA9B53.F61D32E0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.6000.16945" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT size=3D2>Hi,</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>I am having encode & decode functions in =
C.</FONT></DIV>
<DIV><FONT size=3D2>Will get an encoded value in vb.net & this must =
be decoded=20
using vb.net code. </FONT></DIV>
<DIV><FONT size=3D2>
<DIV><FONT size=3D2>How can I apply this?</FONT></DIV>
<DIV> </DIV></FONT></DIV>
<DIV><FONT size=3D2>The decode function in C is</FONT></DIV>
<DIV><FONT size=3D2></FONT><BR><FONT size=3D2>/*Decode function to =
decode the=20
incoming buffer containing encoded data*/<BR>void decode(char *inbuf,int =
sizeInbuffer,char *outbuf,int =
*decodeoutbufsize)<BR>{<BR> /*Local=20
Declaration*/ <BR> unsigned char in[4], out[3],=20
v;<BR> int i, len,j;<BR> int =
counter=3D0;<BR> int=20
a1=3D0;</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT=20
size=3D2> for(j=3D0;j<sizeInbuffer;j=3Dj+4)<BR> =
{<BR> for(=20
len =3D 0, i =3D 0; i < 4; i++ )=20
<BR> {<BR> v =3D=20
0;<BR> while(v=3D=3D0)<BR> =
{<BR> v=3D(unsigned=20
char) inbuf[counter++];<BR> v =3D (unsigned =
char) ((v=20
< 43 || v > 122) ? 0 : cd64[ v - 43=20
]);<BR> if( v )=20
<BR> {<BR> &nbs=
p;v =3D=20
(unsigned char) ((v =3D=3D '$') ? 0 : v -=20
61);<BR> }<BR> }<BR>&=
nbsp; len++;<BR> if(=20
v ) <BR> {<BR> in[ i =
] =3D=20
(unsigned char) (v -=20
1);<BR> }<BR> }</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2> if( len )=20
<BR> {<BR> decodeblock( in, out=20
);<BR> memcpy(outbuf+a1,out,3);<BR> &nb=
sp;// printf("%d",strlen(outbuf));<BR> a1+=3D=
3;<BR> }<BR> }</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2> *decodeoutbufsize =3D a1; //Done at =
SetDecodedLengthForOrderMsg(). Subtract by 2 since we have only 439 =
bytes, Last=20
1 byte also decoded with more than one byte(i.e, two=20
bytes).<BR> return;<BR>}<BR></FONT></DIV>
<DIV><FONT size=3D2></FONT><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2></FONT><BR><FONT size=3D2>--=20
<BR>Regards<BR>Valli</FONT></DIV></BODY></HTML>
------=_NextPart_000_0008_01CA9B53.F61D32E0--
|