PinCode bruteforce

Report a typo

Scally's phone has a pin code. She calculated its hash but lost the code itself. She remembers that her pin is 4 digits, though. Help Scally fiinish program that iterates over the options and produces the correct lost code.

Write a program in Scala 3
@main def pinCodeBruteforce = {
val pinCodeHash = 1537215
var candidate: Int = 0

def asPinCode(i: Int): String = f"???%04d"

while asPinCode(candidate).hashCode ???
do ???

println(asPinCode(candidate))
}
___

Create a free account to access the full topic