Reorganise scripts
This commit is contained in:
parent
5ebf7f9b5c
commit
4ae0656da4
18 changed files with 196 additions and 104 deletions
19
.config/scripts/tool/encrypt.sh
Normal file
19
.config/scripts/tool/encrypt.sh
Normal file
|
@ -0,0 +1,19 @@
|
|||
function encrypt {
|
||||
FILE_EXTENSION=$(echo $1 | cut -f 2,3 -d '.')
|
||||
FILE_NAME=$(echo "$1" | cut -f 1 -d '.')
|
||||
|
||||
openssl enc -aes-256-cbc -salt -in "$*" -out "$FILE_NAME".enc
|
||||
echo "$GREEN_TEXT\nSend the follow command via Slack alongside the file:$DEFAULT_TEXT\n\`openssl enc -d -aes-256-cbc -in ~/Downloads/$FILE_NAME.enc >> $FILE_NAME.$FILE_EXTENSION"
|
||||
}
|
||||
|
||||
function salted-uuid {
|
||||
# Convert input into base64 string
|
||||
INPUT_AS_BASE64=$(echo -n "$1" | openssl dgst -binary -sha256 | openssl base64)
|
||||
BASE64_SANITIZED=$(echo -n "$INPUT_AS_BASE64" | sed 's/[=\/+-]//g')
|
||||
|
||||
# Add Delimiters to the string
|
||||
BASE_WITH_DELIM=$(echo -n "$BASE64_SANITIZED" | sed -E 's/./&-/32;s/./&-/20;s/./&-/16;s/./&-/12;s/./&-/8')
|
||||
|
||||
# Return with cruft removed
|
||||
echo "$BASE_WITH_DELIM" | cut -f1,2,3,4,5 -d"-"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue