Re:Why MD5('240610708') is equal to MD5('QNKCDZO')?
by mjw1007 on Wednesday April 12, 2023 @09:20AM
(#35539194)
I think you keep writing "Python" when you intended to write "PHP".
Re:Why MD5('240610708') is equal to MD5('QNKCDZO')?
by hn_throwaway_99 on Wednesday April 12, 2023 @09:24AM
(#35539247)
Lol, thanks, I'm an idiot, it was the brain fart that kept going.
Re:Why MD5('240610708') is equal to MD5('QNKCDZO')?
by blep_ on Wednesday April 12, 2023 @09:05AM
(#35538997)
... no? Python's == never does implicit type conversions unless one of the types overrides it to do so (neither str nor int does)
Re:Why MD5('240610708') is equal to MD5('QNKCDZO')?
by kobalsky on Wednesday April 12, 2023 @01:58PM
(#35543933)
There's one small gotcha with Python.
>>> 1 == True
True
Re:Why MD5('240610708') is equal to MD5('QNKCDZO')?
by blep_ on Wednesday April 12, 2023 @03:18PM
(#35545224)
Yes, but not because of type conversion: Python's booleans are a subclass of int.
Re:Why MD5('240610708') is equal to MD5('QNKCDZO')?
by cochne on Wednesday April 12, 2023 @09:03AM
(#35538973)
Python doesn’t do any automatic type conversion for strings
Re:Why MD5('240610708') is equal to MD5('QNKCDZO')?
by hn_throwaway_99 on Wednesday April 12, 2023 @09:18AM
(#35539158)
That's false, and that's the point I was trying to make, albeit unclearly - see https://stackoverflow.com/questions/12598407/why-does-php-co...
Re:Why MD5('240610708') is equal to MD5('QNKCDZO')?
by andreareina on Wednesday April 12, 2023 @09:20AM
(#35539189)
That's about PHP
Edit: I'm an idiot, thanks for the responses for correcting me, was thinking PHP but had Python on the brain I guess. Original bad edit: I was downvoted pretty hard, but I think I was just unclear. In Python, doing md5("foo") == md5("bar") returns true because Python converts both strings to numbers first because they have an e in them. That is, in my opinion, Python is doing an unnecessary conversion there that JS doesn't do in that case. See https://stackoverflow.com/questions/12598407/why-does-php-co...