Is there a FCL library that can be used to convert a large integer into base64 format?
Mailing lists / fpc-pascal / 2011-01
How to convert a large integer to base64
6 messages · 3 people · –
- FFrank Church 3
- AAndreas Schneider 2
- HHenry Vermaak 1
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Frank Church wroteIs 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(...);Is there a FCL library that can be used to convert a large integer into base64 format?…
Frank Church wroteIs there a FCL library that can be used to convert a large integer into base64 format?
Do you know about the base64 unit?
Henry
Define "large integer" ... in case you mean a normal integer/int64: IntToHex(...);…
Andreas Schneider wrote 10 lines
I mean int64 into base64 encoding, as in the mime type.
Show quoted text 8 lines
Frank Church wroteI 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 which can convert from decimal
into any given number system. (... and the opposite Numb2Dec)
Do you know about the base64 unit? Henry
Henry Vermaak wrote 8 lines
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 - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
