Anonymous user
Base64 encode data: Difference between revisions
m
→{{header|REXX}}: fixed a typo, added whitespace.
(Add entry for SenseTalk) |
m (→{{header|REXX}}: fixed a typo, added whitespace.) |
||
Line 1,355:
A much higher value for '''chunk''' could be used for modern systems or implementations.
<lang rexx>/*REXX program converts text (from a file or the C.L.) to a base64 text string. */
parse arg iFID @ /*
if iFID=='' | iFID=="," then iFID='favicon.ico' /*Not specified? Then use the default.*/
chunk=
/*If @ isn't a blank, then use CL text.*/
if @='' then do s=1 by chunk until y=='' /* " " is " " " " the file*/
y= charin(iFID, s, chunk)
@= @ || y
end /*s*/ /* [↑] read a chunk of the file ──► @ */
t= base64(@)
say center(' input', 79, "─"); say @ /*show the header and the input text.*/
say center('base64', 79, "─"); say t /* " " " " " base64 " */
Line 1,372:
do i=0 for 64 /*process each char in the Z string. */
!.i= substr(z, i + 1, 1)
end /*i*/
b= x2b( c2x(Q) )0000000000000000
L= length(Q) * 8
do j=1 by 6 to L /*traipse through bit string by six. */
_= x2d( b2x( substr(b, j, 6)
$= $ || !._
end /*j*/
/* [↓] maybe append equal signs to $. */
|