dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit e32a87a43fb563608788c5300e963d4103df225b
parent f6e1f95a0287fc6e77786a0f438b33b665e33de9
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Tue, 29 Sep 2020 13:00:22 +0200

enc: add simple script to encode/decode files with password

Diffstat:
A.local/bin/enc | 22++++++++++++++++++++++
1 file changed, 22 insertions(+), 0 deletions(-)

diff --git a/.local/bin/enc b/.local/bin/enc @@ -0,0 +1,22 @@ +#!/bin/sh +set -e + +handle_file() +{ + if [ "$unencrypt" = 1 ]; then + openssl aes-256-cbc -d -a -iter 100000 -in "$1" -out "${1%.enc}" + rm "$f" + else + openssl aes-256-cbc -a -iter 100000 -in "$1" -out "${1}.enc" + rm -P "$f" + fi +} + +unencrypt=0 +if [ "$1" = "-u" ]; then + unencrypt=1 + shift +fi +for f in "$@"; do + handle_file "$f" +done