Base64 decode data: Difference between revisions

Content added Content deleted
(Added solution for Action!)
(J)
Line 831: Line 831:
<pre>To err is human, but to really foul things up you need a computer.
<pre>To err is human, but to really foul things up you need a computer.
-- Paul R. Ehrlich</pre>
-- Paul R. Ehrlich</pre>

<lang J>
using J's [https://github.com/jsoftware/convert_misc/blob/master/base64.ijs convert/misc/base64] script:

<lang> require'convert/misc/base64'
frombase64 'VG8gZXJyIGlzIGh1bWFuLCBidXQgdG8gcmVhbGx5IGZvdWwgdGhpbmdzIHVwIHlvdSBuZWVkIGEgY29tcHV0ZXIuCiAgICAtLSBQYXVsIFIuIEVocmxpY2g='
To err is human, but to really foul things up you need a computer.
-- Paul R. Ehrlich</lang>

Alternative implementation based on that script:

<lang J>
BASE64=: (a.{~ ,(a.i.'Aa') +/i.26),'0123456789+/'

frombase64=: {{
pad=. _2 >. (y i. '=') - #y
pad }. a. {~ #. _8 [\ , (6#2) #: BASE64 i. y
}}
</lang>


=={{header|Java}}==
=={{header|Java}}==