Jump to content

Base64 decode data: Difference between revisions

J
(Added solution for Action!)
(J)
Line 831:
<pre>To err is human, but to really foul things up you need a computer.
-- 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}}==
6,962

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.