A collection of scripts to encode and decode strings to and from Base64 in various programming languages.
This repository contains implementations of Base64 encoding and decoding in multiple programming languages. Each script provides functionality to encode a given string to Base64 and decode a Base64-encoded string back to its original form.
base64_enc_dec.c- C implementationbase64_enc_dec.js- JavaScript implementationbase64_enc_dec.py- Python implementationbase64_enc_dec.rb- Ruby implementationbase64_enc_dec.sh- Bash implementationbase64_enc_dec.go- Go implementation
Make sure you have the required runtime installed on your system before running the scripts. Make sure all scripts have executable permissions except for the C & Go programs:
chmod +x base64_enc_dec.*Compile the C program using gcc:
gcc -o base64_enc_dec base64_enc_dec.cRun the program:
./base64_enc_dec encode "your_string"
./base64_enc_dec decode "your_base64_string"Ensure you have installed node:
./base64_enc_dec.js encode "your_string"
./base64_enc_dec.js decode "your_base64_string"Ensure you have installed python3.12:
./base64_enc_dec.py encode "your_string"
./base64_enc_dec.py decode "your_base64_string"Ensure you have installed ruby:
./base64_enc_dec.rb encode "your_string"
./base64_enc_dec.rb decode "your_base64_string"Run the Bash script:
./base64_enc_dec.sh encode "your_string"
./base64_enc_dec.sh decode "your_base64_string"Build the Go executable using go build:
go build -o base64_enc_dec base64_enc_dec.goRun the program:
./base64_enc_dec -operation encode -input "your_string"
./base64_enc_dec -operation decode -input "your_base64_string"This repository includes a benchmarking script, benchmark_base64.sh, which allows you to compare the performance of Base64 encoding and decoding across multiple programming languages. The script executes implementations in C, Python, Ruby, JavaScript, Bash, and Go, measuring the time taken to encode and decode a sample string in each language.
To use the benchmarking script, ensure that all necessary runtime environments and dependencies are installed. The script will compile the C program and build the Go executable automatically and attempt to run each language's script. It also checks if the scripts are executable and makes them executable if necessary.
To run the benchmark:
./benchmark_base64.shThis benchmarking script provides insight into the relative performance of Base64 encoding and decoding across different languages.