MD5 hash

I was working on an old Advent of Code problem and it required calculating an MD5 hash so I decided to lookup how to create one and by a LOT of trial and error (had to re-get my head around little and big endianness) I created a pure SnapI version

MD5 script pic (15)

It does contain some binary/hexadecimal conversion reporters that might be useful in other projects
MD5 script pic (8)
MD5 script pic (5)

MD5 script pic (7)

MD5 script pic (10)

MD5 script pic (9)

MD5 script pic (6)

[edit 05Oct2022 to handle empty or single char input]
[edit 05Oct2022 - 9 times speed up by removing unnecessary number base conversions :slight_smile: ]

[edit29Oct2022 When trying another AOC puzzle, I needed to iterate over 26million strings and calculate their hashes and my native Snap! implementation just wasn't anywhere near fast enough :frowning:

So I used a JS implementation from GitHub and made a reporter using it.

AOC2016_05_01 script pic

PS:This is not a snap code golf so you could use javascript

what's wrong with programming in the language that the ide expects you to program in?

I mean the advent of code accepts answers not snap code so if you have trouble with hashing you can use javascript to link to an external service

wouldn't that sort of be "cheating"?

And even it is,the advent of code cannot see what you are doing offline

This is not a CSP-J test

well personally i'd feel more proud of myself if i implemented an MD5 hash myself rather than sending a request to some website to deal with it.

Oh ok

If I try to convert a one-letter string to MD5 hash, I get this:

if you aren't actually creating the thing yourself, what's the point of doing the advent of code?
it's like giving yourself a math test and just putting every question into wolfram

I meant to use Python for hashing

Thanks for trying that

I'd over-optimised that map function and it didn't handle empty or single chars anymore

I've reverted it back to the previous code that definitely produces a list

isn't 3 languages a bit much? this is just an md5 hash.
i feel like you would have more code just for running other code than to actually do the task

it's generally best practice in programming to try and keep things simpler, it's difficult to work with something that's in many different languages in many different places.

lol haha
i was just taking a joke on this,and trying to convince you to use 8 nested backslashes and quotes(you double the number of back slashes for every language)