1
What is the difference between, make python open and read a file, to pass the read result between áspas?
For when I open a file, it contains only the word test and I pass this reading result by a hash algorithm the result is:
cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e
Note: Result is not expected
Now step as parameter within code(not user input) for the string hash algorithm "test"
b123e9e19d217169b981a61188920f9d28638709a5132201684d792b9264271b7f09157ed4321b1c097f7a4abecfc0977d40a7ee599c845883bd1074ca23c4af
Note: This is the expected result; I’m using the .Encode('utf-8') in charge
Commando:
hashlib.sha512(hash_target).hexdigest()
In which hash_target is the string that goes through the hash algorithm, which in the above example would be the string test
To read the file I used the command:
archive = open(file, 'r')
How did you read the file?
– Woss
And there just happened to be no one left
\n
at the end of the file read line?– Woss
I did the test with the ' n' going through the algorithm, together with the "test" (as I did in the second attempt, also shown in the question), ie "test n", and gave a result different from the first shown in the question, ie theoretically not.
– user62320