Who can give me a hint about this question in this module? question: Create a “For” loop that encodes the variable “var” 28 times in “base64”. The number of characters in the 28th hash is the value that must be assigned to the “salt” variable. This is my content: for i in {1…28} do var=$(echo $var | base64) if [[i -eq 28]] then salt=${#var} fi done *** WARNING : deprecated key derivation used. Using -iter or -pbkdf2 would be better. bad decrypt 140343231202624:error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt:…/crypto/evp/evp_enc.c:610: Am I misunderstanding this question?

Same problem, have you found a solution?

try to use salt=$(echo $var | wc -c)

> @jad2121 said: > try to use salt=$(echo $var | wc -c) Thanks!! The case lets me know what difference between wc -c and ${#var}

echo “string” | wc -c counts the exact number of characters in the string returned by echo, that is “string” plus a line break appended by echo, so 7 in that case. ${#var} returns the exact number of characters contained in the var variable. You can obtain the same behavior by specifying the -n flag to echo, which gets rid of the trailing \n. I don’t know what exercise you’re doing and what is the expected answer but just in case your answer is not accepted, this might be a cause of issues : var=$(echo $var | base64) Add the -n flag to echo, and also the “-w 0” flag to base64, otherwise every 76 characters base64 adds a line break, so it might mess up the number of characters in the end. Also, what is that error message you’re getting ? I can’t see how you can get that from the script you pasted here.

This is what I got to work. Hope this helps!



for i in {1..40}
        var=$(echo $var | base64)
        temp=$(echo $var | wc -c)
        if [[ $temp -gt 113469 ]]
                if [[ "$var" == *"$value"* ]]
                        echo $var |tail -c 20

I am getting the same error . the number of characters in the 28th hash I am getting is 46026. I assigned that number to salt but got the same error

ok I actually figured out the issue you need to encode the var 28 times so instead of using for i in {0…28} you use 0…27 as the 0 will actually count as an encode. the total number of character you get in this case is 34071