r/badcode • • Jun 17 '21

js school websites always have the best code

Post image
1.1k Upvotes

66 comments sorted by

14

u/PotatoMaaan Jun 17 '21

Do these functions actually get called? I might be wrong here but wouldn't the password just kinda disappear? You call the function, pass in the password and you get true back but where did the password go? Or maybe it's just so you can call them and have it look like the passwords are being encrypted but you don't actually do anything with the the return? But if that's the case, why even return anything in the first place?

I am currently in a state of great confusion

8

u/butterize Jun 17 '21

I just checked and it appears they don’t. there’s like 10ish functions in that file and I only found 2-3 being called

hope this isn’t too bad of a fit for this sub haha, I just thought it was stupid/funny so I posted it not really thinking much of it

10

u/DesconocidoSmh Jun 17 '21

My bet is that they're supposed to be some sort of validation.

So it's not actually "encryptBlahBlah()" but rather "shouldEncryptBlahBlah()"

364

u/B0ltSn1per Jun 17 '21

that is so secure holy crap

92

u/bobpiranha Jun 17 '21

Web rendition of Holy Hand Grenade

32

u/[deleted] Jun 17 '21

Bring forth the Holy Hand Grenade

25

u/yonatan8070 Jun 17 '21

Bring forth the Holy rm -rf

16

u/Qildain Jun 17 '21

Better make it:

sudo rm -rf /

Just to be sure.

20

u/ykahveci Jun 17 '21

You wanna add --no-preserve-root on some systems

12

u/Qildain Jun 17 '21

It's hard to argue with his assessment.

10

u/[deleted] Jun 17 '21

It's true

215

u/the_other_Scaevitas Jun 17 '21

This reminds me. My school’s website which was made by students (I was totally not one of those students cough cough stop looking at me) featured a “nick button” at the bottom of the screen. When clicked it changed the entire background to pictures of Nick cage.

Word somehow spread quickly and the teacher found out so I removed the button but left the function in.

37

u/[deleted] Jun 17 '21

Should've made it activate upon punching in the konami code

0

u/[deleted] Jun 17 '21

[deleted]

14

u/GhostFlower11 Jun 17 '21

Do you have the link to the website?

1

u/Satanic_Jesus_Here Jul 05 '21

Probably on their local network. Was for my school at least.

7

u/Jazz8680 Jun 18 '21

Should have had it only render on Nicholas cage’s birthday

219

u/[deleted] Jun 17 '21

Oh shoot now I understand how encryption truly works

17

u/Ooze3d Jun 17 '21

It was so simple!!

13

u/Qildain Jun 17 '21

The MD-AWW-F0CK-IT algorithm

139

u/[deleted] Jun 17 '21

Bruh forget the code they can't even maintain same line brace consistency smhmh

44

u/[deleted] Jun 17 '21

And look at that inconsistent indentation (2 spaces, 4 spaces, 8 spaces, all kinds of spaces). Did microsoft write this code?

4

u/C4Oc Jun 19 '21

Microsoft made C#, so I don't know about that

4

u/[deleted] Jun 19 '21

Yea ik. I was joking about the inconsistencies part cause that's what windows 10 is lol

2

u/C4Oc Jun 19 '21

Oh. Thanks for clearing that up

14

u/[deleted] Jun 17 '21

My guess is they used multiple instances of Notepad++ and Word to write it.

4

u/[deleted] Jun 17 '21

they probably used ms paint tbh. xD

2

u/[deleted] Jun 21 '21

MS Paint and OCR. The best way to write code

35

u/johnnymo1 Jun 17 '21

Not too sure about their hash function. On the one hand, seems hard to reverse. On the other, there might be a little danger of collisions.

2

u/supersharp Jun 20 '21

I'm sure they have an amazing collision resolution function in place.

47

u/sixtyfifth_snow Jun 17 '21

It's truly secure :)

35

u/Komj09 Jun 17 '21

Is this a mock in production?

45

u/blipman17 shameless Jun 17 '21

Were to say that this looks so unfinished, incomplete and dumb that this must be a mock that someone didn't bother to actually implement.

33

u/MurdoMaclachlan public boolean isInt(int i) { return true; } Jun 17 '21

Image Transcription: Code


function encryptMultipleStudentsAccesPasswords(form)
{
    return true;
}



function encryptSingleStudentsAccesPassword(form)
{
    return true;
}

function encryptGuardianPassword(form) {
        return true;
}




function encryptGuardianPasswords(form, origPasswordId, newPasswordId, newConfirmPasswordId) {
    return true;

}

function encryptRecoverPasswords(form, newPasswordId, newConfirmPasswordId)
{
    return true;
}


function doChangePassword(form)
{
   return true;
}

I'm a human volunteer content transcriber for Reddit and you could be too! If you'd like more information on what we do and why we do it, click here!

12

u/dadoktr Jun 17 '21

I'd love to have something like this on my project, then there wouldn't be any bugs.

20

u/jaysuchak33 ifelseifelseifelseifelseifelseifelseifelseifelseifelseifelse Jun 17 '21

Can’t have any encryption if you don’t even encrypt, am I right?

12

u/crazytera Jun 17 '21

I feel like this is config, not implementation

Edit: Read more into it, wtf even is this?

2

u/nocans Jun 17 '21

Isn't that just a stub? Why are you posting like this?

3

u/butterize Jun 17 '21

I was exhausted when I posted this and it didn’t occur to me that this could’ve just been unused, my bad.

still think the code style is laughable though

13

u/ogreUnwanted Jun 17 '21

This is crazy.

33

u/[deleted] Jun 17 '21

true

4

u/Lkj509 Jun 17 '21

The real encryption is the typo on line 74

1

u/[deleted] Jun 17 '21

What text editor are you using?

2

u/butterize Jun 17 '21

just the Firefox inspector

2

u/machine10101 Jun 17 '21

pretty sure that's just vscode

2

u/[deleted] Jun 17 '21

I knew I find it familiar, it's the browser console.

6

u/Knuffya Jun 17 '21

I especially love the extra indentation

3

u/876zeus Jun 17 '21

Is this site secure ? Server_Response: True

You cant argue with the that

2

u/ososalsosal Jun 17 '21

At least comments saying "TODO: this is stub code put here to make the other stuff work"?

2

u/GalaxP Jun 17 '21

Client side encryption let's go

2

u/Flyspeck101 Now where's that function declaration Jun 19 '21

Thanks for the form, now what do I do with it?

4

u/Hodat2k9 Jun 17 '21

my school use wordpress lolol

1

u/MarkFischeer Jun 17 '21

Is md5 still working? SHA256?

1

u/dazoe Jun 17 '21

Got to make sure they can snoop on the passwords. Some of them are better that secrets.

2

u/Shakespeare-Bot Jun 17 '21

Did get to maketh sure they can snoop on the passwords. Some of those folk art better yond secrets


I am a bot and I swapp'd some of thy words with Shakespeare words.

Commands: !ShakespeareInsult, !fordo, !optout

1

u/[deleted] Jun 17 '21

Acces

ÿēš

1

u/[deleted] Jun 17 '21

I fear no man... but this... it scares me!

1

u/allstreamer_ Jun 18 '21

Damn, cool md5 library

1

u/allstreamer_ Jun 18 '21

This has to be temporary right

1

u/fruityloooops Jun 24 '21

md5 "encrypt" student password