Skip to content

Instantly share code, notes, and snippets.

@saterus
Last active August 7, 2021 23:15
Show Gist options
  • Save saterus/199eedbb70725e6d9d8726c55b0f4235 to your computer and use it in GitHub Desktop.
Save saterus/199eedbb70725e6d9d8726c55b0f4235 to your computer and use it in GitHub Desktop.

Encrypt with a password

$ openssl enc -aes-256-cbc -pbkdf2 -iter 10000 -in data.txt -out encrypted.txt
$ echo "data" | openssl enc -aes-256-cbc -pbkdf2 -iter 10000 > encrypted.txt
$ openssl enc -aes-256-cbc -pbkdf2 -iter 10000 -in data.txt -out encrypted.txt -pass file:PASSWORD_FILE

Decrypt with a password

$ openssl enc -d -aes-256-cbc -pbkdf2 -iter 10000 -in encrypted.txt
function unlock_key -a saltfile -d "Read the password, apply the salt, hash it"
    cat (read --silent --prompt-str="password> " | psub --fifo) $saltfile \
    | sha256sum \
    | head -c 64
end

function fetch_url -d "Fetch a file by masked url"
    curl -s (read --silent --prompt-str="url> ")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment