Skip to content

Commit eac308b

Browse files
committed
Rename salt variable to final_salt to distinguish it
1 parent 8004de8 commit eac308b

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

transcrypt

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ _openssl_encrypt() {
8080
# to ensure it is always included regardless of the OpenSSL version. #133
8181
(
8282
# Always prepend encrypted ciphertext with "Salted__" prefix and binary salt value
83-
printf "Salted__" && printf "%s" "$salt" | xxd -r -p &&
83+
printf "Salted__" && printf "%s" "$final_salt" | xxd -r -p &&
8484
# Encrypt file to binary ciphertext
85-
ENC_PASS=$password "$openssl_path" enc -e "-${cipher}" -md "${digest}" -pass env:ENC_PASS -S "$salt" "${pbkdf2_args[@]}" -in "$tempfile" |
85+
ENC_PASS=$password "$openssl_path" enc -e "-${cipher}" -md "${digest}" -pass env:ENC_PASS -S "$final_salt" "${pbkdf2_args[@]}" -in "$tempfile" |
8686
# Strip "Salted__" prefix and salt value if also added by OpenSSL (version < 3)
8787
LC_ALL=C sed -e "s/^\(Salted__.\{8\}\)\(.*\)/\2/"
8888
) | base64
@@ -216,15 +216,15 @@ _load_config_var() {
216216
local key=$1
217217
_load_unversioned_config_var "${key}"
218218
if [[ "$?" != "0" ]]; then
219-
if [[ "$USE_VERSIONED_CONFIG" == "1" ]]; then
220-
_load_versioned_config_var "${key}"
221-
if [[ "$?" != "0" ]]; then
222-
#(echo "loaded ${key} from versioned config")
223-
true
224-
else
225-
(echo "unable to load ${key}")
226-
fi
227-
fi
219+
if [[ "$USE_VERSIONED_CONFIG" == "1" ]]; then
220+
_load_versioned_config_var "${key}"
221+
if [[ "$?" != "0" ]]; then
222+
#(echo "loaded ${key} from versioned config")
223+
true
224+
else
225+
(echo "unable to load ${key}")
226+
fi
227+
fi
228228
else
229229
#(echo "loaded ${key} from unversioned config")
230230
true
@@ -380,7 +380,7 @@ git_clean() {
380380
else
381381
_load_vars_for_encryption
382382
# NOTE: the openssl standard for salt is 16 hex bytes.
383-
salt=$("$openssl_path" dgst -hmac "${filename}:${extra_salt}" -sha256 "$filename" | tr -d '\r\n' | tail -c 16)
383+
final_salt=$("$openssl_path" dgst -hmac "${filename}:${extra_salt}" -sha256 "$filename" | tr -d '\r\n' | tail -c 16)
384384
_openssl_encrypt
385385
fi
386386
}
@@ -1199,16 +1199,16 @@ help() {
11991199
defaults to md5
12001200
12011201
--kdf=PBKDF2
1202-
the key-derivation-function to use. Currently can be either
1203-
'pbkdf2' or 'none'. Defaults to none.
1202+
the key-derivation-function to use. Currently can be either
1203+
'pbkdf2' or 'none'. Defaults to none.
12041204
1205-
-pbkdf2
1205+
-pbkdf2
12061206
equivalent to passing --kdf2='pbkdf2'
12071207
12081208
-sm, --salt_method=SALT_METHOD
1209-
Method used to compute deterministic salt; can be password, random,
1210-
or a custom string to be used as the salt. Unless set to password,
1211-
the salt is randomized on a rekey.
1209+
Method used to compute deterministic salt; can be 'password', 'random',
1210+
or a custom string to be used as the salt. Unless set to password,
1211+
the salt is randomized on a rekey.
12121212
12131213
--set-openssl-path=PATH_TO_OPENSSL
12141214
use OpenSSL at this path; defaults to 'openssl' in \$PATH

0 commit comments

Comments
 (0)