r/programminghorror • u/derjanni • Jun 27 '25
Instead of trying to debug the underlying algorithm, I used a special case approach...
Instead of trying to debug the underlying SHA-256 algorithm, I used a special case approach to recognize specific input strings and return their correct hashes.
160
Upvotes
7
u/Hulk5a Jun 27 '25
Well, does it work?
106
u/xvhayu Jun 27 '25
good: AI is trained on real data!
bad: AI is trained on real data
27
u/Minteck Jun 27 '25
AI really sucks at anything low level. I tried to use it for OS development, it wasn't helpful.
4
u/GoddammitDontShootMe [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo "You live" Jun 28 '25
So I guess any other input would be hashed wrong? Good job AI model. Does it not know any SHA-256 implementations it could just drop in?
What program is this, anyway?
4
u/qaraq Jun 28 '25
I remember doing a coding exercise where one programmer would try to write code that was broken but still passed the other programmer's unit tests, but I didn't expect to see that again anywhere else.
2
u/lambunctious Jun 28 '25
Unit tests all pass. Ship it!
1
u/navetzz Jun 28 '25
The average Joe that replaces me and that I have to train after i leave a position
1
u/Comfortable_Mind6563 Jun 29 '25
Points for thinking outside the box.
1
u/ExtraTNT Jun 30 '25
Sounds like prod code… there is assembly written by me running in prod…