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++; + } +}