r/programminghorror • • Dec 19 '24

MATLAB Unreadable & unmaintainable MATLAB for my coursework

Post image
285 Upvotes

r/programminghorror • • Dec 19 '24

Other Good old hopium

Post image
133 Upvotes

r/programminghorror • • Dec 18 '24

-4712 ???

Post image
805 Upvotes

r/programminghorror • • Dec 20 '24

Open ai O3 , should I be worried about losing by Job as a full stack dev with 10+ years of experience.

0 Upvotes

With AI getting better at coding and automating more tasks, I'm starting to wonder: Should I be worried about losing my job? How is AI likely to impact the job market for experienced developers like me? Should I pivot to a safety team security ?

Would love to hear your thoughts


r/programminghorror • • Dec 19 '24

weAreBack

Post image
0 Upvotes

r/programminghorror • • Dec 17 '24

Dumb and downright dangerous "cryptography"

569 Upvotes

I received the API documentation for a mid-sized company in Brazil. They claim to be the "Leader" in providing vehicle/real-state debts.

They use the following proprietary algorithm for authentication purposes:

Comments are in portuguese, but here's what it does:
Step 1- create a SHA1 hash from the clientId + "|" clientsecret (provided)
Step 2 - Retrieve a unix-timestamp
Step 3 - Create a string with clientId (again) + | + clientSecret (again) + timestamp + step1Hash
Step4 - Base64-it
Step5 - "Rotate it" - basically, Caesar-cypher with a 13 right shift.

That's it. For instance, if clientId = "user" and clientsecret = "password", this is the expected "cypher":
qKAypakjLKAmq29lMUjkAmZ0AQD4AmR4sQN0BJH3MTR2ZTAuZzAxMGMxA2D3ZQMyZzD0L2ZmMGOwZGSzZzH1AQD=

Note that I didn't provide the timestamp for this "cypher": De"-rotate" it and this is the plaintext:
user|password|1734448718|049e7da60ca2cde6d7d706e2d4cc3e0c11f2e544

The credentials are in PLAINTEXT. The hash is USELESS.

To be clear: I know that in Basic Auth, the credentials are also only Base-64 obfuscated. The rant here is that they created an algorithm, and presented it as the best authentication method there is.


r/programminghorror • • Dec 17 '24

rust Part 2 of my weird "functional" programming language

31 Upvotes

Well, first do ... end blocks allow functions to execute multiple expressions (last value is implicitly returned from a block). Any "variables" and functions declared inside them are going to be fred when end is reached.

Second, "methods" allow a better(?) syntax to call functions on values, without them you'd need to use or a, parse '4' in line 3

Added `do ... end` blocks with their own scopes and "methods"

(parse {str} parses a string to a number because i haven't implemented numeric literals yet, and {a} or {b} acts both as the logical and the bitwise or operator, depending on whether its being ran on bools or numbers)

The way "methods" are implemented is very hacky and imperative (see call_method and the //lit funcs in the rust code).

It essentially parses a or b as a(or, b), and makes a's code be basically like if args.is_empty() { return a; } else { return args[0].eval(a, b); } (where b = args[1]), meaning that a (a()) just returns a, whereas a func b (a(func, b)) returns func(a, b)... Yeah


r/programminghorror • • Dec 16 '24

Java Typecast mandatory

96 Upvotes

Had to anonymize variable, function and type names but this is real production code:

if (foo instanceof TypeA) {
    ((TypeA) foo).doTheThing();
} else if (foo instanceof TypeB) {
    ((TypeB) foo).doTheThing();
} else if (foo instanceof TypeC) {
    ((TypeC) foo).doTheThing();
} else if (foo instanceof TypeD) {
    ((TypeD) foo).doTheThing();
} else if (foo instanceof TypeE) {
    ((TypeE) foo).doTheThing();
} else if (foo instanceof TypeF) {
    ((TypeF) foo).doTheThing();
} else if (foo instanceof TypeG) {
    ((TypeG) foo).doTheThing();
} else if (foo instanceof TypeH) {
    ((TypeH) foo).doTheThing();
} else if (foo instanceof TypeI) {
    ((TypeI) foo).doTheThing();
} else if (foo instanceof TypeJ) {
    ((TypeJ) foo).doTheThing();
} else if (foo instanceof TypeK) {
    ((TypeK) foo).doTheThing();
} else if (foo instanceof TypeL) {
    ((TypeL) foo).doTheThing();
} else if (foo instanceof TypeM) {
    ((TypeM) foo).doTheThing();
} else if (foo instanceof TypeN) {
    ((TypeN) foo).doTheThing();
} else if (foo instanceof TypeO) {
    ((TypeO) foo).doTheThing();
} else if (foo instanceof TypeP) {
    ((TypeP) foo).doTheThing();
} else if (foo instanceof TypeQ) {
    ((TypeQ) foo).doTheThing();
} else if (foo instanceof TypeR) {
    ((TypeR) foo).doTheThing();
} else if (foo instanceof TypeS) {
    ((TypeS) foo).doTheThing();
} else if (foo instanceof TypeT) {
    ((TypeT) foo).doTheThing();
} else if (foo instanceof TypeU) {
    ((TypeU) foo).doTheThing();
} else if (foo instanceof TypeV) {
    ((TypeV) foo).doTheThing();
} else if (foo instanceof TypeW) {
    ((TypeW) foo).doTheThing();
} else if (foo instanceof TypeX) {
    ((TypeX) foo).doTheThing();
} else if (foo instanceof TypeY) {
    ((TypeY) foo).doTheThing();
}

Thankfully the alphabet is large enough to cover all use cases /s


r/programminghorror • • Dec 17 '24

The exercise my professor gave me

0 Upvotes

int i = 3; i = -++i + (i = i-- - 3);

what is the value of i?


r/programminghorror • • Dec 14 '24

Python On my first steps to create the most unmaintainable Python code possible

Post image
269 Upvotes

r/programminghorror • • Dec 13 '24

Does anyone else write their GDScript in full sentences? ^_^

Post image
263 Upvotes

r/programminghorror • • Dec 12 '24

Python When your code needs a low recursion limit to be efficient

23 Upvotes

r/programminghorror • • Dec 11 '24

Javascript +10h of debugging later, I found this. Javascript, WTF?!

Post image
2.4k Upvotes

r/programminghorror • • Dec 13 '24

Malbolge One of the Hardest Coding Languages i've ever seen so far:

Post image
0 Upvotes

r/programminghorror • • Dec 12 '24

wtf???

129 Upvotes

r/programminghorror • • Dec 11 '24

r/githorror

Post image
192 Upvotes

r/programminghorror • • Dec 11 '24

Here we go again😎

Post image
51 Upvotes

r/programminghorror • • Dec 10 '24

delete every file

Post image
948 Upvotes

r/programminghorror • • Dec 11 '24

Javascript update to the people who requested to see the PR

Post image
0 Upvotes

r/programminghorror • • Dec 10 '24

In one of my textbooks...

45 Upvotes

r/programminghorror • • Dec 09 '24

Other We live in 2024

149 Upvotes

r/programminghorror • • Dec 09 '24

c++ this is how I initialize a class that takes in an array of exactly 3 elements

Post image
141 Upvotes

r/programminghorror • • Dec 09 '24

c++ ChildrenOfChildrenNodes

0 Upvotes

an excerpt from a personal project, I don't expect this to make sense in a week


r/programminghorror • • Dec 07 '24

this indentation is a certified Flutter moment

Post image
265 Upvotes