mirror of
https://github.com/Aviortheking/advent-of-code.git
synced 2025-08-05 01:41:59 +00:00
Added the four first days of 2015
Yes i'm gonna do them all ! Signed-off-by: Avior <github@avior.me>
This commit is contained in:
16
2015/day-4/part-1.ts
Normal file
16
2015/day-4/part-1.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import crypto from 'crypto'
|
||||
|
||||
|
||||
// const input = "pqrstuv"
|
||||
const input = "yzbqklnj"
|
||||
|
||||
let hash = ""
|
||||
let i = 0
|
||||
do {
|
||||
hash = crypto.createHash('md5').update(input + ++i).digest('hex')
|
||||
} while (!hash.startsWith('00000'))
|
||||
|
||||
|
||||
console.log(
|
||||
"Result:", i, hash
|
||||
)
|
16
2015/day-4/part-2.ts
Normal file
16
2015/day-4/part-2.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import crypto from 'crypto'
|
||||
|
||||
|
||||
// const input = "pqrstuv"
|
||||
const input = "yzbqklnj"
|
||||
|
||||
let hash = ""
|
||||
let i = 0
|
||||
do {
|
||||
hash = crypto.createHash('md5').update(input + ++i).digest('hex')
|
||||
} while (!hash.startsWith('000000'))
|
||||
|
||||
|
||||
console.log(
|
||||
"Result:", i, hash
|
||||
)
|
Reference in New Issue
Block a user