Skip to content

Instantly share code, notes, and snippets.

@m0rb
Last active February 18, 2023 03:05
Show Gist options
  • Save m0rb/01b1a68db58f19a602464159b3dfbaa4 to your computer and use it in GitHub Desktop.
Save m0rb/01b1a68db58f19a602464159b3dfbaa4 to your computer and use it in GitHub Desktop.
horrible base64 encoder
#!/bin/bash
B=({A..Z} {a..z} {0..9})
I=`perl -pe'$_=unpack"B*"'<<<$*`
for((;${#I}%6;)){ I+=0;}
for((;p<${#I};p+=6)){ O+=${B[2#${I:p:6}]};}
for((;${#O}%4;)){ O+=\=;}
echo $O
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment