From 972b0dbe17b558a324e0087f1bbbb574342fe0ce Mon Sep 17 00:00:00 2001 From: Alix von Schirp Date: Tue, 11 Nov 2025 04:51:48 +0100 Subject: [PATCH] 2015/4 --- src/2015/4/1/index.ts | 13 +++++++++++++ src/2015/4/2/index.ts | 13 +++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 src/2015/4/1/index.ts create mode 100644 src/2015/4/2/index.ts diff --git a/src/2015/4/1/index.ts b/src/2015/4/1/index.ts new file mode 100644 index 0000000..b4fc72b --- /dev/null +++ b/src/2015/4/1/index.ts @@ -0,0 +1,13 @@ +export default async function runner(inputPath: string){ + const input = (await Bun.file(inputPath).text()).trimEnd(); + + let i = 1; + while (true){ + const hash = Bun.MD5.hash(`${input}${i}`, "hex") + if(hash.startsWith("00000")) { + console.log(i); + return; + } + i++; + } +} diff --git a/src/2015/4/2/index.ts b/src/2015/4/2/index.ts new file mode 100644 index 0000000..d85b1af --- /dev/null +++ b/src/2015/4/2/index.ts @@ -0,0 +1,13 @@ +export default async function runner(inputPath: string){ + const input = (await Bun.file(inputPath).text()).trimEnd(); + + let i = 1; + while (true){ + const hash = Bun.MD5.hash(`${input}${i}`, "hex") + if(hash.startsWith("000000")) { + console.log(i); + return; + } + i++; + } +}