Anonymous user
Base64 decode data: Difference between revisions
→{{header|C++14}}: simplifications
(Bash decode) |
(→{{header|C++14}}: simplifications) |
||
Line 216:
=={{header|C++}}==
{{Works with|C++14}}
<lang cpp>#include <algorithm>
#include <iostream>
Line 298 ⟶ 299:
auto i1 = findIndex(b1);
auto i2 = findIndex(b2);
▲ acc = i1 << 2; // six bits came from the first byte
acc |= i2 >> 4; // two bits came from the first byte
Line 331 ⟶ 330:
string data = "VG8gZXJyIGlzIGh1bWFuLCBidXQgdG8gcmVhbGx5IGZvdWwgdGhpbmdzIHVwIHlvdSBuZWVkIGEgY29tcHV0ZXIuCiAgICAtLVBhdWwgUi5FaHJsaWNo";
vector<ubyte> datav{ begin(data), end(data) };
cout << data << "\n\n" << decode(datav).data() << endl;
return 0;
|