Advent Of Code — The Ideal Stocking Stuffer — Puzzle 4

Part 1

The Problem

Solution

size_t result = 0; while (true) { const auto str = secretKey + std::to_string(result); const auto md5Result = getMD5(str); if(md5Result.substr(0, 5) == "00000") { break; } ++result; } std::cout << result;

Part 2

The Problem

Solution

// Old line
if(md5Result.substr(0, 5) == "00000")
// New line
if(md5Result.substr(0, 6) == "000000")

Conclusion

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

The repository keyring expired, here’s how to renew it

Simply running linux on mac machine

An Introduction to Obsidian: Backup

Join our $2500 referral contest.

READ/DOWNLOAD$( AutoCAD/AutoCAD LT 2018 Fundamenta

Analyze Large CSV Files in Minutes With Docker Compose

A Gentle Beginner Introduction To Numpy Arrays

Python — Calculation & Comparison Operators

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Xavier Jouvenot

Xavier Jouvenot

More from Medium

Upgrading to Yocto Honister release

Why Does Arch Linux Exist?

Install a new Kernel in Gentoo

compiling the Kernel

Single-Host NAT via iptables