Skip to content

Instantly share code, notes, and snippets.

@aabril
Last active April 11, 2024 18:32
Show Gist options
  • Save aabril/37d403126df891abeb59f41eaaecc62a to your computer and use it in GitHub Desktop.
Save aabril/37d403126df891abeb59f41eaaecc62a to your computer and use it in GitHub Desktop.

openssl version LibreSSL 2.8.3

#!/usr/bin/env bash

echo $1 | openssl aes-256-cbc -a -salt -pass pass:somepassword

decode.sh

#!/usr/bin/env bash

echo $1 | openssl aes-256-cbc -d -a -pass pass:somepassword

make files executable

chmod +x encode.sh decode.sh

encode example

./encode.sh "this is my test string"
# => U2FsdGVkX18fjSHGEzTXU08q+GG2I4xrV+GGtfDLg+T3vxpllUc/IHnRWLgoUl9q

decode example

./decode.sh U2FsdGVkX18fjSHGEzTXU08q+GG2I4xrV+GGtfDLg+T3vxpllUc/IHnRWLgoUl9q
# => this is my test string

source: https://stackoverflow.com/a/64799206

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment