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.
No matter what I put, I always get a ‘bad decrypt’ back. My answer is:
for i in {1..28}
do
var=$(echo $var | base64)
if [[ $i == 28 ]]
then
salt=$(echo $var | wc -c)
fi
done
...
Does anyone have any insight to this. I have looked at StackOverFlow and on here, and there is nothing that insightful, apart from people saying that the questions is poorly worded, but thats to be expected with HTB at this point ha!!
Any help or light anyone can shed on this, would be highly appreciated xx
The command echo XYZ sends XYZ and a newline character to stdout. Therefore, echo $var sends the content of the variable var and a newline character to stdout. But you need only the content of the variable var base64 encoded.
Hello.
I tried to solve this but i am having an error message. My code is below:
for count in {1…28}
do
var=$(echo $var | base64)
if [[ $count -eq 28 ]]
then
salt=$(echo -n $var | wc -m)
fi
done
And the error message i get is the following:
*** WARNING : deprecated key derivation used.
Using -iter or -pbkdf2 would be better.
bad decrypt
40E74883607F0000:error:1C800064:Provider routines:ossl_cipher_unpadblock:bad decrypt:…/providers/implementations/ciphers/ciphercommon_block.c:124:
I see that the -d flag is the one giving the issue but when i remove it the answer i get is not the correct one.
Hi All, I’m going to dredge this topic up again since I don’t see a reason to make another post on it. I’m just running the loop and then doing a word count. The last value on the screen is the salt when you run it, I just didn’t say “salt=” however, I did play around with different ways to compute length and to ensure that the loop terminated when I thought it would. I still can’t get the correct answer and I am hoping you can tell me what’s wrong with my code. Thanks!
nvmd, I read the question wrong…it doesn’t want the length of the salt as the answer to the question that rewards you for the 3 cubes, it wants whatever the program is spitting out already (e.g. the loop has to be put into the code above the exercise, not run in a vacuum). I’m pretty sure, with all the reasonably correct code on here and my observation most people will be on the right track.