Re: [fpc-pascal] How to convert a large integer to base64

2011-01-17 Thread Frank Church
On 15 January 2011 18:52, Henry Vermaak  wrote:

> On 15 January 2011 17:52, Frank Church  wrote:
> >
> > Is there a FCL library that can be used to convert a large integer into
> > base64 format?
>
> Do you know about the base64 unit?
>
>

I have it working now, but I have noticed that if the length of string is
not a multiple of 3, it crashes.

Is there a way of adapting a string with a length that is not a multiple of
3 to allow it to encode, but yet
decode it back to the original string?

The other part is I want to pass the int64 in binary form.

Will a pointer to the integer and setting the length to copy to 8 be the
right approach?

i.e

Encoder.CopyFrom(P^.Integer64Value, 8)

Of course the 8 will generate an error.




Henry
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>



-- 
Frank Church

===
http://devblog.brahmancreations.com
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] How to convert a large integer to base64

2011-01-15 Thread Andreas Schneider
On Saturday, January 15, 2011 21:42 Frank Church wrote:
> I mean int64 into base64 encoding, as in the mime type. 

Oops,  my  bad.  Then yeah, as Henry said the base64 unit should help.
Depending  on  who and how the number is to be decoded then, you could
also  take  a look at strutils.Dec2Numb which can convert from decimal
into any given number system. (... and the opposite Numb2Dec)

-- 
Best Regards,
Andreas

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] How to convert a large integer to base64

2011-01-15 Thread Frank Church
On 15 January 2011 18:31, Andreas Schneider  wrote:

> On Saturday, January 15, 2011 18:52 Frank Church wrote:
>
> > Is there a FCL library that can be used to convert a large integer into
> base64 format?
>
>
> Define  "large  integer"  ... in case you mean a normal integer/int64:
> IntToHex(...);
>
>
I mean int64 into base64 encoding, as in the mime type.

> --
> Best Regards,
> Andreas
>
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>



-- 
Frank Church

===
http://devblog.brahmancreations.com
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] How to convert a large integer to base64

2011-01-15 Thread Henry Vermaak
On 15 January 2011 17:52, Frank Church  wrote:
>
> Is there a FCL library that can be used to convert a large integer into
> base64 format?

Do you know about the base64 unit?

Henry
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] How to convert a large integer to base64

2011-01-15 Thread Andreas Schneider
On Saturday, January 15, 2011 18:52 Frank Church wrote:

> Is there a FCL library that can be used to convert a large integer into 
> base64 format?


Define  "large  integer"  ... in case you mean a normal integer/int64:
IntToHex(...);

-- 
Best Regards,
Andreas

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal